-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #4190.
- Loading branch information
Showing
4 changed files
with
100 additions
and
8 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 |
---|---|---|
|
@@ -192,6 +192,72 @@ fn test_op_log_no_graph() { | |
"#); | ||
} | ||
|
||
#[test] | ||
fn test_op_log_reversed() { | ||
let test_env = TestEnvironment::default(); | ||
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); | ||
let repo_path = test_env.env_root().join("repo"); | ||
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]); | ||
|
||
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed"]); | ||
insta::assert_snapshot!(&stdout, @r#" | ||
○ 000000000000 root() | ||
○ eac759b9ab75 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
│ add workspace 'default' | ||
@ d009cfc04993 [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
args: jj describe -m 'description 0' | ||
"#); | ||
|
||
test_env.jj_cmd_ok( | ||
&repo_path, | ||
&["describe", "-m", "description 1", "--at-op", "@-"], | ||
); | ||
|
||
// Should be able to display log with fork and branch points | ||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "log", "--reversed"]); | ||
insta::assert_snapshot!(&stderr, @"Concurrent modification detected, resolving automatically."); | ||
insta::assert_snapshot!(&stdout, @r#" | ||
○ 000000000000 root() | ||
○ eac759b9ab75 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
├─╮ add workspace 'default' | ||
│ ○ 8e3e726be123 [email protected] 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 | ||
│ │ describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
│ │ args: jj describe -m 'description 1' --at-op @- | ||
○ │ d009cfc04993 [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
├─╯ describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
│ args: jj describe -m 'description 0' | ||
@ e4538ffdc13d [email protected] 2001-02-03 04:05:11.000 +07:00 - 2001-02-03 04:05:11.000 +07:00 | ||
reconcile divergent operations | ||
args: jj op log --reversed | ||
"#); | ||
|
||
// Should work correctly with `--no-graph` | ||
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--no-graph"]); | ||
insta::assert_snapshot!(&stdout, @r#" | ||
000000000000 root() | ||
eac759b9ab75 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
add workspace 'default' | ||
8e3e726be123 [email protected] 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 | ||
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
args: jj describe -m 'description 1' --at-op @- | ||
d009cfc04993 [email protected] 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 | ||
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 | ||
args: jj describe -m 'description 0' | ||
e4538ffdc13d [email protected] 2001-02-03 04:05:11.000 +07:00 - 2001-02-03 04:05:11.000 +07:00 | ||
reconcile divergent operations | ||
args: jj op log --reversed | ||
"#); | ||
|
||
// Should work correctly with `--limit` | ||
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--limit=2"]); | ||
insta::assert_snapshot!(stdout, @r#" | ||
○ 000000000000 root() | ||
○ eac759b9ab75 [email protected] 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 | ||
├─╮ add workspace 'default' | ||
"#); | ||
} | ||
|
||
#[test] | ||
fn test_op_log_no_graph_null_terminated() { | ||
let test_env = TestEnvironment::default(); | ||
|