martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
9.37k stars 323 forks source link

log: emit working-copy branch first if included in the revset #4902

Closed yuja closed 6 days ago

yuja commented 1 week ago

Checklist

If applicable:

tim-janik commented 1 week ago

Wow, live editing with jj-fzf works much better with this change applied when describing commits not on the working copy. The one thing left to wish for is stabilizing the order of siblings, but swapping sibling branches not related to the working copy is triggered less frequently than anything involving the working copy:

⮞ jj log
@  kwn
│ ○  kzw D
├─╯
│ ○  oll C
├─╯
○  xpx B
○  soq A
⮞ jj desc -m C2 -r 'description(exact:"C\n")' && jj log
@  kwn
│ ○  oll C2
├─╯
│ ○  kzw D
├─╯
○  xpx B
○  soq A
yuja commented 1 week ago
⮞ jj log
@  kwn
│ ○  kzw D
├─╯
│ ○  oll C
├─╯
○  xpx B
○  soq A
⮞ jj desc -m C2 -r 'description(exact:"C\n")' && jj log
@  kwn
│ ○  oll C2
├─╯
│ ○  kzw D
├─╯
○  xpx B
○  soq A

This wouldn't get stable order based on generation number either. We would need a weird tie-breaking rule such as heads are sorted by change ID, not by timestamp.

I think a UI will have to retain some state to avoid node reordering. For example, a set of head change ids can be queried first, then pass it to jj log --config-toml=prioritized_branches=[...] or something to enforce the order.