# NOTE: ensure you update docs/revsets.md with documentation when
# adding/updating any of these aliases

[revsets]
arrange = "reachable(@, mutable())"
fix = "reachable(@, mutable())"
simplify-parents = "reachable(@, mutable())"
# log revset is also used as the default short-prefixes. If it failed to
# evaluate, lengthy warning messages would be printed. Use present(expr) if
# symbols in expr might not always exist.
log = "present(@) | ancestors(immutable_heads().., 2) | trunk()"
# Emit the working-copy branch first, which is usually most interesting.
# This also helps stabilize output order.
log-graph-prioritize = "present(@)"
op-diff-changes-in = "mutable() | immutable_heads()"
sign = "reachable(@, mutable())"
bookmark-advance-to = "@"
bookmark-advance-from = "heads(::to & bookmarks())"

[revset-aliases]
# trunk() can be overridden as '<bookmark>@<remote>'.
'trunk()' = '''
latest(
  remote_bookmarks(exact:"main", exact:"origin") |
  remote_bookmarks(exact:"master", exact:"origin") |
  remote_bookmarks(exact:"trunk", exact:"origin") |
  remote_bookmarks(exact:"main", exact:"upstream") |
  remote_bookmarks(exact:"master", exact:"upstream") |
  remote_bookmarks(exact:"trunk", exact:"upstream") |
  root()
)
'''

# If immutable_heads() failed to evaluate, many jj commands wouldn't work. Use
# present(expr) if symbols in expr might not always exist.
'builtin_immutable_heads()' = 'trunk() | tags() | untracked_remote_bookmarks()'
'immutable_heads()' = 'builtin_immutable_heads()'
'immutable()' = '::(immutable_heads() | root())'
'mutable()' = '~immutable()'

'visible()' = '::visible_heads()'
'hidden()' = '~visible()'
