branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 07 Mar 2019 10:51:48 +0100
changeset 4428 fe37721aa0d9
parent 4422 62a6f8f4e694 (current diff)
parent 4427 9e2ee7dc5e34 (diff)
child 4429 e10ebc58926e
branching: merge with stable
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-content-divergence.t
tests/test-evolve-continue.t
--- a/hgext3rd/evolve/cmdrewrite.py	Mon Mar 04 12:30:15 2019 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Mar 07 10:51:48 2019 +0100
@@ -1171,11 +1171,9 @@
         cmdutil.bailifchanged(repo)
         rewriteutil.precheck(repo, [rev], action='split')
         tr = repo.transaction('split')
+        # make sure we respect the phase while splitting
+        overrides = {('phases', 'new-commit'): ctx.phase()}
 
-        # make sure we respect the revision current phase while splitting
-        phasestr = ctx.phasestr()
-        if phasestr == 'secret':
-            opts['secret'] = True
         if len(ctx.parents()) > 1:
             raise error.Abort(_("cannot split merge commits"))
         prev = ctx.p1()
@@ -1213,8 +1211,10 @@
 
             if haschanges(matcher):
                 if iselect:
-                    cmdutil.dorecord(ui, repo, commands.commit, 'commit', False,
-                                     cmdutil.recordfilter, *pats, **opts)
+                    with repo.ui.configoverride(overrides, 'split'):
+                        cmdutil.dorecord(ui, repo, commands.commit, 'commit',
+                                         False, cmdutil.recordfilter, *pats,
+                                         **opts)
                     # TODO: Does no seem like the best way to do this
                     # We should make dorecord return the newly created commit
                     newcommits.append(repo['.'])
@@ -1223,7 +1223,8 @@
                     hint = _("do you want --interactive")
                     raise error.Abort(msg, hint=hint)
                 else:
-                    commands.commit(ui, repo, *pats, **opts)
+                    with repo.ui.configoverride(overrides, 'split'):
+                        commands.commit(ui, repo, *pats, **opts)
                     newcommits.append(repo['.'])
             if pats:
                 # refresh the wctx used for the matcher
@@ -1236,7 +1237,8 @@
                 while nextaction is None:
                     nextaction = ui.prompt('continue splitting? [Ycdq?]', default='y')
                     if nextaction == 'c':
-                        commands.commit(ui, repo, **opts)
+                        with repo.ui.configoverride(overrides, 'split'):
+                            commands.commit(ui, repo, **opts)
                         newcommits.append(repo['.'])
                         break
                     elif nextaction == 'q':
@@ -1274,7 +1276,8 @@
                 if haschanges():
                     # XXX: Should we show a message for informing the user
                     # that we create another commit with remaining changes?
-                    commands.commit(ui, repo, **opts)
+                    with repo.ui.configoverride(overrides, 'split'):
+                        commands.commit(ui, repo, **opts)
                     newcommits.append(repo['.'])
         if newcommits:
             tip = repo[newcommits[-1]]
--- a/hgext3rd/evolve/evolvecmd.py	Mon Mar 04 12:30:15 2019 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Mar 07 10:51:48 2019 +0100
@@ -680,7 +680,7 @@
 
 def dirstatedance(repo, oldparent, newparent, match):
     """utility function to fix the dirstate when we change parents from
-    oldparent to newparent with a directory working directory using
+    oldparent to newparent with a dirty working directory using
     repo.dirstate.setparents()
 
     Lets refer oldparent as Pold
@@ -916,6 +916,7 @@
             repo.dirstate.write(tr)
             # fix up dirstate for copies and renames
             copies.duplicatecopies(repo, repo[None], dest.rev(), orig.p1().rev())
+            dirstatedance(repo, dest, orig.node(), None)
 
         class LocalMergeFailure(MergeFailure, exc.__class__):
             pass
--- a/tests/test-evolve-content-divergence.t	Mon Mar 04 12:30:15 2019 +0100
+++ b/tests/test-evolve-content-divergence.t	Thu Mar 07 10:51:48 2019 +0100
@@ -929,8 +929,13 @@
       () [default] draft
 
 
-Test to make sure that evolve don't fall into unrecoverable state (issue6053):
+Test to make sure that evolve don't fall into unrecoverable state (issue6053)
 ------------------------------------------------------------------------------
+
+It happened when two divergent csets has different parent (need relocation)
+and resolution parent is obsolete. So this issue triggered when during
+relocation we hit conflicts. So lets make the repo as described.
+
   $ cd ..
   $ hg init localside
   $ cd localside
@@ -954,18 +959,21 @@
 
   $ echo ee > e
   $ hg amend -m "updated e"
+  $ hg up 1 -q
 
-  $ hg up 1 -q
+To make sure we hit conflict while relocating
   $ echo dd > d
   $ echo ee > e
   $ hg add d e
   $ hg ci -m "updated e"
   created new head
 
+Lets create divergence
   $ hg prune 4 -s . --hidden
   1 changesets pruned
   2 new content-divergent changesets
 
+Making obsolete resolution parent
   $ hg prune 3
   1 changesets pruned
   1 new orphan changesets
--- a/tests/test-evolve-continue.t	Mon Mar 04 12:30:15 2019 +0100
+++ b/tests/test-evolve-continue.t	Thu Mar 07 10:51:48 2019 +0100
@@ -357,3 +357,71 @@
   continue: hg evolve --continue
   $ hg evolve --continue
   evolving 22:d2c94a8f44bd "added g"
+
+Testing that interrupted evolve don't get confused about copies (issue5930):
+----------------------------------------------------------------------------
+
+  $ cd ..
+  $ hg init issue5930
+  $ cd issue5930
+  $ echo a > a
+  $ hg ci -Am "added a"
+  adding a
+  $ hg cp a b
+  $ hg ci -m "rename a to b"
+
+  $ hg up 0 -q
+  $ echo c > c
+  $ hg ci -Am "added c"
+  adding c
+  created new head
+
+  $ echo d > c
+  $ echo d > d
+  $ hg ci -Am "added d, modified c"
+  adding d
+  $ hg up .^
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg log -G -T "{rev} {desc}\n"
+  o  3 added d, modified c
+  |
+  @  2 added c
+  |
+  | o  1 rename a to b
+  |/
+  o  0 added a
+  
+  $ hg rebase -r . -d 1
+  rebasing 2:29edef26570b "added c"
+  1 new orphan changesets
+  $ echo conflict > c
+  $ hg amend
+
+  $ hg log -G -T "{rev} {desc}\n"
+  @  5 added c
+  |
+  | *  3 added d, modified c
+  | |
+  | x  2 added c
+  | |
+  o |  1 rename a to b
+  |/
+  o  0 added a
+  
+
+  $ hg evolve
+  move:[3] added d, modified c
+  atop:[5] added c
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+Status mentions file 'b' (copied from 'a') here, even though it wasn't
+affected by the evolved changeset (nor was 'a')
+
+  $ hg st -C
+  M c
+  A d
+  ? c.orig