-
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.
cli: change default log revset to not include all tagged heads
The default immutable_heads() includes tags(), which makes sense, but computing heads(tags()) can be expensive because the tags() set is usually sparse. For example, "jj bench revset 'heads(tags())'" took 157ms in my linux stable mirror. We can of course optimize the heads evaluation by using bit set or segmented index, but the query includes many historical heads if the repository has per-release branches, which are uninteresting anyway. So, this patch replaces heads(immutable_heads()) with trunk(). The reason we include heads(immutable_heads()) is to mitigate the following problem. Suppose trunk() is the branch to be based off, I think using trunk() here is pretty good. ``` A B *---*----* trunk() ⊆ immutable_heads() \ * C ``` #2247 (comment)
- Loading branch information
Showing
6 changed files
with
11 additions
and
9 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
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 |
---|---|---|
|
@@ -64,7 +64,7 @@ fn test_rewrite_immutable_generic() { | |
insta::assert_snapshot!(stderr, @r###" | ||
Config error: Invalid `revsets.short-prefixes`: --> 1:31 | ||
| | ||
1 | @ | ancestors(immutable_heads().., 2) | heads(immutable_heads()) | ||
1 | @ | ancestors(immutable_heads().., 2) | trunk() | ||
| ^ | ||
| | ||
= Invalid arguments to revset function "immutable_heads": Expected 1 arguments | ||
|
@@ -93,8 +93,9 @@ fn test_rewrite_immutable_commands() { | |
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "main"]); | ||
test_env.jj_cmd_ok(&repo_path, &["new", "description(b)"]); | ||
test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#); | ||
test_env.add_config(r#"revset-aliases."trunk()" = "main""#); | ||
|
||
// Log shows mutable commits and immutable heads by default | ||
// Log shows mutable commits, their parents, and trunk() by default | ||
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
@ yqosqzyt [email protected] 2001-02-03 04:05:13.000 +07:00 3f89addf | ||
|
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