Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit 2a4295fe authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

tests: move verification closer to setup in test-copies-chain-merge.t

I found this test case really hard to read because it requires
scrolling back and forth between the setup and the verification. This
patch moves them closer together. There was also duplicated
descriptions for each test case (duplicated between setup and
verification). They had already become out of sync. I picked the
description from the verification, partly so the differences would be
highlighted in this patch.

Differential Revision: https://phab.mercurial-scm.org/D8377
parent 4e2845d9452d
Pipeline #4962 failed with stage
in 25 minutes and 40 seconds
......@@ -135,9 +135,11 @@ Having another branch renaming a different file to the same filename as another
o 0 i-0 initial commit: a b h
Merge the two branches we just defined (in both directions)
- one with change to an unrelated file
- one with renames in them
merging with unrelated change does not interfere with the renames
---------------------------------------------------------------
- rename on one side
- unrelated change on the other side
$ hg up 'desc("b-1")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
......@@ -170,7 +172,43 @@ Merge the two branches we just defined (in both directions)
o 0 i-0 initial commit: a b h
Merge:
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
A f
d
R d
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
A f
d
R d
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
M b
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
M b
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
M b
A f
d
R d
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
M b
A f
d
R d
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
M b
A f
a
R a
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
M b
A f
a
R a
merging with the side having a delete
-------------------------------------
case summary:
- one with change to an unrelated file
- one deleting the change
and recreate an unrelated file after the merge
......@@ -213,272 +251,6 @@ and recreate an unrelated file after the merge
|
o 0 i-0 initial commit: a b h
Merge:
- one with change to an unrelated file
- one deleting and recreating the file
Note:
| In this case, the merge get conflicting information since on one side we have
| a "brand new" d. and one the other one we have "d renamed from c (itself
| renamed from c)".
|
| The current code arbitrarily pick one side
$ hg up 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("d-2")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mBDm-0 simple merge - one way'
$ hg up 'desc("d-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mDBm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
@ 18 mDBm-0 simple merge - the other way
|\
+---o 17 mBDm-0 simple merge - one way
| |/
| o 8 d-2 re-add d
| |
| o 7 d-1 delete d
| |
o | 5 b-1: b update
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
Merge:
- the "e-" branch renaming b to f (through 'g')
- the "a-" branch renaming d to f (through e)
$ hg up 'desc("a-2")'
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("e-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mAEm-0 simple merge - one way'
$ hg up 'desc("e-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("a-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mEAm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
@ 20 mEAm-0 simple merge - the other way
|\
+---o 19 mAEm-0 simple merge - one way
| |/
| o 10 e-2 g -move-> f
| |
| o 9 e-1 b -move-> g
| |
o | 4 a-2: e -move-> f
| |
o | 3 a-1: d -move-> e
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
Note:
| In this case, one of the merge wrongly record a merge while there is none.
| This lead to bad copy tracing information to be dug up.
Merge:
- one with change to an unrelated file (b)
- one overwriting a file (d) with a rename (from h to i to d)
$ hg up 'desc("i-2")'
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg mv h i
$ hg commit -m "f-1: rename h -> i"
created new head
$ hg mv --force i d
$ hg commit -m "f-2: rename i -> d"
$ hg debugindex d
rev linkrev nodeid p1 p2
0 2 01c2f5eabdc4 000000000000 000000000000
1 8 b004912a8510 000000000000 000000000000
2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
3 22 c72365ee036f 000000000000 000000000000
$ hg up 'desc("b-1")'
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("f-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mBFm-0 simple merge - one way'
$ hg up 'desc("f-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mFBm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
@ 24 mFBm-0 simple merge - the other way
|\
+---o 23 mBFm-0 simple merge - one way
| |/
| o 22 f-2: rename i -> d
| |
| o 21 f-1: rename h -> i
| |
o | 5 b-1: b update
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
Merge:
- one with change to a file
- one deleting and recreating the file
$ hg up 'desc("i-2")'
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo "some update" >> d
$ hg commit -m "g-1: update d"
created new head
$ hg up 'desc("d-2")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("g-1")' --tool :union
merging d
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mDGm-0 simple merge - one way'
$ hg up 'desc("g-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("d-2")' --tool :union
merging d
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mGDm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
@ 27 mGDm-0 simple merge - the other way
|\
+---o 26 mDGm-0 simple merge - one way
| |/
| o 25 g-1: update d
| |
o | 8 d-2 re-add d
| |
o | 7 d-1 delete d
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
Merge:
- one with change to a file (d)
- one overwriting that file with a rename (from h to i, to d)
$ hg up 'desc("f-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("g-1")' --tool :union
merging d
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mFGm-0 simple merge - one way'
created new head
$ hg up 'desc("g-1")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("f-2")' --tool :union
merging d
0 files updated, 1 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mGFm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
@ 29 mGFm-0 simple merge - the other way
|\
+---o 28 mFGm-0 simple merge - one way
| |/
| o 25 g-1: update d
| |
o | 22 f-2: rename i -> d
| |
o | 21 f-1: rename h -> i
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
Check results
=============
merging with unrelated change does not interfer wit the renames
---------------------------------------------------------------
- rename on one side
- unrelated change on the other side
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
A f
d
R d
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
A f
d
R d
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
M b
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
M b
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
M b
A f
d
R d
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
M b
A f
d
R d
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
M b
A f
a
R a
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
M b
A f
a
R a
merging with the side having a delete
-------------------------------------
case summary:
- one with change to an unrelated file
- one deleting the change
and recreate an unrelated file after the merge
checks:
- comparing from the merge
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
......@@ -540,6 +312,36 @@ Note:
| In this case, one of the merge wrongly record a merge while there is none.
| This lead to bad copy tracing information to be dug up.
$ hg up 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("d-2")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mBDm-0 simple merge - one way'
$ hg up 'desc("d-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mDBm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
@ 18 mDBm-0 simple merge - the other way
|\
+---o 17 mBDm-0 simple merge - one way
| |/
| o 8 d-2 re-add d
| |
| o 7 d-1 delete d
| |
o | 5 b-1: b update
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
M d
$ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
......@@ -577,12 +379,6 @@ not a merge.
0 2 01c2f5eabdc4 000000000000 000000000000
1 8 b004912a8510 000000000000 000000000000
2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
3 22 c72365ee036f 000000000000 000000000000
4 23 863d9bc49190 01c2f5eabdc4 c72365ee036f
5 25 7bded9d9da1f 01c2f5eabdc4 000000000000
6 26 f04cac32d703 b004912a8510 7bded9d9da1f
7 27 d7a5eafb9322 7bded9d9da1f b004912a8510
8 28 2ed7a51aed47 c72365ee036f 7bded9d9da1f
(This `hg log` output if wrong, since no merge actually happened).
......@@ -615,12 +411,45 @@ This `hg log` output is correct
A d
R a
Comparing with a merge with colliding rename
--------------------------------------------
- the "e-" branch renaming b to f (through 'g')
- the "a-" branch renaming d to f (through e)
$ hg up 'desc("a-2")'
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("e-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mAEm-0 simple merge - one way'
$ hg up 'desc("e-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("a-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mEAm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
@ 20 mEAm-0 simple merge - the other way
|\
+---o 19 mAEm-0 simple merge - one way
| |/
| o 10 e-2 g -move-> f
| |
| o 9 e-1 b -move-> g
| |
o | 4 a-2: e -move-> f
| |
o | 3 a-1: d -move-> e
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
$ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
eb806e34ef6be4c264effd5933d31004ad15a793 644 f
$ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
......@@ -675,10 +504,59 @@ Comparing with a merge with colliding rename
R a
R b
Note:
| In this case, one of the merge wrongly record a merge while there is none.
| This lead to bad copy tracing information to be dug up.
Merge:
- one with change to an unrelated file (b)
- one overwriting a file (d) with a rename (from h to i to d)
$ hg up 'desc("i-2")'
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg mv h i
$ hg commit -m "f-1: rename h -> i"
created new head
$ hg mv --force i d
$ hg commit -m "f-2: rename i -> d"
$ hg debugindex d
rev linkrev nodeid p1 p2
0 2 01c2f5eabdc4 000000000000 000000000000
1 8 b004912a8510 000000000000 000000000000
2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
3 22 c72365ee036f 000000000000 000000000000
$ hg up 'desc("b-1")'
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("f-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mBFm-0 simple merge - one way'
$ hg up 'desc("f-2")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("b-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mFBm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
@ 24 mFBm-0 simple merge - the other way
|\
+---o 23 mBFm-0 simple merge - one way
| |/
| o 22 f-2: rename i -> d
| |
| o 21 f-1: rename h -> i
| |
o | 5 b-1: b update
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
The overwriting should take over. However, the behavior is currently buggy
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBFm-0")'
......@@ -740,13 +618,51 @@ The following output is correct.
o 0 i-0 initial commit: a b h
Merge:
- one with change to a file
- one deleting and recreating the file
Unlike in the 'BD/DB' cases, an actuall merge happened here. So we should
Unlike in the 'BD/DB' cases, an actual merge happened here. So we should
consider history and rename on both branch of the merge.
$ hg up 'desc("i-2")'
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo "some update" >> d
$ hg commit -m "g-1: update d"
created new head
$ hg up 'desc("d-2")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("g-1")' --tool :union
merging d
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mDGm-0 simple merge - one way'
$ hg up 'desc("g-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("d-2")' --tool :union
merging d
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mGDm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
@ 27 mGDm-0 simple merge - the other way
|\
+---o 26 mDGm-0 simple merge - one way
| |/
| o 25 g-1: update d
| |
o | 8 d-2 re-add d
| |
o | 7 d-1 delete d
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
A d
a
......@@ -807,6 +723,39 @@ Note:
|
| The current code arbitrarily pick one side
$ hg up 'desc("f-2")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("g-1")' --tool :union
merging d
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mFGm-0 simple merge - one way'
created new head
$ hg up 'desc("g-1")'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("f-2")' --tool :union
merging d
0 files updated, 1 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m 'mGFm-0 simple merge - the other way'
created new head
$ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
@ 29 mGFm-0 simple merge - the other way
|\
+---o 28 mFGm-0 simple merge - one way
| |/
| o 25 g-1: update d
| |
o | 22 f-2: rename i -> d
| |
o | 21 f-1: rename h -> i
|/
o 2 i-2: c -move-> d
|
o 1 i-1: a -move-> c
|
o 0 i-0 initial commit: a b h
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm-0")'
A d
a
......@@ -850,7 +799,6 @@ Note:
o 0 i-0 initial commit: a b h
$ hg log -Gfr 'desc("mGFm-0")' d
@ 29 mGFm-0 simple merge - the other way
|\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment