ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/docs/filesets.md
Yuya Nishihara a9694cba27 cli: add ui.allow-filesets to experiment with fileset/pattern syntax
The pattern syntax could be enabled unconditionally, but I want to fully
replace the ad-hoc pattern parsing function.
2024-04-12 11:36:40 +09:00

1.3 KiB

Filesets

Jujutsu supports a functional language for selecting a set of files. Expressions in this language are called "filesets" (the idea comes from Mercurial). The language consists of file patterns, operators, and functions.

Filesets support is still experimental. It can be enabled by ui.allow-filesets.

ui.allow-filesets = true

File patterns

The following patterns are supported:

  • "path", path (the quotes are optional), or cwd:"path": Matches cwd-relative path prefix (file or files under directory recursively.)
  • cwd-file:"path" or file:"path": Matches cwd-relative file (or exact) path.
  • root:"path": Matches workspace-relative path prefix (file or files under directory recursively.)
  • root-file:"path": Matches workspace-relative file (or exact) path.

Operators

The following operators are supported. x and y below can be any fileset expressions.

  • x & y: Matches both x and y.
  • x | y: Matches either x or y (or both).
  • x ~ y: Matches x but not y.
  • ~x: Matches everything but x.

You can use parentheses to control evaluation order, such as (x & y) | z or x & (y | z).

Functions

You can also specify patterns by using functions.

  • all(): Matches everything.
  • none(): Matches nothing.