jj-vcs/jj

FR: Add `sparse()` function to fileset DSL

Open

#7816 aperta il 22 ott 2025

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Rust (1052 fork)batch import
good first issuepolish🪒🐃

Metriche repository

Star
 (28.830 star)
Metriche merge PR
 (Merge medio 23g 5h) (46 PR mergiate in 30 g)

Descrizione

Consider a jj repo with the following jj log -p output:

@  wutluqlk (no email set) 2025-10-22 20:26:42 f70513d9
│  (empty) (no description set)
○  lwurnozr (no email set) 2025-10-22 20:26:42 git_head() 5cb58091
│  Added bar.txt
│  Added regular file bar.txt:
│      (empty)
○  lxnszsvq (no email set) 2025-10-22 20:26:42 50288a6f
│  Added foo.txt
│  Added regular file foo.txt:
│      (empty)
◆  zzzzzzzz root() 00000000

Now I am just interested in the foo.txt file for the moment, so I limit the checked out files using jj sparse set --clear --add foo.txt. While this works as intended the jj log output still mentions the revision lwurnozr shown above, which is solely about files (well, in this example it's just bar.txt) I am currently not interested in.

For use cases like this I'd like to have a fileset function sparse(), which evaluates to a file set contained in the current sparse checkout. With such a function at hand I could use jj log -p -r 'files(sparse()) | empty()' to obtain a (potentially much) shorter output that contains indeed only the relevant changes:

@  wutluqlk (no email set) 2025-10-22 20:26:42 f70513d9
│  (empty) (no description set)
~  (elided revisions)
○  lxnszsvq (no email set) 2025-10-22 20:26:42 50288a6f
│  Added foo.txt
│  Added regular file foo.txt:
│      (empty)
◆  zzzzzzzz root() 00000000

Guida contributor