From 8bfcd142943d8acb2b192434610ab0ab86fad42c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 21 Jun 2025 12:13:24 +0200 Subject: [PATCH] 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'). --- vcs/jj/config/jj/config.toml | 10 ++++++++-- vcs/jj/config/sh/alias.d/jj.sh | 9 +++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/vcs/jj/config/jj/config.toml b/vcs/jj/config/jj/config.toml index 05f0890..a9c6eb8 100644 --- a/vcs/jj/config/jj/config.toml +++ b/vcs/jj/config/jj/config.toml @@ -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)" diff --git a/vcs/jj/config/sh/alias.d/jj.sh b/vcs/jj/config/sh/alias.d/jj.sh index 070edce..a8033fe 100644 --- a/vcs/jj/config/sh/alias.d/jj.sh +++ b/vcs/jj/config/sh/alias.d/jj.sh @@ -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)'"