From 8fec7500c32a505a28d573cb180c26e84ef98acf Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 23 Jul 2024 19:16:22 +0900 Subject: [PATCH] cli: enable fileset by default I've tested it for months and found no problems. --- CHANGELOG.md | 3 +++ cli/src/config/misc.toml | 3 ++- cli/tests/test_diff_command.rs | 10 +--------- cli/tests/test_global_opts.rs | 14 ++++++++++---- cli/tests/test_log_command.rs | 12 ++++++++---- docs/filesets.md | 7 ------- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e44457e358..20aa15dc0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/cli/src/config/misc.toml b/cli/src/config/misc.toml index dc279216ac..5aeda8c3d8 100644 --- a/cli/src/config/misc.toml +++ b/cli/src/config/misc.toml @@ -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" diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index 304374d216..b9f89c4e4e 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -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 diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 6c108d1a3d..00502df279 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -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###" @@ -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 diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index 15b1061152..d3472fb0a8 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -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###" diff --git a/docs/filesets.md b/docs/filesets.md index 6a1c7bf67e..ec46a7c838 100644 --- a/docs/filesets.md +++ b/docs/filesets.md @@ -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