Skip to content

Commit df41bd5

Browse files
committed
rewrite: add labels for rebased commits
1 parent 69d3d58 commit df41bd5

14 files changed

+94
-88
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2525
* The `CryptographicSignature.key()` template method now also works for SSH
2626
signatures and returns the corresponding public key fingerprint.
2727

28-
* Conflicts resulting from merges now have labels indicating the change ID and
29-
commit ID for each side.
28+
* Conflicts resulting from merges and rebases now have labels indicating the
29+
change ID and commit ID for each side.
3030

3131
### Fixed bugs
3232

cli/tests/test_absorb_command.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,32 +421,32 @@ fn test_absorb_conflict() {
421421
work_dir.run_jj(["new", "root()"]).success();
422422
work_dir.write_file("file1", "2a\n2b\n");
423423
let output = work_dir.run_jj(["rebase", "-r@", "-ddescription(1)"]);
424-
insta::assert_snapshot!(output, @r###"
424+
insta::assert_snapshot!(output, @r"
425425
------- stderr -------
426426
Rebased 1 commits to destination
427-
Working copy (@) now at: kkmpptxz 66d44b8c (conflict) (no description set)
427+
Working copy (@) now at: kkmpptxz 7575ac57 (conflict) (no description set)
428428
Parent commit (@-) : qpvuntsm e35bcaff 1
429429
Added 0 files, modified 1 files, removed 0 files
430430
Warning: There are unresolved conflicts at these paths:
431431
file1 2-sided conflict
432432
New conflicts appeared in 1 commits:
433-
kkmpptxz 66d44b8c (conflict) (no description set)
433+
kkmpptxz 7575ac57 (conflict) (no description set)
434434
Hint: To resolve the conflicts, start by creating a commit on top of
435435
the conflicted commit:
436436
jj new kkmpptxz
437437
Then use `jj resolve`, or edit the conflict markers in the file directly.
438438
Once the conflicts are resolved, you can inspect the result with `jj diff`.
439439
Then run `jj squash` to move the resolution into the conflicted commit.
440440
[EOF]
441-
"###);
441+
");
442442

443443
let conflict_content = work_dir.read_file("file1");
444444
insta::assert_snapshot!(conflict_content, @r"
445445
<<<<<<< Conflict 1 of 1
446-
%%%%%%% Changes from base to side #1
446+
%%%%%%% Changes from base (zzzzzzzz 00000000) to side #1 (rebase destination: qpvuntsm e35bcaff)
447447
+1a
448448
+1b
449-
+++++++ Contents of side #2
449+
+++++++ Contents of side #2 (rebased commit: kkmpptxz e05db987)
450450
2a
451451
2b
452452
>>>>>>> Conflict 1 of 1 ends

cli/tests/test_completion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ fn test_files() {
13271327
│ M f_modified
13281328
│ M f_not_yet_copied
13291329
│ R {f_not_yet_renamed => f_renamed}
1330-
│ × royxmykx [email protected] 2001-02-03 08:05:14 conflicted cf10549a conflict
1330+
│ × royxmykx [email protected] 2001-02-03 08:05:14 conflicted 0c17cca0 conflict
13311331
├─╯ conflicted
13321332
│ A f_added_2
13331333
│ A f_dir/dir_file_1

cli/tests/test_evolog_command.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ fn test_evolog_with_or_without_diff() {
3434
insta::assert_snapshot!(output, @r"
3535
@ rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
3636
│ my description
37-
│ -- operation 3499115d3831 snapshot working copy
38-
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
37+
│ -- operation cefc13a2ade8 snapshot working copy
38+
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
3939
│ my description
40-
│ -- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
40+
│ -- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
4141
○ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
4242
│ my description
4343
│ -- operation 18a971ce330a snapshot working copy
@@ -52,10 +52,10 @@ fn test_evolog_with_or_without_diff() {
5252
insta::assert_snapshot!(output, @r"
5353
@ rlvkpnrz [38;5;[email protected] 2001-02-03 08:05:10 33c10ace
5454
│ my description
55-
│ [38;5;8m--[39m operation [38;5;4m3499115d3831[39m snapshot working copy
56-
[1m[38;5;1m×[0m [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 08:05:09[39m [1m[38;5;4m7[0m[38;5;8mf56b2a0[39m [38;5;1mconflict[39m
55+
│ [38;5;8m--[39m operation [38;5;4mcefc13a2ade8[39m snapshot working copy
56+
[1m[38;5;1m×[0m [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 08:05:09[39m [1m[38;5;4ma[0m[38;5;8mb065353[39m [38;5;1mconflict[39m
5757
│ my description
58-
│ [38;5;8m--[39m operation [38;5;4meb87ec366530[39m rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
58+
│ [38;5;8m--[39m operation [38;5;4m2ef828d530fe[39m rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
5959
○ rlvkpnrz hidden [38;5;[email protected] 2001-02-03 08:05:09 51e08f95
6060
│ my description
6161
│ -- operation 18a971ce330a snapshot working copy
@@ -71,18 +71,18 @@ fn test_evolog_with_or_without_diff() {
7171
insta::assert_snapshot!(output, @r"
7272
@ rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
7373
│ my description
74-
│ -- operation 3499115d3831 snapshot working copy
74+
│ -- operation cefc13a2ade8 snapshot working copy
7575
│ Resolved conflict in file1:
7676
│ 1 : <<<<<<< Conflict 1 of 1
77-
│ 2 : %%%%%%% Changes from base to side #1
77+
│ 2 : %%%%%%% Changes from base (qpvuntsm c664a51b) to side #1 (rebase destination: zzzzzzzz 00000000)
7878
│ 3 : -foo
79-
│ 4 : +++++++ Contents of side #2
79+
│ 4 : +++++++ Contents of side #2 (rebased commit: rlvkpnrz 51e08f95)
8080
│ 5 : foo
8181
│ 6 : bar
8282
│ 7 1: >>>>>>> Conflict 1 of 1 endsresolved
83-
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
83+
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
8484
│ my description
85-
│ -- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
85+
│ -- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
8686
○ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
8787
│ my description
8888
│ -- operation 18a971ce330a snapshot working copy
@@ -104,10 +104,10 @@ fn test_evolog_with_or_without_diff() {
104104
insta::assert_snapshot!(output, @r"
105105
@ rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
106106
│ my description
107-
│ -- operation 3499115d3831 snapshot working copy
108-
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
107+
│ -- operation cefc13a2ade8 snapshot working copy
108+
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
109109
│ my description
110-
│ -- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
110+
│ -- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
111111
○ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
112112
│ my description
113113
│ -- operation 18a971ce330a snapshot working copy
@@ -128,10 +128,10 @@ fn test_evolog_with_or_without_diff() {
128128
insta::assert_snapshot!(output, @r"
129129
@ rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
130130
│ my description
131-
│ -- operation 3499115d3831 snapshot working copy
132-
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
131+
│ -- operation cefc13a2ade8 snapshot working copy
132+
× rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
133133
│ my description
134-
│ -- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
134+
│ -- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
135135
[EOF]
136136
");
137137

@@ -140,10 +140,10 @@ fn test_evolog_with_or_without_diff() {
140140
insta::assert_snapshot!(output, @r"
141141
rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
142142
my description
143-
-- operation 3499115d3831 snapshot working copy
144-
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
143+
-- operation cefc13a2ade8 snapshot working copy
144+
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
145145
my description
146-
-- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
146+
-- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
147147
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
148148
my description
149149
-- operation 18a971ce330a snapshot working copy
@@ -158,23 +158,23 @@ fn test_evolog_with_or_without_diff() {
158158
insta::assert_snapshot!(output, @r"
159159
rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
160160
my description
161-
-- operation 3499115d3831 snapshot working copy
161+
-- operation cefc13a2ade8 snapshot working copy
162162
diff --git a/file1 b/file1
163163
index 0000000000..2ab19ae607 100644
164164
--- a/file1
165165
+++ b/file1
166166
@@ -1,7 +1,1 @@
167167
-<<<<<<< Conflict 1 of 1
168-
-%%%%%%% Changes from base to side #1
168+
-%%%%%%% Changes from base (qpvuntsm c664a51b) to side #1 (rebase destination: zzzzzzzz 00000000)
169169
--foo
170-
-+++++++ Contents of side #2
170+
-+++++++ Contents of side #2 (rebased commit: rlvkpnrz 51e08f95)
171171
-foo
172172
-bar
173173
->>>>>>> Conflict 1 of 1 ends
174174
+resolved
175-
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
175+
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
176176
my description
177-
-- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
177+
-- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
178178
rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
179179
my description
180180
-- operation 18a971ce330a snapshot working copy
@@ -293,10 +293,10 @@ fn test_evolog_with_custom_symbols() {
293293
insta::assert_snapshot!(output, @r"
294294
$ rlvkpnrz [email protected] 2001-02-03 08:05:10 33c10ace
295295
│ my description
296-
│ -- operation 3622beb20303 snapshot working copy
297-
┝ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 7f56b2a0 conflict
296+
│ -- operation 86c717ddde1c snapshot working copy
297+
┝ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 ab065353 conflict
298298
│ my description
299-
│ -- operation eb87ec366530 rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
299+
│ -- operation 2ef828d530fe rebase commit 51e08f95160c897080d035d330aead3ee6ed5588
300300
┝ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 51e08f95
301301
│ my description
302302
│ -- operation 18a971ce330a snapshot working copy

cli/tests/test_file_show_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ fn test_show() {
106106
let output = work_dir.run_jj(["file", "show", "file1"]);
107107
insta::assert_snapshot!(output, @r"
108108
<<<<<<< Conflict 1 of 1
109-
%%%%%%% Changes from base to side #1
109+
%%%%%%% Changes from base (rlvkpnrz d506fcb9) to side #1 (rebase destination: qpvuntsm eb7b8a1f)
110110
-b
111111
+a
112-
+++++++ Contents of side #2
112+
+++++++ Contents of side #2 (rebased commit: kpqxywon 9433f7fb)
113113
c
114114
>>>>>>> Conflict 1 of 1 ends
115115
[EOF]

cli/tests/test_git_colocated.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ fn test_git_colocated_update_index_rebase_conflict() {
12321232
.success();
12331233

12341234
insta::assert_snapshot!(get_log_output(&work_dir), @r"
1235-
@ 535388c5aab1b3a33fdc04a4bf8033de0d1b86ec left
1235+
@ ab9aea1d02400101e36feb6a820d0efe1e41def8 left
12361236
○ 620e15db9fcd05fff912c52d2cafd36c9e01523c right git_head()
12371237
○ 1861378a9167e6561bf8ce4a6fef2d7c0897dd87 base
12381238
◆ 0000000000000000000000000000000000000000
@@ -1251,8 +1251,8 @@ fn test_git_colocated_update_index_rebase_conflict() {
12511251
work_dir.run_jj(["new"]).success();
12521252

12531253
insta::assert_snapshot!(get_log_output(&work_dir), @r"
1254-
@ 04ebd7523ac6107ccdd5bc34600a073b94e43299
1255-
× 535388c5aab1b3a33fdc04a4bf8033de0d1b86ec left git_head()
1254+
@ 89a164d9c51c4da64ec29689f59e15ba5b1f6d9a
1255+
× ab9aea1d02400101e36feb6a820d0efe1e41def8 left git_head()
12561256
○ 620e15db9fcd05fff912c52d2cafd36c9e01523c right
12571257
○ 1861378a9167e6561bf8ce4a6fef2d7c0897dd87 base
12581258
◆ 0000000000000000000000000000000000000000

cli/tests/test_git_push.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,8 @@ fn test_git_push_conflict() {
14071407
let output = work_dir.run_jj(["git", "push", "--all"]);
14081408
insta::assert_snapshot!(output, @r"
14091409
------- stderr -------
1410-
Error: Won't push commit 654e715becca since it has conflicts
1411-
Hint: Rejected commit: yostqsxw 654e715b my-bookmark | (conflict) third
1410+
Error: Won't push commit 0b9c8b70b10b since it has conflicts
1411+
Hint: Rejected commit: yostqsxw 0b9c8b70 my-bookmark | (conflict) third
14121412
[EOF]
14131413
[exit status: 1]
14141414
");

cli/tests/test_next_prev_commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ fn test_next_conflict_head() {
938938
insta::assert_snapshot!(output, @r"
939939
------- stderr -------
940940
Error: The working copy has no descendants with conflicts
941-
Hint: Working copy: rlvkpnrz 5f088cac (conflict) (no description set)
941+
Hint: Working copy: rlvkpnrz 91942261 (conflict) (no description set)
942942
[EOF]
943943
[exit status: 1]
944944
");

0 commit comments

Comments
 (0)