changeset 3983:a689f07d5663

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 21 Aug 2018 04:08:38 +0200
parents 7b1af75e12a9 (current diff) b4d0245c7f40 (diff)
children e5da40e74104
files tests/test-evolve.t
diffstat 9 files changed, 102 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Tue Aug 21 04:05:12 2018 +0200
+++ b/CHANGELOG	Tue Aug 21 04:08:38 2018 +0200
@@ -4,10 +4,12 @@
 8.1.1 - in progress
 -------------------
 
+  * evolve: properly set second parent during conflict (issue5927)
   * next: fix topic restriction when passing --evolve
   * clone: fix possible crash when using clone bundle and forcing cache warming
   * obshashrange: fix speed and consistency issues during cache invalidation
   * obshashrange: properly persist all caches involved in obshashrange discovery
+  * delete the evolvestate after aborting interrupted `next --evolve`
 
 8.1.0 -- 2018-08-03
 -------------------
--- a/hgext3rd/evolve/evolvecmd.py	Tue Aug 21 04:05:12 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Aug 21 04:08:38 2018 +0200
@@ -21,7 +21,7 @@
     hg,
     lock as lockmod,
     merge,
-    node,
+    node as nodemod,
     obsolete,
     obsutil,
     phases,
@@ -299,7 +299,7 @@
         text += bumped.description()
 
         new = context.memctx(repo,
-                             parents=[prec.node(), node.nullid],
+                             parents=[prec.node(), nodemod.nullid],
                              text=text,
                              files=files,
                              filectxfn=filectxfn,
@@ -320,10 +320,10 @@
     # if rebased happened, update bookmarks from there too
     if rebasedbmupdate:
         rebasedbmupdate(newid)
-    repo.ui.status(_('committed as %s\n') % node.short(newid))
+    repo.ui.status(_('committed as %s\n') % nodemod.short(newid))
     # reroute the working copy parent to the new changeset
     with repo.dirstate.parentchange():
-        repo.dirstate.setparents(newid, node.nullid)
+        repo.dirstate.setparents(newid, nodemod.nullid)
     return (True, replacementnode)
 
 def _solvedivergent(ui, repo, divergent, evolvestate, dryrun=False,
@@ -535,7 +535,7 @@
     resparent = evolvestate['resolutionparent']
     try:
         with repo.dirstate.parentchange():
-            repo.dirstate.setparents(resparent, node.nullid)
+            repo.dirstate.setparents(resparent, nodemod.nullid)
 
         dirstatedance(repo, divergent, resparent, None)
 
@@ -798,7 +798,7 @@
         # We can't make any assumptions about how to update the hash if the
         # cset in question was split or diverged.
         if len(successors) == 1 and len(successors[0]) == 1:
-            newsha1 = node.hex(successors[0][0])
+            newsha1 = nodemod.hex(successors[0][0])
             commitmsg = commitmsg.replace(sha1, newsha1[:len(sha1)])
         else:
             repo.ui.note(_('The stale commit message reference to %s could '
@@ -814,7 +814,7 @@
         nodenew = _relocatecommit(repo, orig, commitmsg)
     except error.Abort as exc:
         with repo.dirstate.parentchange():
-            repo.setparents(repo['.'].node(), node.nullid)
+            repo.setparents(dest.node(), orig.node())
             repo.dirstate.write(tr)
             # fix up dirstate for copies and renames
             copies.duplicatecopies(repo, repo[None], dest.rev(), orig.p1().rev())
@@ -1187,8 +1187,8 @@
                 for n in dset['divergentnodes']:
                     t = "%s (%s)" if first else " %s (%s)"
                     first = False
-                    fm.plain(t % (node.hex(n)[:hashlen], repo[n].phasestr()))
-                comprec = node.hex(dset['commonprecursor'])[:hashlen]
+                    fm.plain(t % (nodemod.hex(n)[:hashlen], repo[n].phasestr()))
+                comprec = nodemod.hex(dset['commonprecursor'])[:hashlen]
                 fm.plain(" (precursor %s)\n" % comprec)
         fm.plain("\n")
 
@@ -1207,11 +1207,11 @@
                              'sourcenode': imprec,
                              'sourcetype': 'immutableprecursor'})
         for dset in dsets:
-            divnodes = [{'node': node.hex(n),
+            divnodes = [{'node': nodemod.hex(n),
                          'phase': repo[n].phasestr(),
                         } for n in dset['divergentnodes']]
             troubles.append({'troubletype': TROUBLES['CONTENTDIVERGENT'],
-                             'commonprecursor': node.hex(dset['commonprecursor']),
+                             'commonprecursor': nodemod.hex(dset['commonprecursor']),
                              'divergentnodes': divnodes})
         fm.data(troubles=troubles)
 
@@ -1543,6 +1543,7 @@
             ui.status(_('evolve aborted\n'))
             ui.status(_('working directory is now at %s\n')
                       % pctx.hex()[:12])
+            evolvestate.delete()
             return 0
         return abortevolve(ui, repo, evolvestate)
     else:
@@ -1691,7 +1692,7 @@
             evolvestate.delete()
             ui.status(_('evolve aborted\n'))
             ui.status(_('working directory is now at %s\n')
-                      % node.hex(startnode)[:12])
+                      % nodemod.hex(startnode)[:12])
         else:
             raise error.Abort(_("unable to abort interrupted evolve, use 'hg "
                                 "evolve --stop' to stop evolve"))
@@ -1866,6 +1867,9 @@
                     repo.dirstate.setparents(ctxparents[0].node(),
                                              currentp1)
             pass
+    else:
+        with repo.dirstate.parentchange():
+            repo.dirstate.setparents(repo.dirstate.parents()[0], nodemod.nullid)
 
     with repo.ui.configoverride(overrides, 'evolve-continue'):
         node = repo.commit(text=message, user=user,
--- a/tests/test-evolve-abort-contentdiv.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve-abort-contentdiv.t	Tue Aug 21 04:08:38 2018 +0200
@@ -96,6 +96,22 @@
   # To stop:        hg evolve --stop
   # (also see `hg help evolve.interrupted`)
   
+  $ hg parents
+  changeset:   6:9c1631e352d9
+  tag:         tip
+  parent:      3:ca1b80f7960a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: content-divergent
+  summary:     added d
+  
+  changeset:   5:e49523854bc8
+  parent:      3:ca1b80f7960a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: content-divergent
+  summary:     added d
+  
 
   $ hg evolve --abort
   evolve aborted
--- a/tests/test-evolve-abort-orphan.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve-abort-orphan.t	Tue Aug 21 04:08:38 2018 +0200
@@ -88,6 +88,21 @@
   fix conflicts and see `hg help evolve.interrupted`
   [1]
 
+  $ hg parents
+  changeset:   5:e93a9161a274
+  tag:         tip
+  parent:      2:b1661037fa25
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c
+  
+  changeset:   4:c41c793e0ef1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: orphan
+  summary:     added d
+  
+
   $ hg evolve --abort
   evolve aborted
   working directory is now at e93a9161a274
@@ -173,7 +188,7 @@
   |   () draft
   | *  6:e83de241f751 added d
   | |   () draft
-  | *  5:e93a9161a274 added c
+  | @  5:e93a9161a274 added c
   | |   () draft
   | x  2:b1661037fa25 added b
   | |   () draft
@@ -266,7 +281,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | | *  5:bcb1c47f8520 added d
   | | |   () draft
@@ -329,7 +344,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | | *  5:bcb1c47f8520 added d
   | | |   () draft
@@ -413,7 +428,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | x  1:2f913b0c9220 added a
   |/    () draft
@@ -481,7 +496,7 @@
   |   (bm1) draft
   o  4:a0086c17bfc7 added a
   |   () draft
-  | *  3:17509928e5bf added c
+  | @  3:17509928e5bf added c
   | |   () draft
   | x  2:9f0c80a55ddc added b
   | |   () draft
@@ -525,3 +540,19 @@
   $ hg evolve --abort
   evolve aborted
   working directory is now at c1f4718020e3
+
+  $ ls .hg/
+  00changelog.i
+  bookmarks
+  branch
+  cache
+  dirstate
+  last-message.txt
+  requires
+  store
+  undo.backup.bookmarks
+  undo.backup.dirstate
+  undo.bookmarks
+  undo.branch
+  undo.desc
+  undo.dirstate
--- a/tests/test-evolve-abort-phasediv.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve-abort-phasediv.t	Tue Aug 21 04:08:38 2018 +0200
@@ -108,6 +108,21 @@
   # (also see `hg help evolve.interrupted`)
   
 
+  $ hg parents
+  changeset:   3:ca1b80f7960a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c
+  
+  changeset:   6:ddba58020bc0
+  tag:         tip
+  parent:      1:c7586e2a9264
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: phase-divergent
+  summary:     added d
+  
+
   $ hg evolve --abort
   evolve aborted
   working directory is now at ddba58020bc0
--- a/tests/test-evolve-phase.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve-phase.t	Tue Aug 21 04:08:38 2018 +0200
@@ -103,7 +103,7 @@
   $ hg glog
   @  3 - 87495ea7c9ec b (draft)
   |
-  | *  2 - 13833940840c c (secret)
+  | @  2 - 13833940840c c (secret)
   | |
   | x  1 - 1e6c11564562 b (draft)
   |/
--- a/tests/test-evolve-stop-orphan.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve-stop-orphan.t	Tue Aug 21 04:08:38 2018 +0200
@@ -169,6 +169,19 @@
       () draft
 
   $ hg status
+  $ ls .hg/
+  00changelog.i
+  branch
+  cache
+  dirstate
+  last-message.txt
+  requires
+  store
+  undo.backup.dirstate
+  undo.bookmarks
+  undo.branch
+  undo.desc
+  undo.dirstate
 
 Checking when multiple revs need to be evolved, some revs evolve without
 conflicts
--- a/tests/test-evolve.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-evolve.t	Tue Aug 21 04:08:38 2018 +0200
@@ -1476,7 +1476,7 @@
   |
   o  37:df89d30f23e2@default(draft) amended
   |
-  | *  36:59c37c5bebd1@default(draft) will cause conflict at evolve
+  | @  36:59c37c5bebd1@default(draft) will cause conflict at evolve
   | |
   | x  35:7cc12c6c7862@default(draft) will be evolved safely
   | |
--- a/tests/test-stabilize-conflict.t	Tue Aug 21 04:05:12 2018 +0200
+++ b/tests/test-stabilize-conflict.t	Tue Aug 21 04:08:38 2018 +0200
@@ -140,7 +140,7 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     babar count up to ten
   |
-  | *  changeset:   4:71c18f70c34f
+  | @  changeset:   4:71c18f70c34f
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  instability: orphan
@@ -232,7 +232,7 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     babar count up to ten
   |
-  | *  changeset:   6:1836b91c6c1d
+  | @  changeset:   6:1836b91c6c1d
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  instability: orphan