forked from mirrors/jj
30984dae4a
If this doesn't work out, maybe we can try one of these: a. fall back to bare file name if expression doesn't contain any operator-like characters (e.g. "f(x" is an error, but "f x" can be parsed as bare string) b. introduce command-line flag to opt in (e.g. -e FILESET) c. introduce pattern prefix to opt in (e.g. set:FILESET) Closes #3239, #2915, #2286
58 lines
1.5 KiB
Markdown
58 lines
1.5 KiB
Markdown
# Filesets
|
|
|
|
Jujutsu supports a functional language for selecting a set of files.
|
|
Expressions in this language are called "filesets" (the idea comes from
|
|
[Mercurial](https://repo.mercurial-scm.org/hg/help/filesets)). The language
|
|
consists of file patterns, operators, and functions.
|
|
|
|
**Filesets support is still experimental.** It can be enabled by
|
|
`ui.allow-filesets`.
|
|
|
|
```toml
|
|
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.
|
|
|
|
## Examples
|
|
|
|
Show diff excluding `Cargo.lock`.
|
|
|
|
```
|
|
jj diff '~Cargo.lock'
|
|
```
|
|
|
|
Split a revision in two, putting `foo` into the second commit.
|
|
|
|
```
|
|
jj split '~foo'
|
|
```
|