Skip to content

Commit

Permalink
cli: enable fileset by default
Browse files Browse the repository at this point in the history
I've tested it for months and found no problems.
  • Loading branch information
yuja committed Jul 23, 2024
1 parent da221eb commit e1a25a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Updated defaults for graph node symbol templates `templates.log_node` and
`templates.op_log_node`.

* [The "fileset" language](docs/filesets.md) is now enabled by default. It can
still be disable by setting `ui.allow-filesets=false`.

### Deprecations

### New features
Expand Down
3 changes: 2 additions & 1 deletion cli/src/config/misc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ unamend = ["unsquash"]
tree-level-conflicts = true

[ui]
allow-filesets = false
# TODO: delete ui.allow-filesets in jj 0.26+
allow-filesets = true
always-allow-large-revsets = false
diff-instructions = true
paginate = "auto"
Expand Down
10 changes: 1 addition & 9 deletions cli/tests/test_diff_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,7 @@ fn test_diff_basic() {
"###);

// Filter by glob pattern
let stdout = test_env.jj_cmd_success(
&repo_path,
&[
"diff",
"--config-toml=ui.allow-filesets=true",
"-s",
"glob:file[12]",
],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "glob:file[12]"]);
insta::assert_snapshot!(stdout, @r###"
D file1
M file2
Expand Down
14 changes: 10 additions & 4 deletions cli/tests/test_global_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ fn test_bad_path() {
let subdir = repo_path.join("dir");
std::fs::create_dir_all(&subdir).unwrap();

test_env.add_config("ui.allow-filesets = true");

// cwd == workspace_root
let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "show", "../out"]);
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
Expand Down Expand Up @@ -450,8 +448,16 @@ fn test_color_ui_messages() {
// error source
let stderr = test_env.jj_cmd_failure(&repo_path, &["log", ".."]);
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
Error: Path ".." is not in the repo "."
Caused by: Invalid component ".." in repo-relative path "../"
Error: Failed to parse fileset: Invalid file pattern
Caused by:
1:  --> 1:1
 |
1 | ..
 | ^^
 |
 = Invalid file pattern
2: Path ".." is not in the repo "."
3: Invalid component ".." in repo-relative path "../"
"###);

// warning
Expand Down
12 changes: 8 additions & 4 deletions cli/tests/test_log_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,18 +825,22 @@ fn test_log_filtered_by_path() {
A file2
"###);

// Fileset/pattern syntax is disabled by default.
// Fileset/pattern syntax can be disabled.
let stderr = test_env.jj_cmd_failure(
test_env.env_root(),
&["log", "-R", repo_path.to_str().unwrap(), "all()"],
&[
"log",
"--config-toml=ui.allow-filesets=false",
"-R",
repo_path.to_str().unwrap(),
"all()",
],
);
insta::assert_snapshot!(stderr.replace('\\', "/"), @r###"
Error: Path "all()" is not in the repo "repo"
Caused by: Invalid component ".." in repo-relative path "../all()"
"###);

test_env.add_config("ui.allow-filesets = true");

// empty revisions are filtered out by "all()" fileset.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tdescription", "-s", "all()"]);
insta::assert_snapshot!(stdout, @r###"
Expand Down
7 changes: 0 additions & 7 deletions docs/filesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ 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
```

Many `jj` commands accept fileset expressions as positional arguments. File
names passed to these commands [must be quoted][string-literals] if they contain
whitespace or meta characters. However, as a special case, quotes can be omitted
Expand Down

0 comments on commit e1a25a4

Please sign in to comment.