--- a/tests/test-evolve-content-divergent-basic.t Wed Apr 10 17:29:40 2019 +0200
+++ b/tests/test-evolve-content-divergent-basic.t Wed Apr 10 17:57:11 2019 +0200
@@ -664,3 +664,469 @@
+conflict
+babar
$ cd ..
+
+Check case where one side undo some of the common predecessors change
+---------------------------------------------------------------------
+
+The goal is to make sure we merge using the right base.
+
+ $ hg init predecessors-as-merge-base
+ $ cd predecessors-as-merge-base
+ $ cat << EOF > numbers
+ > 1
+ > 2
+ > 3
+ > 4
+ > 5
+ > 6
+ > 7
+ > 8
+ > 9
+ > EOF
+ $ cat << EOF > letters
+ > a
+ > b
+ > c
+ > d
+ > e
+ > f
+ > g
+ > h
+ > i
+ > EOF
+ $ cat << EOF > romans
+ > I
+ > II
+ > III
+ > IV
+ > V
+ > VI
+ > VII
+ > VIII
+ > IX
+ > EOF
+ $ hg add numbers letters romans
+ $ hg commit -m root
+ $ cat << EOF > numbers
+ > 1
+ > 2
+ > 3
+ > four
+ > 5
+ > 6
+ > 7
+ > 8
+ > 9
+ > EOF
+ $ cat << EOF > letters
+ > a
+ > b
+ > c
+ > D
+ > e
+ > f
+ > g
+ > h
+ > i
+ > EOF
+ $ hg commit -m E1
+ $ cat << EOF > numbers
+ > 1
+ > 2
+ > 3
+ > 4
+ > 5
+ > 6
+ > seven
+ > 8
+ > 9
+ > EOF
+ $ cat << EOF > romans
+ > I
+ > II
+ > III
+ > IV
+ > V
+ > vi
+ > VII
+ > VIII
+ > IX
+ > EOF
+ $ hg commit --amend -m E2
+ $ hg --hidden update -r 'desc(E1)'
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset 4a250e5bd992
+ (hidden revision '4a250e5bd992' was rewritten as: 084ae625fa51)
+ working directory parent is obsolete! (4a250e5bd992)
+ (use 'hg evolve' to update to its successor: 084ae625fa51)
+ $ cat << EOF > numbers
+ > one
+ > 2
+ > 3
+ > four
+ > 5
+ > 6
+ > 7
+ > 8
+ > 9
+ > EOF
+ $ cat << EOF > letters
+ > a
+ > b
+ > c
+ > d
+ > e
+ > f
+ > g
+ > h
+ > i
+ > EOF
+ $ cat << EOF > romans
+ > I
+ > ii
+ > III
+ > IV
+ > V
+ > VI
+ > VII
+ > VIII
+ > IX
+ > EOF
+ $ hg commit --amend -m E3
+ 2 new content-divergent changesets
+ $ hg log -G --patch --hidden
+ @ 3:19ed1bf64a2c@default(draft) E3 [content-divergent]
+ | diff --git a/numbers b/numbers
+ | --- a/numbers
+ | +++ b/numbers
+ | @@ -1,1 +1,1 @@
+ | -1
+ | +one
+ | @@ -4,1 +4,1 @@
+ | -4
+ | +four
+ | diff --git a/romans b/romans
+ | --- a/romans
+ | +++ b/romans
+ | @@ -2,1 +2,1 @@
+ | -II
+ | +ii
+ |
+ | * 2:084ae625fa51@default(draft) E2 [content-divergent]
+ |/ diff --git a/letters b/letters
+ | --- a/letters
+ | +++ b/letters
+ | @@ -4,1 +4,1 @@
+ | -d
+ | +D
+ | diff --git a/numbers b/numbers
+ | --- a/numbers
+ | +++ b/numbers
+ | @@ -7,1 +7,1 @@
+ | -7
+ | +seven
+ | diff --git a/romans b/romans
+ | --- a/romans
+ | +++ b/romans
+ | @@ -6,1 +6,1 @@
+ | -VI
+ | +vi
+ |
+ | x 1:4a250e5bd992@default(draft) E1 []
+ |/ diff --git a/letters b/letters
+ | --- a/letters
+ | +++ b/letters
+ | @@ -4,1 +4,1 @@
+ | -d
+ | +D
+ | diff --git a/numbers b/numbers
+ | --- a/numbers
+ | +++ b/numbers
+ | @@ -4,1 +4,1 @@
+ | -4
+ | +four
+ |
+ o 0:6d1fdf6de7e2@default(draft) root []
+ diff --git a/letters b/letters
+ new file mode 100644
+ --- /dev/null
+ +++ b/letters
+ @@ -0,0 +1,9 @@
+ +a
+ +b
+ +c
+ +d
+ +e
+ +f
+ +g
+ +h
+ +i
+ diff --git a/numbers b/numbers
+ new file mode 100644
+ --- /dev/null
+ +++ b/numbers
+ @@ -0,0 +1,9 @@
+ +1
+ +2
+ +3
+ +4
+ +5
+ +6
+ +7
+ +8
+ +9
+ diff --git a/romans b/romans
+ new file mode 100644
+ --- /dev/null
+ +++ b/romans
+ @@ -0,0 +1,9 @@
+ +I
+ +II
+ +III
+ +IV
+ +V
+ +VI
+ +VII
+ +VIII
+ +IX
+
+ $ hg evolve --list
+ 084ae625fa51: E2
+ content-divergent: 19ed1bf64a2c (draft) (precursor 4a250e5bd992)
+
+ 19ed1bf64a2c: E3
+ content-divergent: 084ae625fa51 (draft) (precursor 4a250e5bd992)
+
+ $ hg obslog --all --patch
+ * 084ae625fa51 (2) E2
+ |
+ | @ 19ed1bf64a2c (3) E3
+ |/
+ x 4a250e5bd992 (1) E1
+ rewritten(description, content) as 084ae625fa51 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ diff -r 4a250e5bd992 -r 084ae625fa51 changeset-description
+ --- a/changeset-description
+ +++ b/changeset-description
+ @@ -1,1 +1,1 @@
+ -E1
+ +E2
+
+ diff --git a/numbers b/numbers
+ --- a/numbers
+ +++ b/numbers
+ @@ -4,1 +4,1 @@
+ -four
+ +4
+ @@ -7,1 +7,1 @@
+ -7
+ +seven
+ diff --git a/romans b/romans
+ --- a/romans
+ +++ b/romans
+ @@ -6,1 +6,1 @@
+ -VI
+ +vi
+
+ rewritten(description, content) as 19ed1bf64a2c using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ diff -r 4a250e5bd992 -r 19ed1bf64a2c changeset-description
+ --- a/changeset-description
+ +++ b/changeset-description
+ @@ -1,1 +1,1 @@
+ -E1
+ +E3
+
+ diff --git a/letters b/letters
+ --- a/letters
+ +++ b/letters
+ @@ -4,1 +4,1 @@
+ -D
+ +d
+ diff --git a/numbers b/numbers
+ --- a/numbers
+ +++ b/numbers
+ @@ -1,1 +1,1 @@
+ -1
+ +one
+ diff --git a/romans b/romans
+ --- a/romans
+ +++ b/romans
+ @@ -2,1 +2,1 @@
+ -II
+ +ii
+
+
+
+ $ hg evolve --content-divergent --rev 'desc("E3")'
+ merge:[2] E2
+ with: [3] E3
+ base: [1] E1
+ updating to "local" side of the conflict: 084ae625fa51
+ merging "other" content-divergent changeset '19ed1bf64a2c'
+ merging numbers
+ merging romans
+ 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
+ working directory is now at aae293050980
+ $ hg status
+ $ hg amend -m 'E4'
+ $ hg export
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID 8c2a6aae4bc5c1cc00c68276017dcef3d468e895
+ # Parent 6d1fdf6de7e2d9fc9b098aa286b60785bbeaab7a
+ E4
+
+ diff --git a/numbers b/numbers
+ --- a/numbers
+ +++ b/numbers
+ @@ -1,1 +1,1 @@
+ -1
+ +one
+ @@ -7,1 +7,1 @@
+ -7
+ +seven
+ diff --git a/romans b/romans
+ --- a/romans
+ +++ b/romans
+ @@ -2,1 +2,1 @@
+ -II
+ +ii
+ @@ -6,1 +6,1 @@
+ -VI
+ +vi
+ $ hg log -G
+ @ 5:8c2a6aae4bc5@default(draft) E4 []
+ |
+ o 0:6d1fdf6de7e2@default(draft) root []
+
+ $ hg obslog --patch
+ @ 8c2a6aae4bc5 (5) E4
+ |
+ x aae293050980 (4) <<<<<<< divergent
+ |\ rewritten(description) as 8c2a6aae4bc5 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ | | diff -r aae293050980 -r 8c2a6aae4bc5 changeset-description
+ | | --- a/changeset-description
+ | | +++ b/changeset-description
+ | | @@ -1,4 +1,1 @@
+ | | -<<<<<<< divergent
+ | | -E2||||||| base
+ | | -E1=======
+ | | -E3>>>>>>> other
+ | | +E4
+ | |
+ | |
+ x | 084ae625fa51 (2) E2
+ | | rewritten(description, content) as aae293050980 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ | | diff -r 084ae625fa51 -r aae293050980 changeset-description
+ | | --- a/changeset-description
+ | | +++ b/changeset-description
+ | | @@ -1,1 +1,4 @@
+ | | -E2
+ | | +<<<<<<< divergent
+ | | +E2||||||| base
+ | | +E1=======
+ | | +E3>>>>>>> other
+ | |
+ | | diff --git a/letters b/letters
+ | | --- a/letters
+ | | +++ b/letters
+ | | @@ -4,1 +4,1 @@
+ | | -D
+ | | +d
+ | | diff --git a/numbers b/numbers
+ | | --- a/numbers
+ | | +++ b/numbers
+ | | @@ -1,1 +1,1 @@
+ | | -1
+ | | +one
+ | | diff --git a/romans b/romans
+ | | --- a/romans
+ | | +++ b/romans
+ | | @@ -2,1 +2,1 @@
+ | | -II
+ | | +ii
+ | |
+ | |
+ | x 19ed1bf64a2c (3) E3
+ |/ rewritten(description, content) as aae293050980 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ | diff -r 19ed1bf64a2c -r aae293050980 changeset-description
+ | --- a/changeset-description
+ | +++ b/changeset-description
+ | @@ -1,1 +1,4 @@
+ | -E3
+ | +<<<<<<< divergent
+ | +E2||||||| base
+ | +E1=======
+ | +E3>>>>>>> other
+ |
+ | diff --git a/numbers b/numbers
+ | --- a/numbers
+ | +++ b/numbers
+ | @@ -4,1 +4,1 @@
+ | -four
+ | +4
+ | @@ -7,1 +7,1 @@
+ | -7
+ | +seven
+ | diff --git a/romans b/romans
+ | --- a/romans
+ | +++ b/romans
+ | @@ -6,1 +6,1 @@
+ | -VI
+ | +vi
+ |
+ |
+ x 4a250e5bd992 (1) E1
+ rewritten(description, content) as 084ae625fa51 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ diff -r 4a250e5bd992 -r 084ae625fa51 changeset-description
+ --- a/changeset-description
+ +++ b/changeset-description
+ @@ -1,1 +1,1 @@
+ -E1
+ +E2
+
+ diff --git a/numbers b/numbers
+ --- a/numbers
+ +++ b/numbers
+ @@ -4,1 +4,1 @@
+ -four
+ +4
+ @@ -7,1 +7,1 @@
+ -7
+ +seven
+ diff --git a/romans b/romans
+ --- a/romans
+ +++ b/romans
+ @@ -6,1 +6,1 @@
+ -VI
+ +vi
+
+ rewritten(description, content) as 19ed1bf64a2c using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ diff -r 4a250e5bd992 -r 19ed1bf64a2c changeset-description
+ --- a/changeset-description
+ +++ b/changeset-description
+ @@ -1,1 +1,1 @@
+ -E1
+ +E3
+
+ diff --git a/letters b/letters
+ --- a/letters
+ +++ b/letters
+ @@ -4,1 +4,1 @@
+ -D
+ +d
+ diff --git a/numbers b/numbers
+ --- a/numbers
+ +++ b/numbers
+ @@ -1,1 +1,1 @@
+ -1
+ +one
+ diff --git a/romans b/romans
+ --- a/romans
+ +++ b/romans
+ @@ -2,1 +2,1 @@
+ -II
+ +ii
+
+
--- a/tests/test-evolve-content-divergent-corner-cases.t Wed Apr 10 17:29:40 2019 +0200
+++ b/tests/test-evolve-content-divergent-corner-cases.t Wed Apr 10 17:57:11 2019 +0200
@@ -319,3 +319,67 @@
~
$ cd ..
+
+Check that canceling of file deletion are merge correctly
+---------------------------------------------------------
+
+File addition/deletion tend to have special processing. So we better test them directory
+
+ $ hg init non-public
+ $ cd non-public
+ $ echo a > a
+ $ echo b > b
+ $ echo c > c
+ $ echo d > d
+ $ hg ci -Aqm initial
+
+oops, we meant to delete just 'a', but we deleted 'b' and 'c' too
+
+ $ hg rm a b c
+ $ hg ci -m 'delete a'
+ $ hg revert -r .^ b
+ $ hg amend
+
+create some content divergence
+
+ $ hg co dff6e52f5e41 --hidden
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ updated to hidden changeset dff6e52f5e41
+ (hidden revision 'dff6e52f5e41' was rewritten as: 0825dcee2670)
+ working directory parent is obsolete! (dff6e52f5e41)
+ (use 'hg evolve' to update to its successor: 0825dcee2670)
+ $ hg revert -r .^ c
+ $ hg amend
+ 2 new content-divergent changesets
+ $ hg glog --hidden
+ @ 3:92ecd58f9b05 delete a
+ | () [default] draft
+ | * 2:0825dcee2670 delete a
+ |/ () [default] draft
+ | x 1:dff6e52f5e41 delete a
+ |/ () [default] draft
+ o 0:75d2b02c4a5c initial
+ () [default] draft
+
+Resolve the divergence, only "a" should be removed
+
+ $ hg evolve --content-divergent
+ merge:[3] delete a
+ with: [2] delete a
+ base: [1] delete a
+ merging "other" content-divergent changeset '0825dcee2670'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 7ca6a9fafcf6
+ $ hg glog
+ @ 4:7ca6a9fafcf6 delete a
+ | () [default] draft
+ o 0:75d2b02c4a5c initial
+ () [default] draft
+
+ $ hg diff --change .
+ diff --git a/a b/a
+ deleted file mode 100644
+ --- a/a
+ +++ /dev/null
+ @@ -1,1 +0,0 @@
+ -a