You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When rendering the commit graph in jj log, jj will prioritize rendering the working copy first, and then the remaining branches. This is a good starting point for a heuristic, but it's doesn't always result in the most readable graph.
Example 1: jj prev/next
When traversing a branch with these commands, prioritizing just @ will display the otherwise linear list of commits out of order, instead of 5 4 3 @ 2 1 it will be @ 5 4 3 2 1
@ ooss jakob.hellermann 2m ago main wip
◆ lmxr jakob.hellermann 2m ago commit 4◆ lvzk jakob.hellermann 2m ago commit 3◆ romu jakob.hellermann 2m ago commit 2◆ pruv jakob.hellermann 3m ago commit 1◆ zzzz root()
@ vywr jakob.hellermann 1s ago (empty) (no description set)
│◆ ooss jakob.hellermann 5m ago main wip
├─╯◆ lmxr jakob.hellermann 5m ago commit 4◆ lvzk jakob.hellermann 5m ago commit 3◆ romu jakob.hellermann 5m ago commit 2◆ pruv jakob.hellermann 5m ago commit 1◆ zzzz root()
@ wrsz jakob.hellermann 27s ago (empty) (no description set)
│◆ ooss jakob.hellermann 5m ago main wip
│◆ lmxr jakob.hellermann 5m ago commit 4├─╯◆ lvzk jakob.hellermann 5m ago commit 3◆ romu jakob.hellermann 5m ago commit 2◆ pruv jakob.hellermann 5m ago commit 1◆ zzzz root()
vs jj log --config 'revsets.graph-prioritize=main':
◆ ooss jakob.hellermann 7m ago main wip
◆ lmxr jakob.hellermann 7m ago commit 4│@ rvzp jakob.hellermann 15s ago (empty) (no description set)
├─╯◆ lvzk jakob.hellermann 7m ago commit 3◆ romu jakob.hellermann 7m ago commit 2◆ pruv jakob.hellermann 7m ago commit 1◆ zzzz root()
Example 2: Megamerge
Another situation where I noticed the graph being clearer with nonstandard priorization is when you have a "megamerge" commit of some local branches, and temporarily go work on another branch that's not
jj log@ qmkx jakob.hellermann 3m ago push-mokuookxrmnu* cli: add dynamic completions for -T template aliases
│○ pqmm jakob.hellermann 4m ago push-pqmmuqxxzvmt* cli: completion: derive `clap::ValueEnum` for `ColorChoice`
├─╯│○ squk jakob.hellermann 4m ago add templater size_hint
├─╯│○ qlvu jakob.hellermann 4m ago push-qlvuxttmqltm* templater: add String.replace("from", "to") method
├─╯│○ utmp jakob.hellermann 21m ago (empty) dev
│├─╮││○ yomz jakob.hellermann 55m ago jiff-duration use jiff for duration formatting
├───╯│○ qxnv jakob.hellermann 55m ago revset-prioritize* add revsets.graph-prioritize
├─╯◆ xrnl bsdinis 2h ago main git_head() git: describe codepaths that require git2
◆ mvvt bsdinis 2h ago cli: relocate git fetch code to cli/src/commands/git/fetch.rs
◆ zypt bsdinis 2h ago git: update jj git clone|fetch to use new GitFetch api directly.│~
jj log--config 'revsets.graph-prioritize="description(\"dev\")"'○ utmp jakob.hellermann 22m ago (empty) dev
├─╮│○ yomz jakob.hellermann 56m ago jiff-duration use jiff for duration formatting
○│ qxnv jakob.hellermann 56m ago revset-prioritize* add revsets.graph-prioritize
├─╯│@ qmkx jakob.hellermann 4m ago push-mokuookxrmnu* cli: add dynamic completions for -T template aliases
├─╯│○ pqmm jakob.hellermann 5m ago push-pqmmuqxxzvmt* cli: completion: derive `clap::ValueEnum` for `ColorChoice`
├─╯│○ squk jakob.hellermann 5m ago add templater size_hint
├─╯│○ qlvu jakob.hellermann 5m ago push-qlvuxttmqltm* templater: add String.replace("from", "to") method
├─╯◆ xrnl bsdinis 2h ago main git_head() git: describe codepaths that require git2
◆ mvvt bsdinis 2h ago cli: relocate git fetch code to cli/src/commands/git/fetch.rs
◆ zypt bsdinis 2h ago git: update jj git clone|fetch to use new GitFetch api directly.│~
Solution
I've experimented with adding a graph-prioritize revset expression and changing the priorization logic to
for prio in prio_revset {if log_revset.contains(prio){
graph.prioritize_branch(prio)}}
graph.prioritize_branch(@)
When rendering the commit graph in
jj log
, jj will prioritize rendering the working copy first, and then the remaining branches. This is a good starting point for a heuristic, but it's doesn't always result in the most readable graph.Example 1:
jj prev/next
When traversing a branch with these commands, prioritizing just
@
will display the otherwise linear list of commits out of order, instead of5 4 3 @ 2 1
it will be@ 5 4 3 2 1
vs
jj log --config 'revsets.graph-prioritize=main'
:Example 2: Megamerge
Another situation where I noticed the graph being clearer with nonstandard priorization is when you have a "megamerge" commit of some local branches, and temporarily go work on another branch that's not
Solution
I've experimented with adding a
graph-prioritize
revset expression and changing the priorization logic towhich is already usable with
The one thing I don't like about this solution is that it exposes an ordering of revsets, which I don't think is meant to be relied on.
The text was updated successfully, but these errors were encountered: