From 5296843dd27297bee3cbcf123426a9de17b33dfb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 13:12:37 -0300 Subject: changes layer: `Compare [ ...]`, the user's three-way view compressed: between each two consecutive points of the history ONE change, the file's whole difference between them however many commits lie between (the user, 2026-11-23, of `Changes (9ef..ea6) | (ea6..master@origin)`'s six lanes on cpi.rs: "they should be compressed so its only two changes"), each a pin of the layer as a commit is, so every part of the layer and what round 8 does to pins serves it with no second implementation: TESTS FIRST (core/jj.zig, a throwaway jj repository, the pane's surface, terminal and window): three points on one line of history (`Compare @----- @--- @-` over five commits) are two pins, each pair's row `from..to 2 changes day` after its last line, who wrote each line (b2 the first pair, d2 and e the second), the rows as the view shows them with the lines each took away where they stood and no number on the layer's, each pair's lane its own colour, `]g`, bare `Compare` hiding and showing the set without asking jj, `Changes` after it replacing it and it `Changes`'; two points neither the other's ancestor (two branches: `1 change, 1 undone`, each changed line's old text above it, the patch's `+` and `-` lines); a revision's pane at the middle point (`At @---`: the first pair behind, as at the last; the second drawn as round 7 draws a change ahead, as behind it: the test's want is marked for round 8's merge); one point, bare with nothing pinned, a point naming two commits (jj's words, `more than one revision`) and an unknown one refused, nothing pinned; a B3 on a pair's row's first word opening its patch (`Compare from..to`, the changes between newest first each signed, the hunks, the cursor on the pair's last line, typed the same); a client replaying it equal and its pairs crossing a join whole (`loadsAsSession`); on a worker, the word returning at once and the answer landing as one input; each failing on the base (no word `Compare`); THE CHANGE: the struct `Ask` (its `Kind` gains `compare`, and `word`, each kind's name in its notices: a rename is that line and the builtin's) and two functions, `answer` (one line: a Compare's runs are `pairsAnswer`'s) and `parse` (one line: who wrote each line from the pairs' hunks, `pairOwners`, where a Changes reads jj's annotation); `pairsAnswer`/`pairRuns` answer in the shape a `Changes` gets: the clock, for each pair an entry line as `logTemplate` writes one (its id the first point's change, its title the pair's row from one `jj log` a pair: `f`/`t` the points, `+` a change in the second not the first, `-` the other way, the author's day) then `jj diff --from --to --git --context=0 -- FILE` (an empty difference: an entry not pinned), then from the last point to the revision shown an entry not pinned whose hunks carry the places (`carried`, unchanged), and jj's text of the revision shown (`jj file show`, lined up with the pane's as the annotation's text is); `pairOwners` walks that text back through the steps' hunks, the newest step a line's (a carrier's nobody's), and `provenance`'s last lines are `linedUp`, shared; `describe` gives a pair its row (`isPair`: a title starting with its id and `..`), `lookGhost` passes a pair row's first word whole (`Diff from..to path:line`), `diffPair` (hunks.zig's `Diff` before `diffChange`) is that patch: `jj diff --from --to --git [-- path]` under `Compare from..to` and the changes between (no plumbing rule for `x..y`: a `matches` rule compiles its regexp at every plumb, and an open plumbs: it cost every open about 9,100 instructions in the perf gate, so a Look on `from..to` in running text searches), `standAt` is `diffChange`'s cursor placing, shared; `changesWord`'s body is `pinWord(kind)` for both words (bare as bare Changes; fewer than two points refused in words), `ask`/`receive`/`pinAnswer` name the kind's word; config.zig `Compare` has no leader path (it needs its points); builtins.zig, both builtins lists; NOT TOUCHED: `File.fillBody`, the ghosts' geometry, `ghostsOf`, `carried`, `nest`, `hunksOf`, the paint; nothing new in any replicated struct (a pair is a `Pin`, its row in `ghost_text`, its points in `Changes.revset`, all made by `parse` in every process from the one input): wire 31; THE GATE (ws-svc, loads 2-8): tui core-test 943/1109 (166 skipped) and shell-test 1151/1154 (3 skipped) in Debug and in ReleaseSafe (the base, my first run: 936/1102 and 1144/1147; ReleaseSafe run under bin/sig: from a background chain without it the four host_io Ctrl-C tests fail, as the rules say), behaviour-test and --replay 276/276 (20 seeds, 0 failures), test/daemon.py plain and --clients on the Debug install, the user's case run (agave's cpi.rs, `Compare 9ef6312813 ea63317630 master@origin`: two lanes, rows `ozlwptts..pyquzokk 4 changes, 1 undone 2026-09-25..2026-11-03` and `pyquzokk..rmrksrzs 2 changes 2026-11-05..2026-11-09`, jj's answer on the worker in 1.5 s, agave's operation log untouched); the frame and perf gate against tree6 (gpu/cmp1-g2): 77/77 frames, gui unit-test 1748/1752 (no failure the base has not), perfab corpus2x +0.022% (noise 0.044%), perfops 33 of 121 over against tree6, exactly the base line's own 33 (the coordinator's gpu/merge63-g: body-appends +12.026%/+8.068%), and against that gate's candidate all 121 within 0.1% (largest client-key-down small +0.037%) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/typ/builtins-gui.json | 1 + docs/typ/builtins-tui.json | 1 + 2 files changed, 2 insertions(+) (limited to 'docs/typ') diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index aeaf6953..82d5e279 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -19,6 +19,7 @@ {"name": "ClipYankMain", "leader": "SPC Y", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "helix `Y`: the PRIMARY selection alone, where `SPC y` joins every cursor's."}, {"name": "CodeAction", "leader": "SPC l a", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the language server's code actions for the cursor."}, {"name": "Collapse", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Fold a pane to its tag, or restore its share of the column."}, + {"name": "Compare", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin on a file's pane the file's whole difference between each two of `points` (jj revisions, a blank between, two or more) as one change, however many changes lie between them, and show them in this view as `Changes` shows a change: a lane each, the lines it wrote and took away, its row `from..to N changes dates` after its last line; bare, as bare `Changes`."}, {"name": "Config", "leader": "SPC f c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the startup file, `init`, in a pane: its pane when it is open, else the file, else a pane of that name for Save to make it and its directory."}, {"name": "CursorBlink", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "The cursor blinks, solid while typing, on or off."}, {"name": "Debug", "leader": "SPC t d", "also": ["topbar"], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A small box of frame statistics at the top right, on or off."}, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index 2263df44..5b171469 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -19,6 +19,7 @@ {"name": "ClipYankMain", "leader": "SPC Y", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "helix `Y`: the PRIMARY selection alone, where `SPC y` joins every cursor's."}, {"name": "CodeAction", "leader": "SPC l a", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the language server's code actions for the cursor."}, {"name": "Collapse", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Fold a pane to its tag, or restore its share of the column."}, + {"name": "Compare", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Pin on a file's pane the file's whole difference between each two of `points` (jj revisions, a blank between, two or more) as one change, however many changes lie between them, and show them in this view as `Changes` shows a change: a lane each, the lines it wrote and took away, its row `from..to N changes dates` after its last line; bare, as bare `Changes`."}, {"name": "Config", "leader": "SPC f c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the startup file, `init`, in a pane: its pane when it is open, else the file, else a pane of that name for Save to make it and its directory."}, {"name": "Debug", "leader": "SPC t d", "also": ["topbar"], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A small box of frame statistics at the top right, on or off."}, {"name": "Def", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Go to the definition of the symbol under the cursor; with an argument (a 2-1 chord's selection), of that symbol, where it is nearest."}, -- cgit v1.3 From f34d3a74cc4a6b735c98ce98cef0df42bd065e67 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 13:48:06 -0300 Subject: docs: `Compare` in the guide's chapter "Changes on the source view" and the cheatsheet: the word's row in the chapter's table (two points or more, each one revision, the pairs in their order, bare as bare `Changes`, one set a pane), `Diff from..to path:line`'s row (the pair's patch, the changes between on top, `+` brought in, `-` undone; a Look on a pair's row's first word), and a paragraph *Points.*: the user's three-way case (`Compare 9ef6312813 ea63317630 master@origin`: two changes where `Changes` draws a lane a commit), a pair's row as the user's case reads it (`ozlwptts..pyquzokk 4 changes, 1 undone 2026-09-25..2026-11-03`), what `undone` is, that the points need not be ancestors (ancestry only names the changes between), a pair with no difference not drawn, where the pairs stand against the text shown (behind when the last point's text is shown; the step to the shown revision carries their places) and what a middle point draws on this base (the second pair as a change ahead is drawn today, as if behind); the cheatsheet's row under "Reviewing diffs"; docs check in core-test: every `#word` named exists; `.scratch/sketch/TRY.md`'s usage notes (outside the tree) rewrite the three-way case with the word; core-test's docs check passes (943/1109 Debug and ReleaseSafe), the gui unit-test's too (1748/1752) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/typ/cheatsheet.typ | 2 +- docs/typ/guide.typ | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'docs/typ') diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ index a590e402..9f51d309 100644 --- a/docs/typ/cheatsheet.typ +++ b/docs/typ/cheatsheet.typ @@ -119,7 +119,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla == Reviewing diffs `git diff` output is a diff: #btn("B3") on a file line, an `@@` or a line's `+`/`-` jumps there. #doc("tags", section: "reviewing-diffs") -#word("Changes") `revset` on a file's pane: a lane a change (one change: green beside what it wrote, red beside what it took away), an arrow to its description, ghost rows for what it took away, #keys("] g", "[ g") from change to change; #btn("B3") on a change id: its patch, header first; #word("Churn") `3m`: each declaration's changes, grey to red; `a.zig@main:12` is a file at a revision. #doc("guide", section: "changes") +#word("Changes") `revset` on a file's pane: a lane a change (one change: green beside what it wrote, red beside what it took away), an arrow to its description, ghost rows for what it took away, #keys("] g", "[ g") from change to change; #btn("B3") on a change id: its patch, header first; #word("Compare") `a b c`: one lane a pair of points, the whole difference between them (a three-way view); #word("Churn") `3m`: each declaration's changes, grey to red; `a.zig@main:12` is a file at a revision. #doc("guide", section: "changes") == Finding things - A query pane under the pane: line 1 the query, its first word the source: `/pat`, `Find name` (fuzzy), `Grep text` (literal), `Recent`, `Panes`, `Symbols`, `All`. #keys("Ctrl-n", "Ctrl-p") step, #key("Enter") lands and keeps the rows, #key("Esc") puts things back. #word("Help"), #word("Tutor"). diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 985d324d..c7cd5d8b 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -304,10 +304,12 @@ Nothing is shown, and nothing asked of jj, until a word is run. #pairs( [#word("Changes") `revset` (#key("SPC t c"))], [pins the revset's changes that touched the file on its pane (or a revision's) and shows them in this view; one set a pane (another view's revset replaces it there too). Bare: hidden in this view or shown again; with none pinned yet, `@`, the change against its parent], + [#word("Compare") `rev rev [rev …]`], [between each two of the points, in their order, the file's whole difference pinned as one change, however many changes lie between them, drawn as a change is; each point one revision (a commit or change id, a bookmark, `master@origin`, `@`). Bare: as bare #word("Changes"); one set a pane, the last word's], [#word("Churn") `window` (#key("SPC t u"))], [counts, for each declaration, the window's changes that touched it, and shows them in this view; the window a revset, or a span of time back from now (`3d`, `2w`, `6m`, `1y`). Bare: hidden or shown again; with none counted yet, the file's whole history], [#keys("] g", "[ g")], [the next and the previous change's first line], [`path@rev`, `path@rev:line`], [the file at a revision (#doc("guide", section: "revision")): a #word("Look") anywhere opens it], [#word("Diff") `change` `path:line`], [a jj change's patch, its header (ids, author, dates, the whole message) above its hunks, in its own `+Diff`, the cursor on `path`'s line in it; a #word("Look") on a change id (eight of its letters, `k` to `z`, as `jj log` shows them) anywhere opens it at its top], + [#word("Diff") `from..to` `path:line`], [a pair's patch: the difference of `path` between the two points (bare, the whole tree's), the changes between them on top, a line each, `+` one in `to` and not in `from`, `-` the other way (what the difference takes back); a #word("Look") on a pair's row's first word opens it], ) *Lanes.* Each pinned change gets a lane after the line number, from its @@ -337,6 +339,27 @@ the pane ends (never wrapped); in a narrow pane a description's title is cut, its author and age kept. A hunk that took away more than 1,024 lines shows none of them. +*Points.* #word("Compare") `9ef6312813 ea63317630 master@origin` draws +two changes on the file, each the whole difference between two points: +what changed from the first to the second, and from the second to the +third (a three-way view), where #word("Changes") draws a lane for every +commit between them. A pair's row, after its last line as a change's +description is, reads +`ozlwptts..pyquzokk 4 changes, 1 undone 2026-09-25..2026-11-03`: +its two points (change ids), how many changes +between them touched the file (`undone`: those in the first point and not +in the second, which the difference takes back, as between two branches), +and the first and last of their days. The points need not be ancestors of +one another: what is drawn is two trees' difference, and ancestry only +names the changes between. A pair that changes nothing in the file is not +drawn. The pairs stand behind the text when the last point's text is the +one shown (`@` with the file as it was there, or the last point's +revision); the step from the last point to the revision shown carries +their places, as a change between pinned ones does. With the pane at a +middle point (#word("At") the second of three) the first pair is drawn +right, the second as a change ahead of the text is drawn today, as if +behind it. + *Churn.* A cell after the line number, from the line numbers' grey to the theme's red on a log scale of the count against the file's hottest declaration, the declaration a line is in being the innermost -- cgit v1.3