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

[revsets]
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) to
# suppress symbol resolution error.
log = "present(@) | ancestors(immutable_heads().., 2) | present(trunk())"
# Emit the working-copy branch first, which is usually most interesting.
# This also helps stabilize output order.
log-graph-prioritize = "present(@)"
sign = "reachable(@, mutable())"

[revset-aliases]
# trunk() can be overridden as '<bookmark>@<remote>'. Use present(trunk()) if
# symbol resolution error should be suppressed.
'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) to suppress symbol resolution error.
'builtin_immutable_heads()' = 'present(trunk()) | tags() | untracked_remote_bookmarks()'
'immutable_heads()' = 'builtin_immutable_heads()'
'immutable()' = '::(immutable_heads() | root())'
'mutable()' = '~immutable()'
