Skip to content

log: properly render elided roots in reversed mode#9153

Open
CGamesPlay wants to merge 2 commits intojj-vcs:mainfrom
CGamesPlay:push-krvorkntvpvx
Open

log: properly render elided roots in reversed mode#9153
CGamesPlay wants to merge 2 commits intojj-vcs:mainfrom
CGamesPlay:push-krvorkntvpvx

Conversation

@CGamesPlay
Copy link

@CGamesPlay CGamesPlay commented Mar 21, 2026

This is my first contribution to jj. I experimented with several approaches to this problem and this one is the best approach I could come up with.

This properly addresses #9149, which was incorrectly marked as a duplicate of #1092. Although the two issues are related, this does NOT resolve the latter but does fix the correctness issue shown in the former.

Related issues:

Notable changes:

  • the vertical line now always goes to the end of a multi-line node before showing the ~
  • the extra blank lines that were forced around ~ lines disappear, but disconnected components ALWAYS get a blank line separating them
  • merges where multiple parents are elided now show multiple ~ nodes (the number of parents is preserved)
  • the final root ~ now respects ui.log-synthetic-elided-nodes, and is rendered using the log_node template

To address potential concerns:

  • Why are evolog and op log not affected? These logs never produce disconnected components. It might be nice to use these synthetic elided nodes so that users can customize the log_node template, but not critical to correctness.
  • Why not remove the concept of a "missing edge" entirely? That's a hugely invasive change, and doesn't seem worthwhile.
  • Why not add proper support for reversed graphs to sapling's renderdag? This is the only approach I can see that will actually resolve the differences shown in FR: improve the rendering of jj log --reversed with sapling #1092, but it's complicated. We walk commits from leafs to root because that's how the database is set up, and this assumption is baked into renderdag, so it can perform online rendering of the graph in O(N) space.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    an eye towards deleting anything that is irrelevant, clarifying anything
    that is confusing, and adding details that are relevant. This includes,
    for example, commit descriptions, PR descriptions, and code comments.

@CGamesPlay CGamesPlay requested a review from a team as a code owner March 21, 2026 03:30
@CGamesPlay CGamesPlay force-pushed the push-krvorkntvpvx branch 4 times, most recently from 5f158a9 to 82eb888 Compare March 21, 2026 04:04
@CGamesPlay
Copy link
Author

(differences between stable and nightly rustfmt are driving me crazy)

notable changes:
- the vertical line now always goes to the end of a multi-line node
  before showing the ~
- the extra blank lines that were forced around ~ lines disappear, but
  disconnected components ALWAYS get a blank line separating them
- merges where multiple parents are elided now show multiple ~ nodes
  (the number of parents is preserved)

Related issues:
- Properly resolves jj-vcs#9149
- Resolves jj-vcs#5937 by no longer using
  Ancestor::Anonymous nodes
- Related but unfixed jj-vcs#1092 because
  this is a limitation of sapling renderdag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: make excluded commits more compact in jj log jj log --reversed shows misleading commit history

1 participant