-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define
builtin_immutable_heads()
as a default revset alias.
* Add `builtin_immutable_heads()` in the `revsets.toml`. * Redefine `immutable_heads()` in terms of `builtin_immutable_heads()` * Warn if user redefines `builtin_immutable_heads()`, `mutable()` or `immutable()`. * Update module constant in revset_util.rs from BUILTIN_IMMUTABLE_HEADS to USER_IMMUTABLE_HEADS to avoid confusion since it points at `immutable_heads()` **and** we now have a revset-alias literally named `builtin_immutable_heads()`. * Add unittest * Update CHANGELOG * Update documentation. Fixes: #4162
- Loading branch information
Showing
5 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,3 +136,24 @@ fn test_builtin_alias_trunk_no_match_only_exact() { | |
insta::assert_snapshot!(stderr, @r###" | ||
"###); | ||
} | ||
|
||
#[test] | ||
fn test_builtin_user_redefines_builtin_immutable_heads() { | ||
let (test_env, workspace_root) = set_up("main"); | ||
|
||
test_env.add_config(r#"revset-aliases.'builtin_immutable_heads()' = '@'"#); | ||
test_env.add_config(r#"revset-aliases.'mutable()' = '@'"#); | ||
test_env.add_config(r#"revset-aliases.'immutable()' = '@'"#); | ||
|
||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "trunk()"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
○ xtvrqkyv [email protected] 2001-02-03 08:05:08 main d13ecdbd | ||
│ (empty) description 1 | ||
~ | ||
"###); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Warning: Redefining `revset-aliases.builtin_immutable_heads()` is not recommended; redefine `immutable_heads()` instead | ||
Warning: Redefining `revset-aliases.immutable()` is not recommended; redefine `immutable_heads()` instead | ||
Warning: Redefining `revset-aliases.mutable()` is not recommended; redefine `immutable_heads()` instead | ||
"###); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters