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

jj log: Replace divergent label with ?? and red color

This follows up on a [discussion] in a previous PR #941.

[discussion]: https://github.com/martinvonz/jj/pull/941#issuecomment-1363551162

Screenshot: https://user-images.githubusercontent.com/4123047/209286340-bb83df2d-4020-4608-9755-d965477799c3.png
This commit is contained in:
Ilya Grigoriev 2023-01-06 17:49:31 -08:00
parent 5f2a99ac8a
commit 8093bc0614
4 changed files with 13 additions and 6 deletions

View file

@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* The `-i` option to `jj restore` was removed in favor of new `--from`/`--to`
options to `jj diffedit`.
* To report the situation when a change id corresponds to multiple visible
commits, `jj log` now prints the change id in red and puts `??` after it.
Previously, it printed the word "divergent".
### New features
* The default log format now uses the committer timestamp instead of the author

View file

@ -1558,8 +1558,9 @@ fn log_template(settings: &UserSettings) -> String {
};
let default_template = format!(
r#"
change_id.short()
if(divergent, label("divergent", " divergent"))
if(divergent,
label("divergent", change_id.short() "??"),
change_id.short())
" " author.email()
" " {committer_timestamp}
if(branches, " " branches)

View file

@ -17,6 +17,7 @@
"git_refs" = "magenta"
"git_head" = "magenta"
"divergent" = "red"
"divergent change_id"="red"
"conflict" = "red"
# TODO: This near-duplication of the lines above is unfortunate. Should we
@ -34,6 +35,7 @@
"working_copy tags" = "bright magenta"
"working_copy git_refs" = "bright magenta"
"working_copy divergent" = "bright red"
"working_copy divergent change_id"="bright red"
"working_copy conflict" = "bright red"
"working_copy description" = "bright white"
"diff header" = "yellow"

View file

@ -109,9 +109,9 @@ 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 9a45c67d3e96 divergent test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
o 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
| description 2
| @ 9a45c67d3e96 divergent test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 000000000000 1970-01-01 00:00:00.000 +00:00 000000000000
(no description set)
@ -120,9 +120,9 @@ fn test_log_default_divergence() {
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
o 9a45c67d3e96 divergent test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
o 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:10.000 +07:00 8979953d4c67
| description 2
| @ 9a45c67d3e96 divergent test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
| @ 9a45c67d3e96?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e633c
|/ description 1
o 000000000000  1970-01-01 00:00:00.000 +00:00 000000000000
(no description set)