test: add file cancelation scenario for phase-divergence
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 10 Apr 2019 21:03:56 +0200
changeset 4498 99dbe605fda5
parent 4497 711668818508
child 4499 90f94231db5d
child 4507 de9089514833
test: add file cancelation scenario for phase-divergence This improve the test coverage for corner cases.
tests/test-evolve-phase-divergence.t
--- a/tests/test-evolve-phase-divergence.t	Wed Apr 10 20:43:42 2019 +0200
+++ b/tests/test-evolve-phase-divergence.t	Wed Apr 10 21:03:56 2019 +0200
@@ -1816,3 +1816,140 @@
   
   
   $ cd ..
+
+Phase divergence with file removal cancelation
+==============================================
+
+  $ hg init cancel-removal
+  $ cd cancel-removal
+  $ 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
+  $ hg glog --hidden --patch
+  @  2:0825dcee2670 delete a
+  |   () draftdiff -r 75d2b02c4a5c -r 0825dcee2670 a
+  |  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -a
+  |  diff -r 75d2b02c4a5c -r 0825dcee2670 c
+  |  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -c
+  |
+  | x  1:dff6e52f5e41 delete a
+  |/    () draftdiff -r 75d2b02c4a5c -r dff6e52f5e41 a
+  |    --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -a
+  |    diff -r 75d2b02c4a5c -r dff6e52f5e41 b
+  |    --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -b
+  |    diff -r 75d2b02c4a5c -r dff6e52f5e41 c
+  |    --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -c
+  |
+  o  0:75d2b02c4a5c initial
+      () draftdiff -r 000000000000 -r 75d2b02c4a5c a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+     diff -r 000000000000 -r 75d2b02c4a5c b
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b
+     diff -r 000000000000 -r 75d2b02c4a5c c
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +c
+     diff -r 000000000000 -r 75d2b02c4a5c d
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +d
+  
+
+The public predecessors deletes'a', 'b' and 'c',
+If was amended to only delete 'a', and 'c'
+so the fixup should add back 'b'.
+
+  $ hg phase -p -r dff6e52f5e41 --hidden
+  1 new phase-divergent changesets
+  $ hg evolve --phase-divergent
+  recreate:[2] delete a
+  atop:[1] delete a
+  committed as 84aa492b3c37
+  working directory is now at 84aa492b3c37
+  $ hg glog --patch
+  @  3:84aa492b3c37 phase-divergent update to dff6e52f5e41:
+  |   () draftdiff -r dff6e52f5e41 -r 84aa492b3c37 b
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  1:dff6e52f5e41 delete a
+  |   () publicdiff -r 75d2b02c4a5c -r dff6e52f5e41 a
+  |  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -a
+  |  diff -r 75d2b02c4a5c -r dff6e52f5e41 b
+  |  --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -b
+  |  diff -r 75d2b02c4a5c -r dff6e52f5e41 c
+  |  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -c
+  |
+  o  0:75d2b02c4a5c initial
+      () publicdiff -r 000000000000 -r 75d2b02c4a5c a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+     diff -r 000000000000 -r 75d2b02c4a5c b
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b
+     diff -r 000000000000 -r 75d2b02c4a5c c
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +c
+     diff -r 000000000000 -r 75d2b02c4a5c d
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +d
+  
+
+  $ hg diff --change .
+  diff -r dff6e52f5e41 -r 84aa492b3c37 b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +b
+