evolve: use the new rebased changeset to resolve phase-divergence
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 23 Mar 2018 17:46:46 +0530
changeset 3623 71fbb679e311
parent 3622 534af64b0107
child 3624 6756f2a85f5b
evolve: use the new rebased changeset to resolve phase-divergence When there is a parent change in phase-divergence, `hg evolve` first rebases the diveregent changeset on parent of public changeset and then continue the resolution of phase-divergence *but* we used to continue with the old divergent changeset rather than the new rebased one. This patch makes sure we use the new rebased changeset to proceed with the resolution. Tests changes shows that it fixes things which were broken earlier.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-phase-divergence.t
tests/test-stabilize-result.t
--- a/hgext3rd/evolve/evolvecmd.py	Fri Mar 23 17:21:09 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Mar 23 17:46:46 2018 +0530
@@ -245,6 +245,9 @@
                 tmpctx = repo[tmpid]
                 compat.createmarkers(repo, [(bumped, (tmpctx,))],
                                      operation='evolve')
+                # after rebasing, the changeset against which revert should
+                # happen should be the new rebased changeset
+                bumped = tmpctx
         except MergeFailure:
             repo.vfs.write('graftstate', bumped.hex() + '\n')
             repo.ui.write_err(_('evolution failed!\n'))
--- a/tests/test-evolve-phase-divergence.t	Fri Mar 23 17:21:09 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Fri Mar 23 17:46:46 2018 +0530
@@ -603,18 +603,14 @@
   rebasing to destination parent: 502e73736632
   (leaving bookmark bm)
   computing new diff
-  committed as 5388376cb2f0
-  working directory is now at 5388376cb2f0
+  committed as 2352021b3785
+  working directory is now at 2352021b3785
 
-XXX: we should not have created a new commit here
+XXX: we should move bookmark here
   $ hg glog
-  @  12:5388376cb2f0 phase-divergent update to 2352021b3785:
-  |
-  |  added x to x
-  |   () draft
-  | x  11:b1a0e143e32b added x to x
-  | |   (bm) draft
-  o |  9:2352021b3785 added x to x
+  x  11:b1a0e143e32b added x to x
+  |   (bm) draft
+  | @  9:2352021b3785 added x to x
   |/    () public
   o  8:502e73736632 phase-divergent update to b756eb10ea73:
   |
@@ -633,32 +629,28 @@
   o  0:d3873e73d99e init
       () public
 
-  $ hg obslog -r .
-  @  5388376cb2f0 (12) phase-divergent update to 2352021b3785:
-  |
+  $ hg obslog -r . b1a0e143e32b --all --hidden
   x  b1a0e143e32b (11) added x to x
-  |    rewritten(description, parent, content) as 5388376cb2f0 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |    pruned using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  334e300d6db5 (10) added x to x
   |    rewritten(parent) as b1a0e143e32b using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
-  o  2352021b3785 (9) added x to x
+  @  2352021b3785 (9) added x to x
        rewritten(parent) as 334e300d6db5 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
   
-XXX: The existence of this changeset is wrong, moreover its diff is wrong
+
   $ hg exp
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 5388376cb2f0f9bc4842361fb16fe66ce5cc2f6d
-  # Parent  2352021b37851be226ebed109b0eb6eada918566
-  phase-divergent update to 2352021b3785:
-  
+  # Node ID 2352021b37851be226ebed109b0eb6eada918566
+  # Parent  502e737366322886cf628276aa0a2796904453b4
   added x to x
   
-  diff -r 2352021b3785 -r 5388376cb2f0 bar
-  --- a/bar	Thu Jan 01 00:00:00 1970 +0000
-  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +0,0 @@
-  -foo
+  diff -r 502e73736632 -r 2352021b3785 x
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +x
--- a/tests/test-stabilize-result.t	Fri Mar 23 17:21:09 2018 +0530
+++ b/tests/test-stabilize-result.t	Fri Mar 23 17:46:46 2018 +0530
@@ -173,10 +173,10 @@
   perform evolve? [Ny] y
   rebasing to destination parent: 66719795a494
   computing new diff
-  committed as 3d968e0b3097
-  working directory is now at 3d968e0b3097
+  committed as 8fc63fe1f297
+  working directory is now at 8fc63fe1f297
   $ glog
-  @  11:3d968e0b3097@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  @  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   |
   | o  7:7bc2f5967f5e@default(draft) bk:[] add c
   | |
@@ -186,19 +186,18 @@
   |
   o  0:07f494440405@default(public) bk:[] adda
   
-XXX: c addition should not be part of this patch
   $ hg exp
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 3d968e0b3097ef69b104ff2e1af43fce665feb0a
+  # Node ID 8fc63fe1f297f356d1156bbbbe865b9911efad74
   # Parent  1cf0aacfd36310b18e403e1594871187e0364a82
   phase-divergent update to 1cf0aacfd363:
   
   newer a
   
-  diff -r 1cf0aacfd363 -r 3d968e0b3097 a
+  diff -r 1cf0aacfd363 -r 8fc63fe1f297 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,3 +1,4 @@
@@ -206,18 +205,13 @@
    a
    newer a
   +babar
-  diff -r 1cf0aacfd363 -r 3d968e0b3097 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
 
 Stabilize divergent changesets with same parent
 ===============================================
 
   $ rm a.orig
   $ hg up 7bc2f5967f5e
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat << EOF >> a
   > flore
   > arthur
@@ -230,7 +224,7 @@
   $ glog
   @  12:3932c176bbaa@default(draft) bk:[] More addition
   |
-  | o  11:3d968e0b3097@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
   o |  7:7bc2f5967f5e@default(draft) bk:[] add c
   | |
@@ -259,7 +253,7 @@
   |
   | *  13:d2f173e25686@default(draft) bk:[] More addition
   |/
-  | o  11:3d968e0b3097@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
   o |  7:7bc2f5967f5e@default(draft) bk:[] add c
   | |
@@ -309,7 +303,7 @@
   $ glog
   @  15:f344982e63c4@default(draft) bk:[] More addition
   |
-  | o  11:3d968e0b3097@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
   o |  7:7bc2f5967f5e@default(draft) bk:[] add c
   | |