jj: Adopt new default revset aliases

This commit changes the way I display my jj logs a little. We
distinguish between 3 styles now

- the 'stack()': short and to the point, only ancestor commits from the
  last non-mutable one onwards
- the 'recent()': the previously default view over ancestor commits or
  any other head nodes (i.e. any branches) that are from me,
  with a few commits leading up to them visible.
- the 'all()': the traditional 'show everything' summation for finding
  very specific commits or getting a macro-scale overview of the history

Basically, only the 'stack()' view was added - but it is now the new
default for the default command and the previous 'default' has been
renamed to 'recent()'.

This is mirrored in the shell aliases: all the `jl`, `jlo`, `jloo`
aliases use the 'recents()' view. The capital versions (`JL` and the
like) are not affected as as they keep showing the 'all()' view.
Importantly, the `j` base command uses the 'stack()' view, however.

Lastly, we extract the aliases to find `WIP:` commits and `PRIVATE:`
commits into actual jj revset aliases and call them from our shell
aliases. The functionality does not change, though we now have an
additional alias for finding specifically the latter commits with `jlfp`
('jj log find private').
This commit is contained in:
Marty Oehme 2025-06-21 12:13:24 +02:00
parent 4bc0ef9ed7
commit a927986bf0
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 13 additions and 6 deletions

View file

@ -11,7 +11,7 @@ sign-on-push = true
private-commits = "description(glob-i:'WIP:*') | description(glob-i:'PRIVATE:*')" # refuse to push WIP commits
[ui]
default-command = "log"
default-command = ["log", "-T", "builtin_log_oneline", "-r", "stack()"]
diff-editor = ["nvim", "-c", "DiffEditor $left $right $output"]
# use delta as formatter but _only_ for diff and show
@ -73,7 +73,7 @@ if(root,
'''
[revsets]
log = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()"
log = "recent()"
[revset-aliases]
"bases" = "dev"
@ -81,3 +81,9 @@ log = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | tru
"branches" = "downstream(trunk(), bookmarks()) & mine()"
"curbranch" = "latest(branches::@- & branches)"
"githead" = "::git_head()"
"wip()" = "description(regex:\"^WIP:\")"
"private()" = "description(regex:\"^PRIVATE:\")"
"blacklist()" = "wip() | private()"
"recent()" = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()"
"recent(x)" = "ancestors(x, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()"
"stack()" = "ancestors(reachable(@, mutable()), 2)"

View file

@ -49,11 +49,11 @@ alias jab="jj abandon"
# revset info
alias J="jj log -r 'all()'" # mirror default command being log
alias jl="jj log -T builtin_log_oneline"
alias jl="jj log -T builtin_log_oneline -r 'recent()'"
alias JL="jj log -T builtin_log_oneline -r 'all()'"
alias jlo="jj log --summary -T builtin_log_compact_full_description"
alias jlo="jj log --summary -T builtin_log_compact_full_description -r 'recent()'"
alias JLO="jj log --summary -T builtin_log_compact_full_description -r 'all()'"
alias jloo="jj log --patch"
alias jloo="jj log --patch -r 'recent()'"
alias JLOO="jj log --patch -r 'all()'"
alias jol="jj op log"
jlf() {
@ -65,7 +65,8 @@ jlof() {
jloof() {
jj log --patch -r "description(substring-i:\"$*\")"
}
alias jlfw='jj log -r "description(regex:\"^WIP:\")"'
alias jlfw='jj log -r "wip()"'
alias jlfp='jj log -r "private()"'
# show branches (i.e. head commits) w a couple previous commits
alias jh="jj log -r 'ancestors(heads(all()), 3)'"