Repository navigation
Replies: 3 comments
|
IMO this may be slightly better as an actual FR issue? Also see #9215 for general line range argument to |
|
Noted for the FR issue, I'll open one. About the line range syntax: I kept Mercurial's for no particular reason.
The So As for #9215, I have a PR for it too, but it reuses the line range parser |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'd like to propose a new revset function to find the commits that touched a given block of lines of a file, and get feedback before opening a PR.
fileis a path,linesis a line number or a range like"10:20", 1-based and inclusive, in the content offileatstart.startdefaults to@. The result is the ancestors ofstartthat changed, added or removed lines in the block, plus the commit that created it. The block is followed as it moves through history: when a commit modifies a hunk that overlaps the block, the block is extended to the whole hunk on the parent side, so no line is ever lost.descend=truewalks the descendants ofstartinstead, up to the visible heads.The semantics are the same as Mercurial's
followlines()revset (https://repo.mercurial-scm.org/hg/help/revsets), which I use a lot.Typical use:
jj log -r 'followlines("src/foo.rs", "120:135")'.I have a working implementation on top of
main, in four commits: main...aleufroy:jj:followlines(revset function, error messages for missing paths, rename support,
descend). The history is walked lazily, sojj log -n 1stops at the first commit that touched the block. It uses thefiles()predicate to skip commits that don't touch the file, so it benefits from the changed-path index.Known limitations of the current design:
fileis a single literal path, not a fileset.descend=truecompares a merge only with its parents that descend fromstart.jj log -pto the block (hg log -L) is not covered.Would this be of interest to you? Any opinion on the name, the
"from:to"string argument, or the design?All reactions