ok/jj
1
0
Fork 0
forked from mirrors/jj

jj log: Change the default of ui.unique-prefixes to "styled"

This commit is contained in:
Ilya Grigoriev 2023-01-21 22:30:10 -08:00
parent adeba7f2a5
commit 6e05c5a829
8 changed files with 56 additions and 55 deletions

View file

@ -76,8 +76,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
any parent-child relationships between them. For example, the entire tree of
descendants of `abc` can be duplicated with `jj duplicate abc:`.
* `jj log` now highlights the shortest unique prefix of every commit and change id
with brackets. To disable, set the new `ui.unique-prefixes` option to `none`
* `jj log` now highlights the shortest unique prefix of every commit and change
id and shows the rest in gray. To disable, set the new `ui.unique-prefixes`
option to `none`. For a presentation that doesn't rely on color, set it to
`brackets`.
* `jj print` was renamed to `jj cat`. `jj print` remains as an alias.

View file

@ -106,13 +106,12 @@ ui.graph.style = "curved"
```
### Shortest unique prefixes for ids
```toml
ui.unique-prefixes = "none"
ui.unique-prefixes = "brackets" # Does not rely on color
```
Whether to highlight a unique prefix for commit & change ids. Possible values
are `brackets` and `none` (default: `brackets`).
Whether to highlight a unique prefix for commit & change ids. Possible
values are `styled`, `brackets` and `none` (default: `styled`).
### Relative timestamps

View file

@ -167,7 +167,7 @@ impl UserSettings {
pub fn unique_prefixes(&self) -> String {
self.config
.get_string("ui.unique-prefixes")
.unwrap_or_else(|_| "brackets".to_string())
.unwrap_or_else(|_| "styled".to_string())
}
pub fn config(&self) -> &config::Config {

View file

@ -135,7 +135,7 @@ fn test_alias_cannot_override_builtin() {
// Alias should be ignored
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "root"]);
insta::assert_snapshot!(stdout, @r###"
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}

View file

@ -65,11 +65,11 @@ fn test_log_default() {
// Test default log output format
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r###"
@ f[fdaa62087] test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9d[e54178d5]
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| (empty) description 1
o 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 4[291e264ae]
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -123,22 +123,22 @@ fn test_log_default() {
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ f[fdaa62087] test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9d[e54178d5]
@ ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
| (empty) description 1
o 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 4[291e264ae]
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
| add a file
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
// Color without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(stdout, @r###"
f[fdaa62087] test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9d[e54178d5]
ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 my-branch 9de54178d59d
(empty) description 1
9a[45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 4[291e264ae]
9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 4291e264ae97
add a file
0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}
@ -154,9 +154,9 @@ fn test_log_default_divergence() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
// No divergence
insta::assert_snapshot!(stdout, @r###"
@ 9[a45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 7[a17d52e63]
@ 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
| description 1
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -168,22 +168,22 @@ fn test_log_default_divergence() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r###"
Concurrent modification detected, resolving automatically.
o 9[a45c67d3e]?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8[979953d4c]
o 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
| description 2
| @ 9[a45c67d3e]?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7[a17d52e63]
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
o 9[a45c67d3e]?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8[979953d4c]
o 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
| description 2
| @ 9[a45c67d3e]?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7[a17d52e63]
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}
@ -199,11 +199,11 @@ fn test_log_git_head() {
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ 8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 5[0aaf4754c]
@ 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 50aaf4754c1e
| initial
o 9[a45c67d3e] test.user@example.com 2001-02-03 04:05:07.000 +07:00 master HEAD@git 23[0dd059e1]
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:07.000 +07:00 master HEAD@git 230dd059e1b0
| (empty) (no description set)
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
}

View file

@ -107,7 +107,7 @@ fn test_init_git_external() {
// Check that the Git repo's HEAD got checked out
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
o d[3866db7e3] git.user@example.com 1970-01-01 01:02:03.000 +01:00 my-branch HEAD@git 8[d698d4a8e]
o d3866db7e30a git.user@example.com 1970-01-01 01:02:03.000 +01:00 my-branch HEAD@git 8d698d4a8ee1
~ My commit message
"###);
}
@ -150,7 +150,7 @@ fn test_init_git_colocated() {
// Check that the Git repo's HEAD got checked out
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
o d[3866db7e3] git.user@example.com 1970-01-01 01:02:03.000 +01:00 my-branch HEAD@git 8[d698d4a8e]
o d3866db7e30a git.user@example.com 1970-01-01 01:02:03.000 +01:00 my-branch HEAD@git 8d698d4a8ee1
~ My commit message
"###);
}

View file

@ -30,13 +30,13 @@ fn test_obslog_with_or_without_diff() {
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog"]);
insta::assert_snapshot!(stdout, @r###"
@ 8[e4fac809c] test.user@example.com 2001-02-03 04:05:10.000 +07:00 66[b42ad360]
@ 8e4fac809cbb test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad36073
| my description
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 af[536e5af6] conflict
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5af67e conflict
| my description
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 6f[bba7bcb5]
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bcb590
| my description
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:08.000 +07:00 e[ac0d0dae0]
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:08.000 +07:00 eac0d0dae082
(empty) my description
"###);
@ -44,43 +44,43 @@ fn test_obslog_with_or_without_diff() {
// (even even though it resulted in a conflict).
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p"]);
insta::assert_snapshot!(stdout, @r###"
@ 8[e4fac809c] test.user@example.com 2001-02-03 04:05:10.000 +07:00 66[b42ad360]
@ 8e4fac809cbb test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad36073
| my description
| Resolved conflict in file1:
| 1 1: <<<<<<<resolved
| 2 : %%%%%%%
| 3 : +bar
| 4 : >>>>>>>
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 af[536e5af6] conflict
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5af67e conflict
| my description
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 6f[bba7bcb5]
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bcb590
| my description
| Modified regular file file1:
| 1 1: foo
| 2: bar
| Added regular file file2:
| 1: foo
o 8[e4fac809c] test.user@example.com 2001-02-03 04:05:08.000 +07:00 e[ac0d0dae0]
o 8e4fac809cbb test.user@example.com 2001-02-03 04:05:08.000 +07:00 eac0d0dae082
(empty) my description
"###);
// Test `--no-graph`
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--no-graph"]);
insta::assert_snapshot!(stdout, @r###"
8[e4fac809c] test.user@example.com 2001-02-03 04:05:10.000 +07:00 66[b42ad360]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad36073
my description
8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 af[536e5af6] conflict
8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5af67e conflict
my description
8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 6f[bba7bcb5]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bcb590
my description
8[e4fac809c] test.user@example.com 2001-02-03 04:05:08.000 +07:00 e[ac0d0dae0]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:08.000 +07:00 eac0d0dae082
(empty) my description
"###);
// Test `--git` format, and that it implies `-p`
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--no-graph", "--git"]);
insta::assert_snapshot!(stdout, @r###"
8[e4fac809c] test.user@example.com 2001-02-03 04:05:10.000 +07:00 66[b42ad360]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad36073
my description
diff --git a/file1 b/file1
index e155302a24...2ab19ae607 100644
@ -92,9 +92,9 @@ fn test_obslog_with_or_without_diff() {
-+bar
->>>>>>>
+resolved
8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 af[536e5af6] conflict
8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5af67e conflict
my description
8[e4fac809c] test.user@example.com 2001-02-03 04:05:09.000 +07:00 6f[bba7bcb5]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bcb590
my description
diff --git a/file1 b/file1
index 257cc5642c...3bd1f0e297 100644
@ -110,7 +110,7 @@ fn test_obslog_with_or_without_diff() {
+++ b/file2
@@ -1,0 +1,1 @@
+foo
8[e4fac809c] test.user@example.com 2001-02-03 04:05:08.000 +07:00 e[ac0d0dae0]
8e4fac809cbb test.user@example.com 2001-02-03 04:05:08.000 +07:00 eac0d0dae082
(empty) my description
"###);
}
@ -132,25 +132,25 @@ fn test_obslog_squash() {
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "-p", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
o 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:10.000 +07:00 27[e721a5ba]
o 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:10.000 +07:00 27e721a5ba72
|\ squashed
| | Modified regular file file1:
| | 1 1: foo
| | 2: bar
o | 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:09.000 +07:00 97[64e503e1]
o | 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:09.000 +07:00 9764e503e1a9
| | first
| | Added regular file file1:
| | 1: foo
o | 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:08.000 +07:00 6[9542c1984]
o | 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:08.000 +07:00 69542c1984c1
| | (empty) first
o | 9a[45c67d3e] test.user@example.com 2001-02-03 04:05:07.000 +07:00 23[0dd059e1]
o | 9a45c67d3e96 test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059e1b0
/ (empty) (no description set)
o ff[daa62087] test.user@example.com 2001-02-03 04:05:10.000 +07:00 f[09a38899f]
o ffdaa62087a2 test.user@example.com 2001-02-03 04:05:10.000 +07:00 f09a38899f2b
| second
| Modified regular file file1:
| 1 1: foo
| 2: bar
o ff[daa62087] test.user@example.com 2001-02-03 04:05:09.000 +07:00 5[799653697]
o ffdaa62087a2 test.user@example.com 2001-02-03 04:05:09.000 +07:00 579965369703
(empty) second
"###);
}

View file

@ -161,13 +161,13 @@ fn test_alias() {
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "my-root"]);
insta::assert_snapshot!(stdout, @r###"
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "identity(my-root)"]);
insta::assert_snapshot!(stdout, @r###"
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
@ -263,7 +263,7 @@ fn test_bad_alias_decl() {
.assert()
.success();
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
o 0[000000000] 1970-01-01 00:00:00.000 +00:00 0[000000000]
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(empty) (no description set)
"###);
insta::assert_snapshot!(get_stderr_string(&assert), @r###"