test-compat: merge stable into mercurial-4.8 mercurial-4.8
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 11 Apr 2019 22:41:25 +0200
branchmercurial-4.8
changeset 4511 e4fc3af2d0a9
parent 4358 72f4e924f25a (current diff)
parent 4510 0b86c05440e9 (diff)
child 4512 7a779a288793
child 4548 d3cc1b55ad0a
test-compat: merge stable into mercurial-4.8
tests/test-discovery-obshashrange.t
tests/test-divergent.t
tests/test-evolve-abort-contentdiv.t
tests/test-evolve-content-divergence.t
tests/test-evolve-stop-contentdiv.t
tests/test-grab.t
tests/test-split.t
tests/test-stabilize-result.t
tests/test-topic-stack.t
tests/test-unstable.t
--- a/.hgtags	Tue Jan 22 12:54:41 2019 -0500
+++ b/.hgtags	Thu Apr 11 22:41:25 2019 +0200
@@ -76,3 +76,4 @@
 b90422a11a887c6ff756c2a5622ea0a1e260ff4c 8.3.1
 7edc5c148df0150087832b861966d658df0b601e 8.3.2
 97b18934d6db9e7e7eaa3fb656c0411d7f43af26 8.3.3
+8c4289d0e91e95b3281c378e1ac3f4ff4678b4d3 8.4.0
--- a/CHANGELOG	Tue Jan 22 12:54:41 2019 -0500
+++ b/CHANGELOG	Thu Apr 11 22:41:25 2019 +0200
@@ -1,33 +1,55 @@
 Changelog
 =========
 
-8.4.0 - in progress
+8.5.0 - in progress
 -------------------
 
-  * split: improve and update the user prompt (BC)
-  * split: make it possible to drop change during a split
-  * split: no longer accept revision with --rev (BC)
-  * split: accept file patterns
-  * split: support for non interactive splits
+  * evolve: fix an recoverable state (issue6053)
+  * evolve: share evolve related cache between `shares`
+  * evolve: improved compatibility with narrow repositories,
+  * evolve: preserve --[no-]update value over --continue,
+  * evolve: make sure the extensions are only active on repository that
+            enables it. Double check your server configuration (issue6057)
+  * evolve: make sure divergence resolution don't replace the initial author
+            (issue6113)
+  * evolve: improved support for content-divergence with public changesets,
+  * pick: align working dir branch with the one from the pick result (issue6089)
+  * pick: add the standard `--tool` option,
+  * prune: fix error message when pruning public changesets
+  * split: preserve phases (issue6048)
+  * stack: improved and speed --children flag up,
+  * stack: mention all divergences too.
+  * stack: support ranges in revsets indexing,
+  * touch: fix error message when touching public changesets
+  * uncommit: abort if an explicitly given file cannot be uncommitted
+
+8.4.0 -- 2019-12-22
+-------------------
+
+  * compat: add compatibility with Mercurial 4.9
+  * compat: drop compatibility with Mercurial 4.3
   * evolve: avoid potential crash when stabilizing orphan merges
-  * evolve: pick right destination in split+prune cases issue5686 (4.9 only)
+  * evolve: pick right destination in split+prune cases issue5686 (hg-4.9 only)
   * evolve: prioritize --rev/--any/--all option over obsolete working directory
   * fold: concatenate commit message in revision order
-  * push: have `--publish` overrule the `auto-publish` config
   * next: evolve aspiring children by default (use --no-evolve to skip)
   * next: pick lower part of a split as destination
-  * compat: drop compatibility with Mercurial 4.3
-  * compat: add compatibility with Mercurial 4.9
-
-topic:
+  * push: have `--publish` overrule the `auto-publish` config
+  * split: accept file patterns
+  * split: improve and update the user prompt (BC)
+  * split: make it possible to drop change during a split
+  * split: no longer accept revision without --rev (BC)
+  * split: support for non interactive splits
 
-  * topics: improve the message around topic changing
+topic 0.13.0
+
   * stack: introduce a --children flag (see help for details)
+  * stack: support for '#stack[idx]' absolute indexing in revset (hg-4.9+ only)
+  * topic: support for '#topic[idx]' relative indexing in revset (hg-4.9+ only)
   * topic: make --age compatible with the usual other display for `hg topic`
-  * stack: support for '#stack[idx]' absolute indexing in revset (4.9+ only)
-  * topic: support for '#topic[idx]' relative indexing in revset (4.9+ only)
+  * topics: improve the message around topic changes
 
-8.3.3 -- 2017-12-24
+8.3.3 -- 2018-12-24
 -------------------
 
   * evolve: properly detect unresolved merge conflict (issue-5966)
@@ -35,7 +57,7 @@
   * test: avoid leaking `hg serve` process
   * topic: fix error message for the `ngtip` revset
 
-8.3.2 -- 2017-11-27
+8.3.2 -- 2018-11-27
 -------------------
 
   * evolve: not longer attempt to translate revision's descriptions (issue6016)
--- a/debian/changelog	Tue Jan 22 12:54:41 2019 -0500
+++ b/debian/changelog	Thu Apr 11 22:41:25 2019 +0200
@@ -1,3 +1,9 @@
+mercurial-evolve (8.4.0-1) unstable; urgency=medium
+
+  * new upstream release
+
+ -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Tue, 22 Jan 2019 20:24:11 -0500
+
 mercurial-evolve (8.3.3-1) unstable; urgency=medium
 
   * new upstream release
--- a/hgext3rd/evolve/__init__.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/__init__.py	Thu Apr 11 22:41:25 2019 +0200
@@ -220,24 +220,22 @@
 via an extension).
 
 Instability
-==========
+===========
 
-(note: the vocabulary is in the process of being updated)
-
-Rewriting changesets might introduce instability (currently 'trouble').
+Rewriting changesets might introduce instability.
 
 There are two main kinds of instability: orphaning and diverging.
 
-Orphans are changesets left behind when their ancestors are rewritten, (currently: 'unstable').
+Orphans are changesets left behind when their ancestors are rewritten.
 Divergence has two variants:
 
 * Content-divergence occurs when independent rewrites of the same changesets
-  lead to different results. (currently: 'divergent')
+  lead to different results.
 
 * Phase-divergence occurs when the old (obsolete) version of a changeset
-  becomes public. (currently: 'bumped')
+  becomes public.
 
-If it possible to prevent local creation of orphans by using the following config::
+It is possible to prevent local creation of orphans by using the following config::
 
     [experimental]
     evolution=createmarkers,allnewcommands,exchange
@@ -257,14 +255,6 @@
 import struct
 
 try:
-    import StringIO as io
-    StringIO = io.StringIO
-except ImportError:
-    import io
-    StringIO = io.StringIO
-
-
-try:
     from mercurial import registrar
     registrar.templatekeyword # new in hg-3.8
 except ImportError:
@@ -276,8 +266,6 @@
 from mercurial import util
 
 from mercurial import obsolete
-if not obsolete._enabled:
-    obsolete._enabled = True
 
 from mercurial import (
     bookmarks as bookmarksmod,
@@ -844,14 +832,14 @@
     created = ret[1]
     if (opts['obsolete'] and None not in (created, expected['node'])
         and created != expected['node']):
-            tr = repo.transaction('import-obs')
-            try:
-                metadata = {'user': ui.username()}
-                repo.obsstore.create(tr, expected['node'], (created,),
-                                     metadata=metadata)
-                tr.close()
-            finally:
-                tr.release()
+        tr = repo.transaction('import-obs')
+        try:
+            metadata = {'user': ui.username()}
+            repo.obsstore.create(tr, expected['node'], (created,),
+                                 metadata=metadata)
+            tr.close()
+        finally:
+            tr.release()
     return ret
 
 
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Apr 11 22:41:25 2019 +0200
@@ -159,7 +159,6 @@
         old = repo['.']
         p1 = old.p1()
         rewriteutil.precheck(repo, [old.rev()], 'amend')
-        bookmarkupdater = rewriteutil.bookmarksupdater(repo, old.node(), tr)
         diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
         diffopts.nodates = True
         diffopts.git = True
@@ -169,18 +168,18 @@
         for chunk, label in patch.diffui(repo, p1.node(), old.node(),
                                          match=matcher,
                                          opts=diffopts):
-                fp.write(chunk)
+            fp.write(chunk)
         newnode = _editandapply(ui, repo, pats, old, p1, fp, diffopts)
         if newnode == old.node():
             raise error.Abort(_("nothing changed"))
         metadata = {}
         if opts.get('note'):
             metadata['note'] = opts['note']
-        obsolete.createmarkers(repo, [(old, (repo[newnode],))],
-                               metadata=metadata, operation='amend')
+        replacements = {old.node(): [newnode]}
+        scmutil.cleanupnodes(repo, replacements, operation='amend',
+                             metadata=metadata)
         phases.retractboundary(repo, tr, old.phase(), [newnode])
         hg.updaterepo(repo, newnode, True)
-        bookmarkupdater(newnode)
         tr.close()
     finally:
         if tr is not None:
@@ -205,7 +204,7 @@
             for chunk, label in patch.diffui(repo, p1.node(), old.node(),
                                              match=restmatcher,
                                              opts=diffopts):
-                    afp.write(chunk)
+                afp.write(chunk)
 
         user_patch = afp.getvalue()
         if not user_patch:
@@ -521,18 +520,47 @@
         if disallowunstable and not onahead:
             raise error.Abort(_("cannot uncommit in the middle of a stack"))
 
+        match = scmutil.match(old, pats, opts)
+
+        # Check all explicitly given files; abort if there's a problem.
+        if match.files():
+            s = old.status(old.p1(), match, listclean=True)
+            eligible = set(s.added) | set(s.modified) | set(s.removed)
+
+            badfiles = set(match.files()) - eligible
+
+            # Naming a parent directory of an eligible file is OK, even
+            # if not everything tracked in that directory can be
+            # uncommitted.
+            if badfiles:
+                badfiles -= set([f for f in util.dirs(eligible)])
+
+            try:
+                uipathfn = scmutil.getuipathfn(repo)
+            except AttributeError:
+                uipathfn = match.rel   # <= 4.9
+
+            for f in sorted(badfiles):
+                if f in s.clean:
+                    hint = _(b"file was not changed in working directory "
+                             b"parent")
+                elif repo.wvfs.exists(f):
+                    hint = _(b"file was untracked in working directory parent")
+                else:
+                    hint = _(b"file does not exist")
+
+                raise error.Abort(_(b'cannot uncommit "%s"')
+                                  % uipathfn(f), hint=hint)
+
         # Recommit the filtered changeset
         tr = repo.transaction('uncommit')
-        updatebookmarks = rewriteutil.bookmarksupdater(repo, old.node(), tr)
         if interactive:
             opts['all'] = True
-            match = scmutil.match(old, pats, opts)
             newid = _interactiveuncommit(ui, repo, old, match)
         else:
             newid = None
             includeorexclude = opts.get('include') or opts.get('exclude')
             if (pats or includeorexclude or opts.get('all')):
-                match = scmutil.match(old, pats, opts)
                 if not (opts['message'] or opts['logfile']):
                     opts['message'] = old.description()
                 message = cmdutil.logmessage(ui, opts)
@@ -548,8 +576,9 @@
         if opts.get('note'):
             metadata['note'] = opts['note']
 
-        obsolete.createmarkers(repo, [(old, (repo[newid],))], metadata=metadata,
-                               operation="uncommit")
+        replacements = {old.node(): [newid]}
+        scmutil.cleanupnodes(repo, replacements, operation="uncommit",
+                             metadata=metadata)
         phases.retractboundary(repo, tr, oldphase, [newid])
         if opts.get('revert'):
             hg.updaterepo(repo, newid, True)
@@ -557,7 +586,6 @@
             with repo.dirstate.parentchange():
                 repo.dirstate.setparents(newid, node.nullid)
                 _uncommitdirstate(repo, old, match, interactive)
-        updatebookmarks(newid)
         if not repo[newid].files():
             ui.warn(_("new changeset is empty\n"))
             ui.status(_("(use 'hg prune .' to remove it)\n"))
@@ -582,7 +610,7 @@
     fp = stringio()
     for chunk, label in patch.diffui(repo, tempnode, old.node(), None,
                                      opts=diffopts):
-            fp.write(chunk)
+        fp.write(chunk)
 
     fp.seek(0)
     newnode = _patchtocommit(ui, repo, old, fp)
@@ -607,13 +635,18 @@
     # uncommit a removed file partially.
     # TODO: wrap the operations in mercurial/patch.py and mercurial/crecord.py
     # to add uncommit as an operation taking care of BC.
-    chunks, opts = cmdutil.recordfilter(repo.ui, originalchunks,
-                                        operation='discard')
+    try:
+        chunks, opts = cmdutil.recordfilter(repo.ui, originalchunks, match,
+                                            operation='discard')
+    except TypeError:
+        # hg <= 4.9 (db72f9f6580e)
+        chunks, opts = cmdutil.recordfilter(repo.ui, originalchunks,
+                                            operation='discard')
     if not chunks:
         raise error.Abort(_("nothing selected to uncommit"))
     fp = stringio()
     for c in chunks:
-            c.write(fp)
+        c.write(fp)
 
     fp.seek(0)
     oldnode = node.hex(old.node())[:12]
@@ -776,14 +809,9 @@
                                                          root.p2().node()],
                                                         commitopts=commitopts)
             phases.retractboundary(repo, tr, targetphase, [newid])
-            obsolete.createmarkers(repo, [(ctx, (repo[newid],))
-                                   for ctx in allctx], metadata=metadata,
-                                   operation="fold")
-            # move bookmarks from old nodes to the new one
-            # XXX: we should make rewriteutil.rewrite() handle such cases
-            for ctx in allctx:
-                bmupdater = rewriteutil.bookmarksupdater(repo, ctx.node(), tr)
-                bmupdater(newid)
+            replacements = {ctx.node(): [newid] for ctx in allctx}
+            scmutil.cleanupnodes(repo, replacements, operation="fold",
+                                 metadata=metadata)
             tr.close()
         finally:
             tr.release()
@@ -1013,7 +1041,7 @@
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        rewriteutil.precheck(repo, revs, 'touch')
+        rewriteutil.precheck(repo, revs, 'prune')
         tr = repo.transaction('prune')
         # defines pruned changesets
         precs = []
@@ -1044,9 +1072,9 @@
             msg = "please add --fold if you want to do a fold"
             raise error.Abort(msg)
         elif biject:
-            relations = [(p, (s,)) for p, s in zip(precs, sucs)]
+            replacements = {p.node(): [s.node()] for p, s in zip(precs, sucs)}
         else:
-            relations = [(p, sucs) for p in precs]
+            replacements = {p.node(): [s.node() for s in sucs] for p in precs}
 
         wdp = repo['.']
 
@@ -1106,14 +1134,8 @@
         if opts.get('note'):
             metadata['note'] = opts['note']
 
-        # create markers
-        obsolete.createmarkers(repo, relations, metadata=metadata,
-                               operation="prune")
-
-        # informs that changeset have been pruned
-        ui.status(_('%i changesets pruned\n') % len(precs))
-
         precrevs = (precursor.rev() for precursor in precs)
+        moves = {}
         for ctx in repo.unfiltered().set('bookmark() and %ld', precrevs):
             # used to be:
             #
@@ -1124,11 +1146,14 @@
             # but then revset took a lazy arrow in the knee and became much
             # slower. The new forms makes as much sense and a much faster.
             for dest in ctx.ancestors():
-                if not dest.obsolete():
-                    bookmarksupdater = rewriteutil.bookmarksupdater
-                    updatebookmarks = bookmarksupdater(repo, ctx.node(), tr)
-                    updatebookmarks(dest.node())
+                if not dest.obsolete() and dest.node() not in replacements:
+                    moves[ctx.node()] = dest.node()
                     break
+        scmutil.cleanupnodes(repo, replacements, operation="prune", moves=moves,
+                             metadata=metadata)
+
+        # informs that changeset have been pruned
+        ui.status(_('%i changesets pruned\n') % len(precs))
 
         tr.close()
     finally:
@@ -1181,6 +1206,8 @@
         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()}
 
         if len(ctx.parents()) > 1:
             raise error.Abort(_("cannot split merge commits"))
@@ -1219,8 +1246,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['.'])
@@ -1229,7 +1258,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
@@ -1242,7 +1272,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':
@@ -1280,7 +1311,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]]
@@ -1327,7 +1359,7 @@
         ui.write_err('no revision to touch\n')
         return 1
     if not duplicate:
-        rewriteutil.precheck(repo, revs, touch)
+        rewriteutil.precheck(repo, revs, 'touch')
     tmpl = utility.shorttemplate
     displayer = compat.changesetdisplayer(ui, repo, {'template': tmpl})
     wlock = lock = tr = None
@@ -1397,7 +1429,7 @@
     [('r', 'rev', '', _('revision to pick'), _('REV')),
      ('c', 'continue', False, 'continue interrupted pick'),
      ('a', 'abort', False, 'abort interrupted pick'),
-    ],
+    ] + mergetoolopts,
     _('[-r] rev'))
 def cmdpick(ui, repo, *revs, **opts):
     """move a commit on the top of working directory parent and updates to it."""
@@ -1412,7 +1444,8 @@
     if opts.get('rev'):
         revs.append(opts['rev'])
 
-    with repo.wlock(), repo.lock(), repo.transaction('pick'):
+    overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
+    with repo.wlock(), repo.lock(), repo.transaction('pick'), ui.configoverride(overrides, 'pick'):
         pickstate = state.cmdstate(repo, path='pickstate')
         pctx = repo['.']
 
@@ -1469,11 +1502,13 @@
             newnode = repo.commit(text=origctx.description(),
                                   user=origctx.user(),
                                   date=origctx.date(), extra=origctx.extra())
+        repo.dirstate.setbranch(origctx.branch())
 
         if pickstate:
             pickstate.delete()
         newctx = repo[newnode] if newnode else pctx
-        obsolete.createmarkers(repo, [(origctx, (newctx,))], operation="pick")
+        replacements = {origctx.node(): [newctx.node()]}
+        scmutil.cleanupnodes(repo, replacements, operation="pick")
 
         if newnode is None:
             ui.warn(_("note: picking %d:%s created no changes to commit\n") %
--- a/hgext3rd/evolve/compat.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/compat.py	Thu Apr 11 22:41:25 2019 +0200
@@ -16,11 +16,9 @@
     obsolete,
     obsutil,
     repair,
-    revset,
     scmutil,
     util,
     ui as uimod,
-    vfs as vfsmod,
 )
 from mercurial.hgweb import hgweb_mod
 
@@ -54,43 +52,11 @@
 
 # Evolution renaming compat
 
-TROUBLES = {}
-
-if not util.safehasattr(context.basectx, 'orphan'):
-    TROUBLES['ORPHAN'] = 'unstable'
-    context.basectx.orphan = context.basectx.unstable
-else:
-    TROUBLES['ORPHAN'] = 'orphan'
-
-if not util.safehasattr(context.basectx, 'contentdivergent'):
-    TROUBLES['CONTENTDIVERGENT'] = 'divergent'
-    context.basectx.contentdivergent = context.basectx.divergent
-else:
-    TROUBLES['CONTENTDIVERGENT'] = 'content-divergent'
-
-if not util.safehasattr(context.basectx, 'phasedivergent'):
-    TROUBLES['PHASEDIVERGENT'] = 'bumped'
-    context.basectx.phasedivergent = context.basectx.bumped
-else:
-    TROUBLES['PHASEDIVERGENT'] = 'phase-divergent'
-
-if not util.safehasattr(context.basectx, 'isunstable'):
-    context.basectx.isunstable = context.basectx.troubled
-
-if not util.safehasattr(revset, 'orphan'):
-    @eh.revsetpredicate('orphan')
-    def oprhanrevset(*args, **kwargs):
-        return revset.unstable(*args, **kwargs)
-
-if not util.safehasattr(revset, 'contentdivergent'):
-    @eh.revsetpredicate('contentdivergent')
-    def contentdivergentrevset(*args, **kwargs):
-        return revset.divergent(*args, **kwargs)
-
-if not util.safehasattr(revset, 'phasedivergent'):
-    @eh.revsetpredicate('phasedivergent')
-    def phasedivergentrevset(*args, **kwargs):
-        return revset.bumped(*args, **kwargs)
+TROUBLES = {
+    'ORPHAN': 'orphan',
+    'CONTENTDIVERGENT': 'content-divergent',
+    'PHASEDIVERGENT': 'phase-divergent',
+}
 
 if util.safehasattr(uimod.ui, 'makeprogress'):
     def progress(ui, topic, pos, item="", unit="", total=None):
@@ -103,26 +69,6 @@
     def progress(ui, topic, pos, item="", unit="", total=None):
         ui.progress(topic, pos, item="", unit="", total=None)
 
-if not util.safehasattr(context.basectx, 'instabilities'):
-    def instabilities(self):
-        """return the list of instabilities affecting this changeset.
-
-        Instabilities are returned as strings. possible values are:
-         - orphan,
-         - phase-divergent,
-         - content-divergent.
-         """
-        instabilities = []
-        if self.orphan():
-            instabilities.append('orphan')
-        if self.phasedivergent():
-            instabilities.append('phase-divergent')
-        if self.contentdivergent():
-            instabilities.append('content-divergent')
-        return instabilities
-
-    context.basectx.instabilities = instabilities
-
 # XXX: Better detection of property cache
 if 'predecessors' not in dir(obsolete.obsstore):
     @property
@@ -131,21 +77,17 @@
 
     obsolete.obsstore.predecessors = predecessors
 
-if not util.safehasattr(obsolete, '_computeorphanset'):
-    obsolete._computeorphanset = obsolete.cachefor('orphan')(obsolete._computeunstableset)
-
-if not util.safehasattr(obsolete, '_computecontentdivergentset'):
-    obsolete._computecontentdivergentset = obsolete.cachefor('contentdivergent')(obsolete._computedivergentset)
-
-if not util.safehasattr(obsolete, '_computephasedivergentset'):
-    obsolete._computephasedivergentset = obsolete.cachefor('phasedivergent')(obsolete._computebumpedset)
-
 def memfilectx(repo, ctx, fctx, flags, copied, path):
     # XXX Would it be better at the module level?
     varnames = context.memfilectx.__init__.__code__.co_varnames
-    ctxmandatory = varnames[2] == "changectx"
 
-    if ctxmandatory:
+    if "copysource" in varnames:
+        mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(),
+                                  islink='l' in flags,
+                                  isexec='x' in flags,
+                                  copysource=copied.get(path))
+    # compat with hg <- 4.9
+    elif varnames[2] == "changectx":
         mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(),
                                   islink='l' in flags,
                                   isexec='x' in flags,
@@ -157,13 +99,6 @@
                                   copied=copied.get(path))
     return mctx
 
-def getcachevfs(repo):
-    cachevfs = getattr(repo, 'cachevfs', None)
-    if cachevfs is None:
-        cachevfs = vfsmod.vfs(repo.vfs.join('cache'))
-        cachevfs.createmode = repo.store.createmode
-    return cachevfs
-
 def strdiff(a, b, fn1, fn2):
     """ A version of mdiff.unidiff for comparing two strings
     """
@@ -261,7 +196,11 @@
     if graft:
         tca = _c1.ancestor(_c2)
 
-    limit = copies._findlimit(repo, c1.rev(), c2.rev())
+    # hg < 4.8 compat (dc50121126ae)
+    try:
+        limit = copies._findlimit(repo, c1, c2)
+    except (AttributeError, TypeError):
+        limit = copies._findlimit(repo, c1.rev(), c2.rev())
     if limit is None:
         # no common ancestor, no copies
         return {}, {}, {}, {}, {}
@@ -478,7 +417,9 @@
 
     return copy, movewithdir, diverge, renamedelete, dirmove
 
-if util.safehasattr(copies, '_fullcopytracing'):
+# hg <= 4.9 compat (7694b685bb10)
+fixupstreamed = util.safehasattr(scmutil, '_movedirstate')
+if not fixupstreamed:
     copies._fullcopytracing = fixedcopytracing
 
 if not util.safehasattr(obsutil, "_succs"):
--- a/hgext3rd/evolve/depthcache.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/depthcache.py	Thu Apr 11 22:41:25 2019 +0200
@@ -178,8 +178,7 @@
         """load data from disk"""
         assert repo.filtername is None
 
-        cachevfs = compat.getcachevfs(repo)
-        data = cachevfs.tryread(self._filepath)
+        data = repo.cachevfs.tryread(self._filepath)
         self._data = array.array('l')
         if not data:
             self._cachekey = self.emptykey
@@ -199,8 +198,7 @@
             return
 
         try:
-            cachevfs = compat.getcachevfs(repo)
-            cachefile = cachevfs(self._filepath, 'w', atomictemp=True)
+            cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
             headerdata = self._serializecachekey()
             cachefile.write(headerdata)
             cachefile.write(self._data.tostring())
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Apr 11 22:41:25 2019 +0200
@@ -18,8 +18,8 @@
     context,
     copies,
     error,
+    encoding,
     hg,
-    lock as lockmod,
     merge,
     mergeutil,
     node as nodemod,
@@ -71,11 +71,7 @@
     else:
         displayer = compat.changesetdisplayer(ui, repo,
                                               {'template': shorttemplate})
-    wlock = lock = tr = None
-    try:
-        wlock = repo.wlock()
-        lock = repo.lock()
-        tr = repo.transaction("evolve")
+    with repo.wlock(), repo.lock(), repo.transaction("evolve"):
         if 'orphan' == category:
             result = _solveunstable(ui, repo, ctx, evolvestate, displayer,
                                     dryrun, confirm, progresscb,
@@ -89,10 +85,7 @@
                                      dryrun, confirm, progresscb)
         else:
             assert False, "unknown trouble category: %s" % (category)
-        tr.close()
         return result
-    finally:
-        lockmod.release(tr, lock, wlock)
 
 def _solveunstable(ui, repo, orig, evolvestate, displayer, dryrun=False,
                    confirm=False, progresscb=None, lastsolved=None):
@@ -172,7 +165,7 @@
             repo.ui.write(_('atop:'))
             displayer.show(target)
     if confirm and ui.prompt('perform evolve? [Ny]', 'n') != 'y':
-            raise error.Abort(_('evolve aborted by user'))
+        raise error.Abort(_('evolve aborted by user'))
     if progresscb:
         progresscb()
     todo = 'hg rebase -r %s -d %s\n' % (orig, target)
@@ -236,7 +229,6 @@
         return (False, ".")
     if progresscb:
         progresscb()
-    tmpctx = bumped
 
     # Checking for whether the phase-divergent changeset has common parents as
     # it's precursors. Phase-divergent changeset and precursor having different
@@ -249,13 +241,14 @@
         repo.ui.status(
             _('rebasing to destination parent: %s\n') % prec.p1())
         try:
-            tmpid = relocate(repo, bumped, prec.p1(), evolvestate,
-                             category='phasedivergent')
-            if tmpid is not None:
-                tmpctx = repo[tmpid]
-                obsolete.createmarkers(repo, [(bumped, (tmpctx,))],
+            newnode = relocate(repo, bumped, prec.p1(), evolvestate,
+                               category='phasedivergent')
+            if newnode is not None:
+                new = repo[newnode]
+                obsolete.createmarkers(repo, [(bumped, (new,))],
                                        operation='evolve')
-                evolvestate['temprevs'].append(tmpid)
+                bumped = new
+                evolvestate['temprevs'].append(newnode)
         except MergeFailure:
             evolvestate['current'] = bumped.hex()
             evolvestate['precursor'] = prec.hex()
@@ -263,74 +256,53 @@
             raise error.InterventionRequired(_("fix conflicts and see `hg help "
                                                "evolve.interrupted`"))
 
-    return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx)
+    return _resolvephasedivergent(ui, repo, prec, bumped)
 
-def _resolvephasedivergent(ui, repo, prec, bumped, tmpctx=None):
+def _resolvephasedivergent(ui, repo, prec, bumped):
+    """final step of a phase divergence resolution
 
+    This will create a new changesets (or nothing when applicable), the two
+    changesets needs to be on the same parents.
+    """
     tr = repo.currenttransaction()
     assert tr is not None
+
+    cl = repo.changelog
+    prec_parent = cl.parentrevs(prec.rev())
+    bump_parent = cl.parentrevs(bumped.rev())
+    assert prec_parent == bump_parent, (prec_parent, bump_parent)
+
     bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
     newid = None
     replacementnode = None
 
-    # function to update the bookmark from the rebased changeset to new resolved
-    # changeset
-    rebasedbmupdate = None
-    if tmpctx and tmpctx.node() != bumped.node():
-        rebasedbmupdate = _bookmarksupdater(repo, tmpctx.node(), tr)
-        bumped = tmpctx
-
-    # Create the new commit context
-    repo.ui.status(_('computing new diff\n'))
-    files = set()
-    copied = copies.pathcopies(prec, bumped)
-    precmanifest = prec.manifest().copy()
-    # 3.3.2 needs a list.
-    # future 3.4 don't detect the size change during iteration
-    # this is fishy
-    for key, val in list(bumped.manifest().iteritems()):
-        precvalue = precmanifest.get(key, None)
-        if precvalue is not None:
-            del precmanifest[key]
-        if precvalue != val:
-            files.add(key)
-    files.update(precmanifest)  # add missing files
-
-    # commit it
-    if files: # something to commit!
-        def filectxfn(repo, ctx, path):
-            if path in bumped:
-                fctx = bumped[path]
-                flags = fctx.flags()
-                mctx = compat.memfilectx(repo, ctx, fctx, flags, copied, path)
-                return mctx
-            return None
+    # Create the new commit context. This is done by applying the changes from
+    # the precursor to the bumped node onto the precursor. This is effectively
+    # like reverting to the bumped node.
+    wctx = context.overlayworkingctx(repo)
+    wctx.setbase(prec)
+    merge.update(repo, bumped.node(), ancestor=prec, mergeancestor=True,
+                 branchmerge=True, force=False, wc=wctx)
+    if not wctx.isempty():
         text = '%s update to %s:\n\n' % (TROUBLES['PHASEDIVERGENT'], prec)
         text += bumped.description()
-
-        new = context.memctx(repo,
-                             parents=[prec.node(), nodemod.nullid],
-                             text=text,
-                             files=files,
-                             filectxfn=filectxfn,
-                             user=bumped.user(),
-                             date=bumped.date(),
-                             extra=bumped.extra())
-
-        newid = repo.commitctx(new)
+        memctx = wctx.tomemctx(text,
+                               parents=(prec.node(), nodemod.nullid),
+                               date=bumped.date(),
+                               extra=bumped.extra(),
+                               user=bumped.user())
+        newid = repo.commitctx(memctx)
         replacementnode = newid
     if newid is None:
-        obsolete.createmarkers(repo, [(tmpctx, ())], operation='evolve')
+        repo.ui.status(_('no changes to commit\n'))
+        obsolete.createmarkers(repo, [(bumped, ())], operation='evolve')
         newid = prec.node()
     else:
+        repo.ui.status(_('committed as %s\n') % nodemod.short(newid))
         phases.retractboundary(repo, tr, bumped.phase(), [newid])
-        obsolete.createmarkers(repo, [(tmpctx, (repo[newid],))],
+        obsolete.createmarkers(repo, [(bumped, (repo[newid],))],
                                flag=obsolete.bumpedfix, operation='evolve')
     bmupdate(newid)
-    # if rebased happened, update bookmarks from there too
-    if rebasedbmupdate:
-        rebasedbmupdate(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, nodemod.nullid)
@@ -349,6 +321,7 @@
     repo = repo.unfiltered()
     divergent = repo[divergent.rev()]
     evolvestate['divergent'] = divergent.node()
+    evolvestate['orig-divergent'] = divergent.node()
     # sometimes we will relocate a node in case of different parents and we can
     # encounter conflicts after relocation is done while solving
     # content-divergence and if the user calls `hg evolve --stop`, we need to
@@ -382,6 +355,23 @@
     evolvestate['other-divergent'] = other.node()
     evolvestate['base'] = base.node()
 
+    def swapnodes(div, other):
+        div, other = other, div
+        evolvestate['divergent'] = div.node()
+        evolvestate['other-divergent'] = other.node()
+        return div, other
+    # haspubdiv: to keep track if we are solving public content-divergence
+    haspubdiv = False
+    if not (divergent.mutable() and other.mutable()):
+        haspubdiv = True
+        # for simplicity, we keep public one to local side while merging
+        # (as divergent is kept at local side, pinning public -> divergent)
+        if divergent.mutable():
+            publicdiv = other
+            divergent, other = swapnodes(divergent, other)
+        else:
+            publicdiv = divergent
+        evolvestate['public-divergent'] = publicdiv.node()
     # we don't handle merge content-divergent changesets yet
     if len(other.parents()) > 1:
         msg = _("skipping %s: %s changeset can't be "
@@ -411,7 +401,17 @@
     resolutionparent = repo[divp1].node()
 
     gca = repo.revs("ancestor(%d, %d)" % (otherp1, divp1))
-
+    # divonly: non-obsolete csets which are topological ancestor of "divergent"
+    # but not "other"
+    divonly = repo.revs("only(%d, %d) - obsolete()" % (divergent.rev(),
+                                                       other.rev()))
+    # otheronly: non-obsolete csets which are topological ancestor of "other"
+    # but not "div"
+    otheronly = repo.revs("only(%d, %d) - obsolete()" % (other.rev(),
+                                                         divergent.rev()))
+    # make it exclusive set
+    divonly = set(divonly) - {divergent.rev()}
+    otheronly = set(otheronly) - {other.rev()}
     # is relocation of one of the changeset required
     relocatereq = False
 
@@ -429,15 +429,44 @@
     # then solve the content-divergence the way we solve 1)
     # for 3) and 4), we still have to decide
     if otherp1 in gca and divp1 in gca:
-        # both are on the same parents
-        pass
+        if otherp1 == other.p1().rev() and divp1 == divergent.p1().rev():
+            # both are on the same parents
+            pass
+        else:
+            # both are not on the same parent but have same parents's succs.
+            if otheronly and divonly:
+                # case: we have visible csets on both side diverging from
+                # tca of "divergent" and "other". We still need to decide what
+                # to do in this case
+                pass
+            if otheronly:
+                relocatereq = True
+                if not haspubdiv:
+                    # can't swap when public divergence, as public can't move
+                    divergent, other = swapnodes(divergent, other)
+                    resolutionparent = repo[otherp1].node()
+            elif divonly:
+                relocatereq = True
+            else:
+                # no extra cset on either side; so not considering relocation
+                pass
     elif otherp1 in gca and divp1 not in gca:
         relocatereq = True
         pass
     elif divp1 in gca and otherp1 not in gca:
         relocatereq = True
-        divergent, other = other, divergent
-        resolutionparent = divergent.p1().node()
+
+        # When public branch is behind to the mutable branch, for now we
+        # relocate mutable cset to public one's side in every case.
+        #
+        # This behaviour might be sub optimal when ancestors of mutable
+        # cset has changes its relocated descendant rely on.
+        #
+        # Otherwise, we are going to rebase the "behind" branch up to the new
+        # brancmap level.
+        if not haspubdiv:
+            divergent, other = swapnodes(divergent, other)
+            resolutionparent = divergent.p1().node()
     else:
         msg = _("skipping %s: have a different parent than %s "
                 "(not handled yet)\n") % (divergent, other)
@@ -499,8 +528,24 @@
 
     _mergecontentdivergents(repo, progresscb, divergent, other, base,
                             evolvestate)
-    return _completecontentdivergent(ui, repo, progresscb, divergent, other,
-                                     base, evolvestate)
+    res, newnode = _completecontentdivergent(ui, repo, progresscb, divergent,
+                                             other, base, evolvestate)
+    if not haspubdiv:
+        return (res, newnode)
+    else:
+        # when we have content-divergence with a public cset: after completing
+        # content divergence resolution the resulting node will be phase
+        # divergent with that same public cset.
+        # here newnode is phase divergent, lets resolve this divergence.
+        if not res:
+            # resolution was not successful, return
+            return (res, newnode)
+        if newnode == publicdiv.node():
+            # no changes were found that are different from public cset
+            return (res, newnode)
+        prec = publicdiv
+        bumped = repo[newnode]
+        return _resolvephasedivergent(ui, repo, prec=prec, bumped=bumped)
 
 def _mergecontentdivergents(repo, progresscb, divergent, other, base,
                             evolvestate):
@@ -513,12 +558,13 @@
                    (TROUBLES['CONTENTDIVERGENT'], other.hex()[:12]))
     if progresscb:
         progresscb()
+    mergeancestor = repo.changelog.isancestor(divergent.node(), other.node())
     stats = merge.update(repo,
                          other.node(),
                          branchmerge=True,
                          force=False,
                          ancestor=base.node(),
-                         mergeancestor=True)
+                         mergeancestor=mergeancestor)
     hg._showstats(repo, stats)
 
     # conflicts while merging content-divergent changesets
@@ -542,6 +588,31 @@
     # whether to store the obsmarker in the evolvestate
     storemarker = False
     resparent = evolvestate['resolutionparent']
+
+    # whether we are solving public divergence
+    haspubdiv = False
+    if evolvestate.get('public-divergent'):
+        haspubdiv = True
+        publicnode = evolvestate['public-divergent']
+        publicdiv = repo[publicnode]
+        othernode = evolvestate['other-divergent']
+        otherdiv = repo[othernode]
+
+        with repo.dirstate.parentchange():
+            repo.dirstate.setparents(publicnode, nodemod.nullid)
+            dirstatedance(repo, divergent, publicnode, None)
+        # check if node to be committed has changes same as public one
+        s = publicdiv.status()
+        if not (s.added or s.removed or s.deleted or s.modified):
+            # warn user if metadata is being lost
+            if otherdiv.description() != publicdiv.description():
+                msg = _('content-divergent changesets differ by descriptions '
+                        'only, discarding %s\n') % str(otherdiv)
+                repo.ui.warn(msg)
+            # no changes, create markers to resolve divergence
+            obsolete.createmarkers(repo, [(otherdiv, (publicdiv,))],
+                                   operation='evolve')
+            return (True, publicnode)
     try:
         with repo.dirstate.parentchange():
             repo.dirstate.setparents(resparent, nodemod.nullid)
@@ -560,7 +631,7 @@
 
         mergehook(repo, base, divergent, other)
 
-        newnode = repo.commit(text=desc, user=repo.ui.username())
+        newnode = repo.commit(text=desc, user=other.user())
         if newnode == divergent.node() or newnode is None:
             # no changes
             new = divergent
@@ -571,10 +642,17 @@
             new = repo[newnode]
             newnode = new.node()
             hg.updaterepo(repo, new.rev(), False)
-            obsolete.createmarkers(repo, [(divergent, (new,))], operation='evolve')
+            if haspubdiv and publicdiv == divergent:
+                bypassphase(repo, (divergent, new), operation='evolve')
+            else:
+                obsolete.createmarkers(repo, [(divergent, (new,))],
+                                       operation='evolve')
 
         # creating markers and moving phases post-resolution
-        obsolete.createmarkers(repo, [(other, (new,))], operation='evolve')
+        if haspubdiv and publicdiv == other:
+            bypassphase(repo, (other, new), operation='evolve')
+        else:
+            obsolete.createmarkers(repo, [(other, (new,))], operation='evolve')
         if storemarker:
             # storing the marker in the evolvestate
             # we just store the precursors and successor pair for now, we might
@@ -587,9 +665,53 @@
     finally:
         repo.ui.restoreconfig(emtpycommitallowed)
 
+def bypassphase(repo, relation, flag=0, metadata=None, operation='evolve'):
+    """function to create a single obsmarker relation even for public csets
+    where relation should be a single pair (prec, succ)"""
+
+    # prepare metadata
+    if metadata is None:
+        metadata = {}
+    if 'user' not in metadata:
+        luser = repo.ui.config('devel', 'user.obsmarker') or repo.ui.username()
+        metadata['user'] = encoding.fromlocal(luser)
+    # Operation metadata handling
+    useoperation = repo.ui.configbool('experimental',
+                                      'evolution.track-operation')
+    if useoperation and operation:
+        metadata['operation'] = operation
+
+    # Effect flag metadata handling
+    saveeffectflag = repo.ui.configbool('experimental',
+                                        'evolution.effect-flags')
+    with repo.transaction('add-obsolescence-marker') as tr:
+        prec, succ = relation
+        nprec = prec.node()
+        npare = None
+        nsucs = [succ.node()]
+        if not nsucs:
+            npare = tuple(p.node() for p in prec.parents())
+        if nprec in nsucs:
+            raise error.Abort(_("changeset %s cannot obsolete itself") % prec)
+
+        if saveeffectflag:
+            # The effect flag is saved in a versioned field name for
+            # future evolution
+            try:
+                effectflag = obsutil.geteffectflag(prec, (succ,))
+            except TypeError:
+                # hg <= 4.7
+                effectflag = obsutil.geteffectflag((prec, (succ,)))
+            metadata[obsutil.EFFECTFLAGFIELD] = "%d" % effectflag
+
+        # create markers
+        repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare,
+                             metadata=metadata, ui=repo.ui)
+        repo.filteredrevcache.clear()
+
 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
@@ -825,6 +947,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
@@ -896,7 +1019,7 @@
         # uurrgs
         # there no other topic setter yet
         if not orig.topic() and repo.vfs.exists('topic'):
-                repo.vfs.unlink('topic')
+            repo.vfs.unlink('topic')
         else:
             with repo.vfs.open('topic', 'w') as f:
                 f.write(orig.topic())
@@ -1297,10 +1420,12 @@
         compat.progress(ui, _('evolve'), None)
 
     if not shouldupdate:
+        # Move back to startnode, or to its successor if the start node is
+        # obsolete (perhaps made obsolete by the current `hg evolve`)
         unfi = repo.unfiltered()
         succ = utility._singlesuccessor(repo, unfi[startnode])
         hg.updaterepo(repo, repo[succ].node(), False)
-    if repo['.'] != startnode:
+    if repo['.'].node() != startnode:
         ui.status(_('working directory is now at %s\n') % repo['.'])
 
 def divergentsets(repo, ctx):
@@ -1455,7 +1580,7 @@
     contopt = opts['continue']
     anyopt = opts['any']
     allopt = opts['all']
-    startnode = repo['.']
+    startnode = repo['.'].node()
     dryrunopt = opts['dry_run']
     confirmopt = opts['confirm']
     revopt = opts['rev']
@@ -1473,12 +1598,13 @@
         return
 
     targetcat = 'orphan'
+    has_some_opts = bool(revopt or anyopt or allopt or contopt or stopopt or abortopt)
     if 1 < len(specifiedcategories):
         msg = _('cannot specify more than one trouble category to solve (yet)')
         raise error.Abort(msg)
     elif len(specifiedcategories) == 1:
         targetcat = specifiedcategories[0]
-    elif repo['.'].obsolete() and not(revopt or anyopt or allopt):
+    elif repo['.'].obsolete() and not has_some_opts:
         # if no args and parent is obsolete, update to successors
         return solveobswdp(ui, repo, opts)
 
@@ -1505,6 +1631,8 @@
             evolvestate.delete()
             return
         startnode = repo.unfiltered()[evolvestate['startnode']]
+        if 'update' in evolvestate:
+            shouldupdate = evolvestate['update']
         evolvestate.delete()
     elif stopopt:
         if not evolvestate:
@@ -1552,9 +1680,10 @@
         # cbor does not know how to serialize sets, using list for skippedrevs
         stateopts = {'category': targetcat, 'replacements': {},
                      'revs': list(revs), 'confirm': confirmopt,
-                     'startnode': startnode.node(), 'skippedrevs': [],
+                     'startnode': startnode, 'skippedrevs': [],
                      'command': 'evolve', 'orphanmerge': False,
-                     'bookmarkchanges': [], 'temprevs': [], 'obsmarkers': []}
+                     'bookmarkchanges': [], 'temprevs': [], 'obsmarkers': [],
+                     'update': shouldupdate}
         evolvestate.addopts(stateopts)
         # lastsolved: keep track of successor of last troubled cset we evolved
         # to confirm that if atop msg should be suppressed to remove redundancy
@@ -1599,8 +1728,9 @@
     _cleanup(ui, repo, startnode, showprogress, shouldupdate)
 
 def solveobswdp(ui, repo, opts):
+    """this function updates to the successor of obsolete wdir parent"""
     oldid = repo['.'].node()
-    startnode = repo['.']
+    startctx = repo['.']
     dryrunopt = opts.get('dry_run', False)
     displayer = compat.changesetdisplayer(ui, repo,
                                           {'template': shorttemplate})
@@ -1623,7 +1753,7 @@
     res = hg.update(repo, ctx.rev())
     newid = ctx.node()
 
-    if ctx != startnode:
+    if ctx != startctx:
         with repo.wlock(), repo.lock(), repo.transaction('evolve') as tr:
             bmupdater = rewriteutil.bookmarksupdater(repo, oldid, tr)
             bmupdater(newid)
@@ -1818,8 +1948,25 @@
                                         repo[other],
                                         repo[base],
                                         evolvestate)
-        evolvestate['replacements'][divergent] = ret[1]
+        origdivergent = evolvestate['orig-divergent']
+        evolvestate['replacements'][origdivergent] = ret[1]
+        # logic to continue the public content-divergent
+        publicnode = evolvestate.get('public-divergent')
+        if publicnode:
+            res, newnode = ret
+            if not res:
+                # no need to proceed for phase divergence resolution step
+                pass
+            elif newnode == publicnode:
+                # merging had the same changes as public changeset and
+                # divergence has been resolved by creating markers
+                pass
+            else:
+                prec = repo[publicnode]
+                bumped = repo[newnode]
+                ret = _resolvephasedivergent(ui, repo, prec=prec, bumped=bumped)
         tr.close()
+        return ret
     finally:
         tr.release()
 
@@ -1843,7 +1990,7 @@
 
         # now continuing the phase-divergence resolution part
         prec = repo[evolvestate['precursor']]
-        retvalue = _resolvephasedivergent(ui, repo, prec, ctx, newctx)
+        retvalue = _resolvephasedivergent(ui, repo, prec, newctx)
         evolvestate['replacements'][ctx.node()] = retvalue[1]
         tr.close()
     finally:
--- a/hgext3rd/evolve/firstmergecache.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/firstmergecache.py	Thu Apr 11 22:41:25 2019 +0200
@@ -115,8 +115,7 @@
         """load data from disk"""
         assert repo.filtername is None
 
-        cachevfs = compat.getcachevfs(repo)
-        data = cachevfs.tryread(self._filepath)
+        data = repo.cachevfs.tryread(self._filepath)
         self._data = array.array('l')
         if not data:
             self._cachekey = self.emptykey
@@ -136,8 +135,7 @@
             return
 
         try:
-            cachevfs = compat.getcachevfs(repo)
-            cachefile = cachevfs(self._filepath, 'w', atomictemp=True)
+            cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
             headerdata = self._serializecachekey()
             cachefile.write(headerdata)
             cachefile.write(self._data.tostring())
--- a/hgext3rd/evolve/metadata.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/metadata.py	Thu Apr 11 22:41:25 2019 +0200
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-__version__ = '8.4.0.dev'
+__version__ = '8.5.0.dev'
 testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8 4.9'
 minimumhgversion = '4.4'
 buglink = 'https://bz.mercurial-scm.org/'
--- a/hgext3rd/evolve/obscache.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/obscache.py	Thu Apr 11 22:41:25 2019 +0200
@@ -20,7 +20,6 @@
 )
 
 from . import (
-    compat,
     exthelper,
 )
 
@@ -323,7 +322,6 @@
     def __init__(self, repo):
         super(obscache, self).__init__()
         self._ondiskkey = None
-        self._vfs = compat.getcachevfs(repo)
 
     @util.propertycache
     def get(self):
@@ -405,7 +403,7 @@
             return
 
         try:
-            cachefile = self._vfs(self._filepath, 'w', atomictemp=True)
+            cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
             headerdata = struct.pack(self._headerformat, *self._cachekey)
             cachefile.write(headerdata)
             cachefile.write(self._data)
@@ -419,7 +417,7 @@
         """load data from disk"""
         assert repo.filtername is None
 
-        data = self._vfs.tryread(self._filepath)
+        data = repo.cachevfs.tryread(self._filepath)
         if not data:
             self._cachekey = self.emptykey
             self._setdata(bytearray())
--- a/hgext3rd/evolve/obsdiscovery.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Apr 11 22:41:25 2019 +0200
@@ -15,13 +15,6 @@
 
 from __future__ import absolute_import
 
-try:
-    import StringIO as io
-    StringIO = io.StringIO
-except ImportError:
-    import io
-    StringIO = io.StringIO
-
 import hashlib
 import heapq
 import inspect
@@ -95,9 +88,15 @@
     common = set()
     undecided = set(probeset)
     totalnb = len(undecided)
+    heads = [rev for rev in cl.headrevs() if rev != node.nullrev]
     compat.progress(ui, _("comparing with other"), 0, total=totalnb,
                     unit=_("changesets"))
-    _takefullsample = setdiscovery._takefullsample
+    if util.safehasattr(setdiscovery, '_takefullsample'):
+        # hg compat <= hg-4.9 (e5ece0f46b40)
+        _takefullsample = setdiscovery._takefullsample
+    else:
+        obsdiscov = setdiscovery.partialdiscovery(local, heads)
+        _takefullsample = obsdiscov.takefullsample
     if remote.capable('_evoext_obshash_1'):
         getremotehash = remote.evoext_obshash1
         localhash = _obsrelsethashtreefm1(local)
@@ -111,13 +110,18 @@
         if len(undecided) < fullsamplesize:
             sample = set(undecided)
         else:
-            # Mercurial 4.8 changed calling convention.
-            if len(inspect.getargspec(_takefullsample)[0]) == 4:
-                sample = _takefullsample(local, None, undecided,
-                                         size=fullsamplesize)
+            if util.safehasattr(setdiscovery, '_takefullsample'):
+                # compat <= hg-4.9 (e5ece0f46b40)
+                if len(inspect.getargspec(_takefullsample)[0]) == 4:
+                    # Mercurial 4.8 changed calling convention.
+                    sample = _takefullsample(local, None, undecided,
+                                             size=fullsamplesize)
+                else:
+                    # hg <= 4.7 version
+                    sample = _takefullsample(dag, undecided,
+                                             size=fullsamplesize)
             else:
-                # hg <= 4.7 version
-                sample = _takefullsample(dag, undecided, size=fullsamplesize)
+                sample = _takefullsample(None, size=fullsamplesize)
 
         roundtrips += 1
         compat.progress(ui, _("comparing with other"), totalnb - len(undecided),
@@ -412,12 +416,12 @@
     _schemaversion = 3
 
     _cachename = 'evo-ext-obshashrange' # used for error message
-    _filename = 'cache/evoext_obshashrange_v2.sqlite'
+    _filename = 'evoext_obshashrange_v2.sqlite'
 
     def __init__(self, repo):
         super(_obshashcache, self).__init__()
         self._vfs = repo.vfs
-        self._path = repo.vfs.join(self._filename)
+        self._path = repo.cachevfs.join(self._filename)
         self._new = set()
         self._valid = True
         self._repo = weakref.ref(repo.unfiltered())
--- a/hgext3rd/evolve/obsexchange.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/obsexchange.py	Thu Apr 11 22:41:25 2019 +0200
@@ -8,11 +8,9 @@
 from __future__ import absolute_import
 
 try:
-    import StringIO as io
-    StringIO = io.StringIO
+    from StringIO import StringIO
 except ImportError:
-    import io
-    StringIO = io.StringIO
+    from io import StringIO
 
 from mercurial import (
     bundle2,
--- a/hgext3rd/evolve/obshistory.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/obshistory.py	Thu Apr 11 22:41:25 2019 +0200
@@ -601,8 +601,7 @@
             matchfn = scmutil.matchall(repo)
             firstline = True
             for chunk, label in patch.diffui(repo, node, succ, matchfn,
-                                             changes=None, opts=diffopts,
-                                             prefix='', relroot=''):
+                                             opts=diffopts):
                 if firstline:
                     fm.plain('\n')
                     firstline = False
@@ -738,8 +737,7 @@
             matchfn = scmutil.matchall(repo)
             firstline = True
             for chunk, label in patch.diffui(repo, node, succ, matchfn,
-                                             changes=None, opts=diffopts,
-                                             prefix='', relroot=''):
+                                             opts=diffopts):
                 if firstline:
                     fm.plain('\n')
                     firstline = False
@@ -782,46 +780,6 @@
 
     return True
 
-def geteffectflag(relation):
-    """compute the effect flag by comparing the source and destination"""
-    effects = 0
-
-    source = relation[0]
-
-    for changectx in relation[1]:
-        # Check if description has changed
-        if changectx.description() != source.description():
-            effects |= DESCCHANGED
-
-        # Check if known meta has changed
-        if changectx.user() != source.user():
-            effects |= USERCHANGED
-
-        if changectx.date() != source.date():
-            effects |= DATECHANGED
-
-        if changectx.branch() != source.branch():
-            effects |= BRANCHCHANGED
-
-        # Check if other meta has changed
-        changeextra = changectx.extra().items()
-        ctxmeta = filter(ismetablacklisted, changeextra)
-
-        sourceextra = source.extra().items()
-        srcmeta = filter(ismetablacklisted, sourceextra)
-
-        if ctxmeta != srcmeta:
-            effects |= METACHANGED
-
-        # Check if at least one of the parent has changes
-        if changectx.parents() != source.parents():
-            effects |= PARENTCHANGED
-
-        if not _cmpdiff(source, changectx):
-            effects |= DIFFCHANGED
-
-    return effects
-
 def _prepare_hunk(hunk):
     """Drop all information but the username and patch"""
     cleanunk = []
@@ -840,28 +798,6 @@
         return None
     return _prepare_hunk(lines)
 
-def _cmpdiff(leftctx, rightctx):
-    """return True if both ctx introduce the "same diff"
-
-    This is a first and basic implementation, with many shortcoming.
-    """
-
-    # Leftctx or right ctx might be filtered, so we need to use the contexts
-    # with an unfiltered repository to safely compute the diff
-    leftunfi = leftctx._repo.unfiltered()[leftctx.rev()]
-    leftdiff = leftunfi.diff(git=1)
-    rightunfi = rightctx._repo.unfiltered()[rightctx.rev()]
-    rightdiff = rightunfi.diff(git=1)
-
-    left, right = (0, 0)
-    while None not in (left, right):
-        left = _getdifflines(leftdiff)
-        right = _getdifflines(rightdiff)
-
-        if left != right:
-            return False
-    return True
-
 def _getobsfate(successorssets):
     """ Compute a changeset obsolescence fate based on his successorssets.
     Successors can be the tipmost ones or the immediate ones.
--- a/hgext3rd/evolve/stablerangecache.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/stablerangecache.py	Thu Apr 11 22:41:25 2019 +0200
@@ -176,7 +176,7 @@
     def __init__(self, repo, **kwargs):
         super(stablerangesqlbase, self).__init__(**kwargs)
         self._vfs = repo.vfs
-        self._path = repo.vfs.join(self._cachefile)
+        self._path = repo.cachevfs.join(self._cachefile)
         self._cl = repo.unfiltered().changelog # (okay to keep an old one)
         self._ondisktiprev = None
         self._ondisktipnode = None
@@ -390,13 +390,13 @@
 class mergepointsql(stablerangesql, stablerange.stablerange_mergepoint):
 
     _schemaversion = 3
-    _cachefile = 'cache/evoext_stablerange_v2.sqlite'
+    _cachefile = 'evoext_stablerange_v2.sqlite'
     _cachename = 'evo-ext-stablerange-mergepoint'
 
 class sqlstablerange(stablerangesqlbase, stablerange.stablerange):
 
     _schemaversion = 1
-    _cachefile = 'cache/evoext_stablerange_v1.sqlite'
+    _cachefile = 'evoext_stablerange_v1.sqlite'
 
     def warmup(self, repo, upto=None):
         self._con # make sure the data base is loaded
--- a/hgext3rd/evolve/stablesort.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/stablesort.py	Thu Apr 11 22:41:25 2019 +0200
@@ -608,8 +608,7 @@
         """
         assert repo.filtername is None
 
-        cachevfs = compat.getcachevfs(repo)
-        data = cachevfs.tryread(self._filepath)
+        data = repo.cachevfs.tryread(self._filepath)
         self._index = array.array('l')
         self._data = array.array('l')
         if not data:
@@ -635,8 +634,7 @@
         if self._cachekey is None or self._cachekey == self._ondiskkey:
             return
         try:
-            cachevfs = compat.getcachevfs(repo)
-            cachefile = cachevfs(self._filepath, 'w', atomictemp=True)
+            cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
 
             # data to write
             headerdata = self._serializecachekey()
--- a/hgext3rd/evolve/state.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/state.py	Thu Apr 11 22:41:25 2019 +0200
@@ -45,6 +45,9 @@
     def __nonzero__(self):
         return self.exists()
 
+    def __contains__(self, key):
+        return key in self.opts
+
     def __getitem__(self, key):
         return self.opts[key]
 
--- a/hgext3rd/evolve/utility.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/evolve/utility.py	Thu Apr 11 22:41:25 2019 +0200
@@ -164,7 +164,7 @@
     promptmsg = customheader + "\n"
     for idx, rev in enumerate(revs):
         curctx = repo[rev]
-        revmsg = "%d: [%s] %s\n" % (idx, curctx,
+        revmsg = "%d: [%s] %s\n" % (idx + 1, curctx,
                                     curctx.description().split("\n")[0])
         promptmsg += revmsg
 
@@ -181,9 +181,9 @@
         ui.write_err(_("invalid value '%s' entered for index\n") % idxselected)
         return None
 
-    if intidx >= len(revs) or intidx < 0:
+    if intidx > len(revs) or intidx <= 0:
         # we can make this error message better
         ui.write_err(_("invalid value '%d' entered for index\n") % intidx)
         return None
 
-    return revs[intidx]
+    return revs[intidx - 1]
--- a/hgext3rd/serverminitopic.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/serverminitopic.py	Thu Apr 11 22:41:25 2019 +0200
@@ -1,5 +1,8 @@
 """enable a minimal verison of topic for server
 
+! This extensions is not actively maintained
+! We recommand using the main topic extension instead
+
 Non publishing repository will see topic as "branch:topic" in the branch field.
 
 In addition to adding the extensions, the feature must be manually enabled in the config:
@@ -143,6 +146,10 @@
     return hasminitopic(repo) and repo.filtername not in _publiconly
 
 class _topiccache(branchmap.branchcache): # combine me with branchmap.branchcache
+    @classmethod
+    def fromfile(cls, repo):
+        orig = super(_topiccache, cls).fromfile
+        return wrapread(orig, repo)
 
     def __init__(self, *args, **kwargs):
         # super() call may fail otherwise
@@ -223,6 +230,12 @@
 
 def uisetup(ui):
     wrapclass(branchmap, 'branchcache', _topiccache)
-    extensions.wrapfunction(branchmap, 'read', wrapread)
+    try:
+        # Mercurial 4.8 and older
+        extensions.wrapfunction(branchmap, 'read', wrapread)
+    except AttributeError:
+        # Mercurial 4.9; branchcache.fromfile now takes care of this
+        # which is alredy defined on _topiccache
+        pass
     extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps)
     extensions.wrapfunction(context.changectx, 'branch', topicbranch)
--- a/hgext3rd/topic/__init__.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/topic/__init__.py	Thu Apr 11 22:41:25 2019 +0200
@@ -167,7 +167,9 @@
               'topic.stack.state.current': 'cyan bold',  # random pick
               'topic.stack.desc.current': 'cyan',        # random pick
               'topic.stack.shortnode.current': 'cyan',   # random pick
-              'topic.stack.state.unstable': 'red',
+              'topic.stack.state.orphan': 'red',
+              'topic.stack.state.content-divergent': 'red',
+              'topic.stack.state.phase-divergent': 'red',
               'topic.stack.summary.behindcount': 'cyan',
               'topic.stack.summary.behinderror': 'red',
               'topic.stack.summary.headcount.multiple': 'yellow',
@@ -177,9 +179,9 @@
               'topic.active': 'green',
              }
 
-__version__ = '0.13.0.dev'
+__version__ = '0.14.0.dev'
 
-testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8'
+testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8 4.9'
 minimumhgversion = '4.4'
 buglink = 'https://bz.mercurial-scm.org/'
 
--- a/hgext3rd/topic/revset.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/topic/revset.py	Thu Apr 11 22:41:25 2019 +0200
@@ -108,7 +108,7 @@
     return revset.baseset(stack.stack(repo, branch=branch, topic=topic)[1:]) & subset
 
 if util.safehasattr(revset, 'subscriptrelations'):
-    def stackrel(repo, subset, x, rel, n, order):
+    def stackrel(repo, subset, x, rel, z, order):
         """This is a revset-flavored implementation of stack aliases.
 
         The syntax is: rev#stack[n] or rev#s[n]. Plenty of logic is borrowed
@@ -116,9 +116,25 @@
         (e.g. when stack index is too high), this returns empty set to be more
         revset-friendly.
         """
+        # hg 4.9 provides a number or None, hg 5.0 provides a tuple of tokens
+        if isinstance(z, tuple):
+            a, b = revset.getintrange(
+                z,
+                'relation subscript must be an integer or a range',
+                'relation subscript bounds must be integers',
+                None, None)
+        else:
+            a = b = z
+
         s = revset.getset(repo, revset.fullreposet(repo), x)
         if not s:
             return revset.baseset()
+
+        def getrange(st, a, b):
+            start = 1 if a is None else a
+            end = len(st.revs) if b is None else b + 1
+            return range(start, end)
+
         revs = []
         for r in s:
             topic = repo[r].topic()
@@ -126,32 +142,29 @@
                 st = stack.stack(repo, topic=topic)
             else:
                 st = stack.stack(repo, branch=repo[r].branch())
-            if n < 0:
-                st = list(st)[1:]
-            else:
-                st = list(st)
-            try:
-                rev = st[n]
-            except IndexError:
-                continue
-            if rev == -1 and n == 0:
-                continue
-            if rev not in revs:
-                revs.append(rev)
+            for n in getrange(st, a, b):
+                if abs(n) >= len(st.revs):
+                    # also means stack base is not accessible with n < 0, which
+                    # is by design
+                    continue
+                if n == 0 and b != 0 and a != 0:
+                    # quirk: we don't want stack base unless specifically asked
+                    # for it (at least one of the indices is 0)
+                    continue
+                rev = st.revs[n]
+                if rev == -1 and n == 0:
+                    continue
+                if rev not in revs:
+                    revs.append(rev)
+
         return subset & revset.baseset(revs)
 
     revset.subscriptrelations['stack'] = stackrel
     revset.subscriptrelations['s'] = stackrel
 
-    def topicrel(repo, subset, x, rel, n, order):
-        ancestors = revset._ancestors
-        descendants = revset._descendants
-        subset = topicset(repo, subset, x)
-        if n <= 0:
-            n = -n
-            return ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1)
-        else:
-            return descendants(repo, subset, x, startdepth=n, stopdepth=n + 1)
+    def topicrel(repo, subset, x, *args):
+        subset &= topicset(repo, subset, x)
+        return revset.generationsrel(repo, subset, x, *args)
 
     revset.subscriptrelations['topic'] = topicrel
     revset.subscriptrelations['t'] = topicrel
--- a/hgext3rd/topic/stack.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/topic/stack.py	Thu Apr 11 22:41:25 2019 +0200
@@ -5,7 +5,6 @@
 from mercurial.i18n import _
 from mercurial import (
     destutil,
-    context,
     error,
     node,
     phases,
@@ -20,14 +19,6 @@
 
 short = node.short
 
-# TODO: compat
-
-if not util.safehasattr(context.basectx, 'orphan'):
-    context.basectx.orphan = context.basectx.unstable
-
-if not util.safehasattr(context.basectx, 'isunstable'):
-    context.basectx.isunstable = context.basectx.troubled
-
 def parseusername(user):
     """parses the ctx user and returns the username without email ID if
     possible, otherwise returns the mail address from that"""
@@ -51,16 +42,11 @@
     The intend is to build something more efficient than what revsets do in
     this area.
     """
-    phasecache = repo._phasecache
-    if not phasecache._phasesets:
-        return repo.revs('(not public()) - obsolete()')
-    if any(s is None for s in phasecache._phasesets):
+    phasesets = repo._phasecache._phasesets
+    if not phasesets or None in phasesets[phases.draft:]:
         return repo.revs('(not public()) - obsolete()')
 
-    result = set()
-    for s in phasecache._phasesets[phases.draft:]:
-        result |= s
-
+    result = set.union(*phasesets[phases.draft:])
     result -= obsolete.getrevs(repo, 'obsolete')
     return result
 
@@ -228,7 +214,7 @@
     """ Takes a label prefix and a list of suffixes. Returns a string of the prefix
     formatted with each suffix separated with a space.
     """
-    return ' '.join(prefix % suffix for suffix in labelssuffix)
+    return ' '.join(prefix % suffix.replace(' ', '-') for suffix in labelssuffix)
 
 def showstack(ui, repo, branch=None, topic=None, opts=None):
     if opts is None:
@@ -293,7 +279,8 @@
     if empty:
         fm.plain(_("(stack is empty)\n"))
 
-    for idx, r in enumerate(stack(repo, branch=branch, topic=topic), 0):
+    st = stack(repo, branch=branch, topic=topic)
+    for idx, r in enumerate(st, 0):
         ctx = repo[r]
         # special case for t0, b0 as it's hard to plugin into rest of the logic
         if idx == 0:
@@ -329,32 +316,28 @@
 
         symbol = None
         states = []
-        msg = ''
-        iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
         if opts.get('children'):
-            if branch:
-                t_msg = '-branch("%s")' % branch
-            if topic:
-                t_msg = '-topic("%s")' % topic
-            rev_msg = 'children(%s) and merge() %s'
-            revisions = repo.revs(rev_msg % (ctx.rev(), t_msg))
-            len_rev = len(revisions)
-            if len_rev > 0:
-                msg = 'external-children'
-
-        if iscurrentrevision:
-            symbol = '@'
-            if msg:
-                states.append('current - ' + msg)
-            else:
-                states.append('current')
+            expr = 'children(%d) and merge() - %ld'
+            revisions = repo.revs(expr, ctx.rev(), st.revs[1:])
+            if len(revisions) > 0:
+                states.append('external-children')
 
         if ctx.orphan():
             symbol = '$'
-            if msg:
-                states.append('unstable - ' + msg)
-            else:
-                states.append('unstable')
+            states.append('orphan')
+
+        if ctx.contentdivergent():
+            symbol = '$'
+            states.append('content divergent')
+
+        if ctx.phasedivergent():
+            symbol = '$'
+            states.append('phase divergent')
+
+        iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
+        if iscurrentrevision:
+            symbol = '@'
+            states.append('current')
 
         if not isentry:
             symbol = '^'
@@ -364,10 +347,9 @@
         # none of the above if statments get executed
         if not symbol:
             symbol = ':'
-            if msg:
-                states.append(msg)
-            else:
-                states.append('clean')
+
+        if not states:
+            states.append('clean')
 
         states.sort()
 
--- a/hgext3rd/topic/topicmap.py	Tue Jan 22 12:54:41 2019 -0500
+++ b/hgext3rd/topic/topicmap.py	Thu Apr 11 22:41:25 2019 +0200
@@ -9,6 +9,7 @@
     cmdutil,
     extensions,
     repoview,
+    util,
 )
 
 basefilter = set(['base', 'immutable'])
@@ -117,7 +118,21 @@
     class topiccache(_topiccache, branchmap.branchcache):
         pass
     branchmap.branchcache = topiccache
-    extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
+
+    try:
+        # Mercurial 4.9
+        class remotetopiccache(_topiccache, branchmap.remotebranchcache):
+            pass
+        branchmap.remotebranchcache = remotetopiccache
+
+        def _wrapupdatebmcachemethod(orig, self, repo):
+            # pass in the bound method as the original
+            return _wrapupdatebmcache(orig.__get__(self), repo)
+        extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod)
+    except AttributeError:
+        # Mercurial 4.8 and before
+        extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
+
 
 def _wrapupdatebmcache(orig, repo):
     previous = getattr(repo, '_autobranchmaptopic', False)
@@ -150,8 +165,13 @@
 
     def copy(self):
         """return an deep copy of the branchcache object"""
-        new = self.__class__(self, self.tipnode, self.tiprev, self.filteredhash,
-                             self._closednodes)
+        if util.safehasattr(self, '_entries'):
+            _entries = self._entries
+        else:
+            # hg <= 4.9 (624d6683c705, b137a6793c51)
+            _entries = self
+        new = self.__class__(_entries, self.tipnode, self.tiprev,
+                             self.filteredhash, self._closednodes)
         new.phaseshash = self.phaseshash
         return new
 
--- a/tests/test-discovery-obshashrange.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-discovery-obshashrange.t	Thu Apr 11 22:41:25 2019 +0200
@@ -1158,3 +1158,64 @@
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/c8d03c1b5e94-b257442b-backup.hg
   $ f -s .hg/cache/evoext*
   .hg/cache/evoext-obscache-00: size=70
+  $ cd ..
+
+Check capabilities advertisement
+================================
+
+  $ hg init with-evolve
+  $ cat << EOF >> with-evolve/.hg/hgrc
+  > [experimental]
+  > evolution.exchange=yes
+  > EOF
+  $ hg init without-evolve
+  $ cat << EOF >> without-evolve/.hg/hgrc
+  > [experimental]
+  > evolution.exchange=no
+  > EOF
+
+  $ hg debugcapabilities ssh://user@dummy/with-evolve | grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities ssh://user@dummy/without-evolve | grep _evoext
+  [1]
+
+Using http:
+
+  $ cat > web.conf << EOF
+  > [paths]
+  > / = *
+  > EOF
+
+(evolve version first)
+
+  $ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg debugcapabilities http://localhost:$HGPORT/with-evolve| grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://localhost:$HGPORT/without-evolve| grep _evoext
+  [1]
+
+  $ killdaemons.py
+
+
+(evolve version second)
+
+  $ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg debugcapabilities http://localhost:$HGPORT/without-evolve| grep _evoext
+  [1]
+  $ hg debugcapabilities http://localhost:$HGPORT/with-evolve| grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+
+  $ killdaemons.py
--- a/tests/test-divergent.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-Tests the resolution of divergence
-
-  $ cat >> $HGRCPATH <<EOF
-  > [defaults]
-  > amend=-d "0 0"
-  > fold=-d "0 0"
-  > [web]
-  > push_ssl = false
-  > allow_push = *
-  > [phases]
-  > publish = False
-  > [diff]
-  > git = 1
-  > unified = 0
-  > [ui]
-  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-  $ mkcommit() {
-  >    echo "$1" > "$1"
-  >    hg add "$1"
-  >    hg ci -m "add $1"
-  > }
-
-  $ mkcommits() {
-  >   for i in $@; do mkcommit $i ; done
-  > }
-
-Basic test of divergence: two divergent changesets with the same parents
-With --all --any we dedupe the divergent and solve the divergence once
-
-  $ hg init test1
-  $ cd test1
-  $ echo a > a
-  $ hg ci -Aqm "added a"
-  $ echo b > b
-  $ hg ci -Aqm "added b"
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bdivergent > bdivergent1
-  $ hg ci -Am "divergent"
-  adding bdivergent1
-  created new head
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bdivergent > bdivergent2
-  $ hg ci -Am "divergent"
-  adding bdivergent2
-  created new head
-
-  $ hg prune -s 8374d2ddc3a4 "desc('added b')"
-  1 changesets pruned
-  $ hg prune -s 593c57f2117e "desc('added b')" --hidden
-  1 changesets pruned
-  2 new content-divergent changesets
-
-  $ hg log -G
-  @  3:8374d2ddc3a4@default(draft) divergent [content-divergent]
-  |
-  | *  2:593c57f2117e@default(draft) divergent [content-divergent]
-  |/
-  o  0:9092f1db7931@default(draft) added a []
-  
-
-  $ hg evolve --all --any --content-divergent
-  merge:[2] divergent
-  with: [3] divergent
-  base: [1] added b
-  updating to "local" side of the conflict: 593c57f2117e
-  merging "other" content-divergent changeset '8374d2ddc3a4'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 45bf1312f454
-  $ hg log -G
-  @  4:45bf1312f454@default(draft) divergent []
-  |
-  o  0:9092f1db7931@default(draft) added a []
-  
-Test divergence resolution when it yields to an empty commit (issue4950)
-cdivergent2 contains the same content than cdivergent1 and they are divergent
-versions of the revision _c
-
-  $ hg up .^
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ mkcommit _c
-  created new head
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ mkcommit cdivergent1
-  created new head
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo "cdivergent1" > cdivergent1
-  $ hg add cdivergent1
-  $ hg ci -m "add _c"
-  created new head
-
-  $ hg log -G
-  @  7:b2ae71172042@default(draft) add _c []
-  |
-  | o  6:e3ff64ce8d4c@default(draft) add cdivergent1 []
-  |/
-  | o  5:48819a835615@default(draft) add _c []
-  |/
-  | o  4:45bf1312f454@default(draft) divergent []
-  |/
-  o  0:9092f1db7931@default(draft) added a []
-  
-
-  $ hg prune -s b2ae71172042 48819a835615
-  1 changesets pruned
-  $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden
-  1 changesets pruned
-  2 new content-divergent changesets
-
-  $ hg log -G
-  @  7:b2ae71172042@default(draft) add _c [content-divergent]
-  |
-  | *  6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
-  |/
-  | o  4:45bf1312f454@default(draft) divergent []
-  |/
-  o  0:9092f1db7931@default(draft) added a []
-  
-  $ hg evolve --all --any --content-divergent
-  merge:[6] add cdivergent1
-  with: [7] add _c
-  base: [5] add _c
-  updating to "local" side of the conflict: e3ff64ce8d4c
-  merging "other" content-divergent changeset 'b2ae71172042'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  nothing changed
-  working directory is now at e3ff64ce8d4c
-
-  $ cd ..
-
-Test None docstring issue of evolve divergent, which caused hg crush
-
-  $ hg init test2
-  $ cd test2
-  $ mkcommits _a _b
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bdivergent > bdivergent11
-  $ hg ci -Am "bdivergent"
-  adding bdivergent11
-  created new head
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bdivergent > bdivergent22
-  $ hg ci -Am "bdivergent"
-  adding bdivergent22
-  created new head
-
-  $ hg log -G
-  @  3:6b096fb45070@default(draft) bdivergent []
-  |
-  | o  2:05a6b6a9e633@default(draft) bdivergent []
-  |/
-  | o  1:37445b16603b@default(draft) add _b []
-  |/
-  o  0:135f39f4bd78@default(draft) add _a []
-  
-
-  $ hg prune -s 6b096fb45070 37445b16603b
-  1 changesets pruned
-  $ hg prune -s 05a6b6a9e633 37445b16603b --hidden
-  1 changesets pruned
-  2 new content-divergent changesets
-  $ hg log -G
-  @  3:6b096fb45070@default(draft) bdivergent [content-divergent]
-  |
-  | *  2:05a6b6a9e633@default(draft) bdivergent [content-divergent]
-  |/
-  o  0:135f39f4bd78@default(draft) add _a []
-  
-
-  $ cat >$TESTTMP/test_extension.py  << EOF
-  > from mercurial import merge
-  > origupdate = merge.update
-  > def newupdate(*args, **kwargs):
-  >   return origupdate(*args, **kwargs)
-  > merge.update = newupdate
-  > EOF
-  $ cat >> $HGRCPATH << EOF
-  > [extensions]
-  > testextension=$TESTTMP/test_extension.py
-  > EOF
-  $ hg evolve --all
-  nothing to evolve on current working copy parent
-  (do you want to use --content-divergent)
-  [2]
-  $ hg evolve --content-divergent
-  merge:[3] bdivergent
-  with: [2] bdivergent
-  base: [1] add _b
-  merging "other" content-divergent changeset '05a6b6a9e633'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 73ff357d3975
-
-  $ cd ..
--- a/tests/test-evolve-abort-contentdiv.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,376 +0,0 @@
-Tests for the --abort flag for `hg evolve` command while content-divergence resolution
-======================================================================================
-
-The `--abort` flag aborts the interuppted evolve by undoing all the work which
-was done during resolution i.e. stripping new changesets created, moving
-bookmarks back, moving working directory back.
-
-This test contains cases when `hg evolve` is doing content-divergence resolution.
-
-Setup
-=====
-
-  $ cat >> $HGRCPATH <<EOF
-  > [phases]
-  > publish = False
-  > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ hg init abortrepo
-  $ cd abortrepo
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Creating content divergence, resolution of which will lead to conflicts
------------------------------------------------------------------------
-
-  $ echo bar > d
-  $ hg amend
-
-  $ hg up c41c793e0ef1 --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset c41c793e0ef1
-  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
-  working directory parent is obsolete! (c41c793e0ef1)
-  (use 'hg evolve' to update to its successor: e49523854bc8)
-
-  $ echo foobar > d
-  $ hg amend
-  2 new content-divergent changesets
-  $ hg glog --hidden
-  @  6:9c1631e352d9 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  |/    () draft
-  | x  4:c41c793e0ef1 added d
-  |/    () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[6] added d
-  with: [5] added d
-  base: [4] added d
-  merging "other" content-divergent changeset 'e49523854bc8'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg status -v
-  M d
-  # The repository is in an unfinished *evolve* state.
-  
-  # Unresolved merge conflicts:
-  # 
-  #     d
-  # 
-  # To mark files as resolved:  hg resolve --mark FILE
-  
-  # To continue:    hg evolve --continue
-  # To abort:       hg evolve --abort
-  # 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
-  working directory is now at 9c1631e352d9
-
-  $ hg glog --hidden
-  @  6:9c1631e352d9 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  |/    () draft
-  | x  4:c41c793e0ef1 added d
-  |/    () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Creating multiple content-divergence where resolution of last one results in
-conflicts and resolution of first one resulted in no new commit
------------------------------------------------------------------------------
-
-  $ echo watbar > d
-  $ hg amend
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bar > c
-  $ hg amend
-  2 new orphan changesets
-  $ hg up ca1b80f7960a --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (ca1b80f7960a)
-  (use 'hg evolve' to update to its successor: 2ba73e31f264)
-  $ echo foobar > c
-  $ hg amend
-  2 new content-divergent changesets
-  $ echo bar > c
-  $ hg amend
-
-  $ hg glog --hidden
-  @  10:491e10505bae added c
-  |   () draft
-  | x  9:7398f702a162 added c
-  |/    () draft
-  | *  8:2ba73e31f264 added c
-  |/    () draft
-  | *  7:f0f1694f123e added d
-  | |   () draft
-  | | x  6:9c1631e352d9 added d
-  | |/    () draft
-  | | *  5:e49523854bc8 added d
-  | |/    () draft
-  | | x  4:c41c793e0ef1 added d
-  | |/    () draft
-  | x  3:ca1b80f7960a added c
-  |/    () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --all --content-divergent
-  merge:[8] added c
-  with: [10] added c
-  base: [3] added c
-  updating to "local" side of the conflict: 2ba73e31f264
-  merging "other" content-divergent changeset '491e10505bae'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  merge:[5] added d
-  with: [7] added d
-  base: [4] added d
-  updating to "local" side of the conflict: e49523854bc8
-  merging "other" content-divergent changeset 'f0f1694f123e'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg evolve --abort
-  2 new content-divergent changesets
-  evolve aborted
-  working directory is now at 491e10505bae
-
-  $ hg glog --hidden
-  @  10:491e10505bae added c
-  |   () draft
-  | x  9:7398f702a162 added c
-  |/    () draft
-  | *  8:2ba73e31f264 added c
-  |/    () draft
-  | *  7:f0f1694f123e added d
-  | |   () draft
-  | | x  6:9c1631e352d9 added d
-  | |/    () draft
-  | | *  5:e49523854bc8 added d
-  | |/    () draft
-  | | x  4:c41c793e0ef1 added d
-  | |/    () draft
-  | x  3:ca1b80f7960a added c
-  |/    () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg obslog -r . --all
-  *  2ba73e31f264 (8) added c
-  |
-  | @  491e10505bae (10) added c
-  | |
-  | x  7398f702a162 (9) added c
-  |/     rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-  |
-  x  ca1b80f7960a (3) added c
-       rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-       rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-  
-  $ cd ..
-
-Creating content-divergence on multiple parents when gca of divergent changesets
-is parent of one of the divergents and relocating leads to conflicts
----------------------------------------------------------------------------------
-
-  $ hg init multiparent
-  $ cd multiparent
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg rebase -r . -d .^^^ --config extensions.rebase=
-  rebasing 4:c41c793e0ef1 "added d" (tip)
-  $ echo bar > c
-  $ hg add c
-  $ hg amend
-
-  $ hg up --hidden c41c793e0ef1
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset c41c793e0ef1
-  (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
-  working directory parent is obsolete! (c41c793e0ef1)
-  (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
-  $ echo bar > d
-  $ hg amend
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  7:e49523854bc8 added d
-  |   () draft
-  | *  6:69bdd23a9b0d added d
-  | |   () draft
-  o |  3:ca1b80f7960a added c
-  | |   () draft
-  o |  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[7] added d
-  with: [6] added d
-  base: [4] added d
-  rebasing "other" content-divergent changeset 69bdd23a9b0d on ca1b80f7960a
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg evolve --abort
-  evolve aborted
-  working directory is now at e49523854bc8
-
-  $ hg glog
-  @  7:e49523854bc8 added d
-  |   () draft
-  | *  6:69bdd23a9b0d added d
-  | |   () draft
-  o |  3:ca1b80f7960a added c
-  | |   () draft
-  o |  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Creating content-divergence on multiple parents when gca of divergent changesets
-is parent of one of the divergents and merging divergent leads to conflicts
----------------------------------------------------------------------------------
-
-  $ hg up 69bdd23a9b0d
-  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg rm c
-  $ echo wat > d
-  $ hg amend
-
-  $ hg glog
-  @  8:33e4442acf98 added d
-  |   () draft
-  | *  7:e49523854bc8 added d
-  | |   () draft
-  | o  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[7] added d
-  with: [8] added d
-  base: [4] added d
-  rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
-  updating to "local" side of the conflict: e49523854bc8
-  merging "other" content-divergent changeset 'a663d1567f0b'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg evolve --abort
-  evolve aborted
-  working directory is now at 33e4442acf98
-
-  $ hg glog
-  @  8:33e4442acf98 added d
-  |   () draft
-  | *  7:e49523854bc8 added d
-  | |   () draft
-  | o  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
--- a/tests/test-evolve-abort-phasediv.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-abort-phasediv.t	Thu Apr 11 22:41:25 2019 +0200
@@ -207,8 +207,7 @@
   recreate:[7] added d
   atop:[4] added d
   rebasing to destination parent: ca1b80f7960a
-  computing new diff
-  committed as c41c793e0ef1
+  no changes to commit
   recreate:[9] added c
   atop:[3] added c
   rebasing to destination parent: b1661037fa25
@@ -292,7 +291,6 @@
   continue: hg evolve --continue
   $ hg evolve --continue
   evolving 9:28cd06b3f801 "added c"
-  computing new diff
   committed as 95d746965290
   recreate:[10] added d
   atop:[4] added d
--- a/tests/test-evolve-content-divergence.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,929 +0,0 @@
-** Test for handling of content divergent changesets by `hg evolve` **
-====================================================================
-
-  $ cat >> $HGRCPATH <<EOF
-  > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
-  > [phases]
-  > publish = False
-  > [extensions]
-  > rebase =
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ hg init cdiv
-  $ cd cdiv
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-Creating content-divergence with branch change where base, divergent and other
-have different branches
--------------------------------------------------------------------------------
-
-  $ hg branch -r . foobar
-  changed branch on 1 changesets
-
-  $ hg up c41c793e0ef1 --hidden
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset c41c793e0ef1
-  (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48)
-  working directory parent is obsolete! (c41c793e0ef1)
-  (use 'hg evolve' to update to its successor: 9e5dffcb3d48)
-  $ echo bar > d
-  $ hg branch watwat
-  marked working directory as branch watwat
-  $ hg amend
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  6:264b04f771fb added d
-  |   () [watwat] draft
-  | *  5:9e5dffcb3d48 added d
-  |/    () [foobar] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent --config ui.interactive=True<<EOF
-  > c
-  > EOF
-  merge:[6] added d
-  with: [5] added d
-  base: [4] added d
-  merging "other" content-divergent changeset '9e5dffcb3d48'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  content divergent changesets on different branches.
-  choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar?  c
-  working directory is now at 0ac42f1bc15c
-
-  $ hg glog
-  @  7:0ac42f1bc15c added d
-  |   () [foobar] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-Testing merging of commit messages
------------------------------------
-
-When base and one of the divergent has same commit messages and other divergent
-has different one
-
-  $ echo wat > d
-  $ hg amend
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-
-  $ echo bar > d
-  $ hg ci -Aqm "added a d with bar in it, expect some beers"
-
-  $ hg prune -r 0ac42f1bc15c -s . --hidden
-  1 changesets pruned
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  9:59081c9c425a added a d with bar in it, expect some beers
-  |   () [default] draft
-  | *  8:f621d00f5f0e added d
-  |/    () [foobar] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[9] added a d with bar in it, expect some beers
-  with: [8] added d
-  base: [7] added d
-  merging "other" content-divergent changeset 'f621d00f5f0e'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at a9d6fd6b5e40
-
-  $ hg glog
-  @  10:a9d6fd6b5e40 added a d with bar in it, expect some beers
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-When base has different message and both divergents has same one
-
-  $ echo foo > d
-  $ hg amend -m "foo to d"
-
-  $ hg up a9d6fd6b5e40 --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset a9d6fd6b5e40
-  (hidden revision 'a9d6fd6b5e40' was rewritten as: b10b07a394f1)
-  working directory parent is obsolete! (a9d6fd6b5e40)
-  (use 'hg evolve' to update to its successor: b10b07a394f1)
-  $ echo babar > d
-  $ hg amend -m "foo to d"
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  12:0bb497fed24a foo to d
-  |   () [default] draft
-  | *  11:b10b07a394f1 foo to d
-  |/    () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[12] foo to d
-  with: [11] foo to d
-  base: [10] added a d with bar in it, expect some beers
-  merging "other" content-divergent changeset 'b10b07a394f1'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ echo foobar > d
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  working directory is now at 11175423b5dc
-
-  $ hg glog
-  @  13:11175423b5dc foo to d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-When all three base, divergent and other has different commit messages creating
-conflicts
-
-  $ echo bar > d
-  $ hg amend -m "bar to d, expect beers"
-
-  $ hg up 11175423b5dc --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset 11175423b5dc
-  (hidden revision '11175423b5dc' was rewritten as: 27f0463f169a)
-  working directory parent is obsolete! (11175423b5dc)
-  (use 'hg evolve' to update to its successor: 27f0463f169a)
-  $ echo wat > d
-  $ hg amend -m "wat to d, wat?"
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  15:f542037ddf31 wat to d, wat?
-  |   () [default] draft
-  | *  14:27f0463f169a bar to d, expect beers
-  |/    () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[15] wat to d, wat?
-  with: [14] bar to d, expect beers
-  base: [13] foo to d
-  merging "other" content-divergent changeset '27f0463f169a'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ echo watbar > d
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-
-  $ cat > editor.sh <<EOF
-  > #!/bin/sh
-  > printf "**showing editors text**\n\n"
-  > cat \$1
-  > printf "\n**done showing editors text**\n\n"
-  > cat > \$1 <<ENDOF
-  > watbar to d
-  > ENDOF
-  > EOF
-
-  $ HGEDITOR='sh ./editor.sh' hg evolve --continue
-  **showing editors text**
-  
-  HG: Conflicts while merging changeset description of content-divergent changesets.
-  HG: Resolve conflicts in commit messages to continue.
-  
-  <<<<<<< divergent
-  wat to d, wat?||||||| base
-  foo to d=======
-  bar to d, expect beers>>>>>>> other
-  
-  **done showing editors text**
-  
-  working directory is now at 89ea3eee2d69
-
-  $ hg glog
-  @  16:89ea3eee2d69 watbar to d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ cd ..
-
-Testing resolution of content-divergent changesets when they are on different
-parents and resolution and relocation wont result in conflicts
-------------------------------------------------------------------------------
-
-  $ hg init multiparents
-  $ cd multiparents
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg up .^^
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ echo bar > b
-  $ hg amend
-  2 new orphan changesets
-
-  $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True
-  rebasing 2:b1661037fa25 "added b"
-  2 new content-divergent changesets
-
-  $ hg glog
-  *  6:da4b96f4a8d6 added b
-  |   () [default] draft
-  | @  5:7ed0642d644b added b
-  | |   () [default] draft
-  | | *  4:c41c793e0ef1 added d
-  | | |   () [default] draft
-  | | *  3:ca1b80f7960a added c
-  | | |   () [default] draft
-  | | x  2:b1661037fa25 added b
-  | |/    () [default] draft
-  | o  1:c7586e2a9264 added a
-  |/    () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[5] added b
-  with: [6] added b
-  base: [2] added b
-  rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264
-  updating to "local" side of the conflict: 7ed0642d644b
-  merging "other" content-divergent changeset '11f849d7159f'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 171614c9a791
-
-  $ hg glog
-  @  8:171614c9a791 added b
-  |   () [default] draft
-  | *  4:c41c793e0ef1 added d
-  | |   () [default] draft
-  | *  3:ca1b80f7960a added c
-  | |   () [default] draft
-  | x  2:b1661037fa25 added b
-  |/    () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg exp
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 171614c9a7914c53f531373b95632323fdbbac8d
-  # Parent  c7586e2a92645e473645847a7b69a6dc52be4276
-  added b
-  
-  diff -r c7586e2a9264 -r 171614c9a791 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 @@
-  +bar
-
-Resolving orphans to get back to a normal graph
-
-  $ hg evolve --all
-  move:[3] added c
-  atop:[8] added b
-  move:[4] added d
-  working directory is now at 4ae4427ee9f8
-  $ hg glog
-  @  10:4ae4427ee9f8 added d
-  |   () [default] draft
-  o  9:917281f93fcb added c
-  |   () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-More testing!
-
-  $ hg up .^^
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ echo x > x
-  $ hg ci -Aqm "added x"
-  $ hg glog -r .
-  @  11:71a392c714b5 added x
-  |   () [default] draft
-  ~
-
-  $ echo foo > x
-  $ hg branch bar
-  marked working directory as branch bar
-  (branches are permanent and global, did you want a bookmark?)
-  $ hg amend -m "added foo to x"
-
-  $ hg up 71a392c714b5 --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset 71a392c714b5
-  (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d)
-  working directory parent is obsolete! (71a392c714b5)
-  (use 'hg evolve' to update to its successor: 1e1a50385a7d)
-  $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True
-  rebasing 11:71a392c714b5 "added x"
-  2 new content-divergent changesets
-
-  $ hg glog
-  @  13:1e4f6b3bb39b added x
-  |   () [default] draft
-  | *  12:1e1a50385a7d added foo to x
-  | |   () [bar] draft
-  o |  10:4ae4427ee9f8 added d
-  | |   () [default] draft
-  o |  9:917281f93fcb added c
-  |/    () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[13] added x
-  with: [12] added foo to x
-  base: [11] added x
-  rebasing "other" content-divergent changeset 1e1a50385a7d on 4ae4427ee9f8
-  updating to "local" side of the conflict: 1e4f6b3bb39b
-  merging "other" content-divergent changeset '80cc9b1ec650'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at b006cf317e0e
-
-  $ hg exp
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Branch bar
-  # Node ID b006cf317e0ed16dbe786c439577475580f645f1
-  # Parent  4ae4427ee9f8f0935211fd66360948b77ab5aee9
-  added foo to x
-  
-  diff -r 4ae4427ee9f8 -r b006cf317e0e 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 @@
-  +foo
-
-The above `hg exp` and the following log call demonstrates that message, content
-and branch change is preserved in case of relocation
-  $ hg glog
-  @  15:b006cf317e0e added foo to x
-  |   () [bar] draft
-  o  10:4ae4427ee9f8 added d
-  |   () [default] draft
-  o  9:917281f93fcb added c
-  |   () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-Testing when both the content-divergence are on different parents and resolution
-will lead to conflicts
----------------------------------------------------------------------------------
-
-  $ hg up .^^^
-  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-
-  $ echo y > y
-  $ hg ci -Aqm "added y"
-  $ hg glog -r .
-  @  16:fc6ad2bac162 added y
-  |   () [default] draft
-  ~
-
-  $ echo bar > y
-  $ hg amend
-
-  $ hg up fc6ad2bac162 --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset fc6ad2bac162
-  (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba)
-  working directory parent is obsolete! (fc6ad2bac162)
-  (use 'hg evolve' to update to its successor: 2a9f6ccbdeba)
-  $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True
-  rebasing 16:fc6ad2bac162 "added y"
-  2 new content-divergent changesets
-  $ echo wat > y
-  $ hg amend
-
-  $ hg glog
-  @  19:b4575ed6fcfc added y
-  |   () [bar] draft
-  | *  17:2a9f6ccbdeba added y
-  | |   () [default] draft
-  o |  15:b006cf317e0e added foo to x
-  | |   () [bar] draft
-  o |  10:4ae4427ee9f8 added d
-  | |   () [default] draft
-  o |  9:917281f93fcb added c
-  |/    () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[19] added y
-  with: [17] added y
-  base: [16] added y
-  rebasing "other" content-divergent changeset 2a9f6ccbdeba on b006cf317e0e
-  updating to "local" side of the conflict: b4575ed6fcfc
-  merging "other" content-divergent changeset '48f745db3f53'
-  merging y
-  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ echo watbar > y
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  working directory is now at 7bbcf24ddecf
-
-  $ hg glog
-  @  21:7bbcf24ddecf added y
-  |   () [bar] draft
-  o  15:b006cf317e0e added foo to x
-  |   () [bar] draft
-  o  10:4ae4427ee9f8 added d
-  |   () [default] draft
-  o  9:917281f93fcb added c
-  |   () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg obslog -r . --all
-  @    7bbcf24ddecf (21) added y
-  |\
-  x |  48f745db3f53 (20) added y
-  | |    rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
-  | |
-  | x  b4575ed6fcfc (19) added y
-  | |    rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
-  | |
-  x |  2a9f6ccbdeba (17) added y
-  | |    rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
-  | |
-  | x  96b677f01b81 (18) added y
-  |/     rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-  |
-  x  fc6ad2bac162 (16) added y
-       rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-       rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
-  
-
-checking that relocated commit is there
-  $ hg exp 48f745db3f53 --hidden
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3
-  # Parent  b006cf317e0ed16dbe786c439577475580f645f1
-  added y
-  
-  diff -r b006cf317e0e -r 48f745db3f53 y
-  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
-  @@ -0,0 +1,1 @@
-  +bar
-
-Testing when the relocation will result in conflicts and merging wont
-----------------------------------------------------------------------
-
-  $ hg glog
-  @  21:7bbcf24ddecf added y
-  |   () [bar] draft
-  o  15:b006cf317e0e added foo to x
-  |   () [bar] draft
-  o  10:4ae4427ee9f8 added d
-  |   () [default] draft
-  o  9:917281f93fcb added c
-  |   () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg up .^^^^
-  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-
-  $ echo z > z
-  $ hg ci -Aqm "added z"
-  $ hg glog -r .
-  @  22:daf1de08f3b0 added z
-  |   () [default] draft
-  ~
-
-  $ echo foo > y
-  $ hg add y
-  $ hg amend
-
-  $ hg up daf1de08f3b0 --hidden
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  updated to hidden changeset daf1de08f3b0
-  (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080)
-  working directory parent is obsolete! (daf1de08f3b0)
-  (use 'hg evolve' to update to its successor: 3f7a1f693080)
-  $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True
-  rebasing 22:daf1de08f3b0 "added z"
-  2 new content-divergent changesets
-  $ echo bar > z
-  $ hg amend
-
-  $ hg glog
-  @  25:53242575ffa9 added z
-  |   () [bar] draft
-  | *  23:3f7a1f693080 added z
-  | |   () [default] draft
-  o |  21:7bbcf24ddecf added y
-  | |   () [bar] draft
-  o |  15:b006cf317e0e added foo to x
-  | |   () [bar] draft
-  o |  10:4ae4427ee9f8 added d
-  | |   () [default] draft
-  o |  9:917281f93fcb added c
-  |/    () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --content-divergent
-  merge:[25] added z
-  with: [23] added z
-  base: [22] added z
-  rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf
-  merging y
-  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg diff
-  diff -r 7bbcf24ddecf y
-  --- a/y	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,5 @@
-  +<<<<<<< destination: 7bbcf24ddecf bar - test: added y
-   watbar
-  +=======
-  +foo
-  +>>>>>>> evolving:    3f7a1f693080 - test: added z
-  diff -r 7bbcf24ddecf z
-  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
-  @@ -0,0 +1,1 @@
-  +z
-
-  $ echo foo > y
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-
-  $ hg evolve --continue
-  evolving 23:3f7a1f693080 "added z"
-  updating to "local" side of the conflict: 53242575ffa9
-  merging "other" content-divergent changeset 'cdb0643c69fc'
-  merging y
-  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg diff
-  diff -r 53242575ffa9 y
-  --- a/y	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,5 @@
-  +<<<<<<< local: 53242575ffa9 bar - test: added z
-   watbar
-  +=======
-  +foo
-  +>>>>>>> other: cdb0643c69fc - test: added z
-
-  $ echo foo > y
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  working directory is now at 6fc7d9682de6
-
-  $ hg glog
-  @  27:6fc7d9682de6 added z
-  |   () [bar] draft
-  o  21:7bbcf24ddecf added y
-  |   () [bar] draft
-  o  15:b006cf317e0e added foo to x
-  |   () [bar] draft
-  o  10:4ae4427ee9f8 added d
-  |   () [default] draft
-  o  9:917281f93fcb added c
-  |   () [default] draft
-  o  8:171614c9a791 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg exp
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Branch bar
-  # Node ID 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4
-  # Parent  7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b
-  added z
-  
-  diff -r 7bbcf24ddecf -r 6fc7d9682de6 y
-  --- a/y	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,1 @@
-  -watbar
-  +foo
-  diff -r 7bbcf24ddecf -r 6fc7d9682de6 z
-  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
-  @@ -0,0 +1,1 @@
-  +bar
-
-  $ cd ..
-
-Resolving content-divergence of a stack with same parents
----------------------------------------------------------
-
-  $ hg init stacktest
-  $ cd stacktest
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ cd ..
-  $ hg init stack2
-  $ cd stack2
-  $ hg pull ../stacktest
-  pulling from ../stacktest
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 5 changesets with 5 changes to 5 files
-  new changesets 8fa14d15e168:c41c793e0ef1 (5 drafts)
-  (run 'hg update' to get a working copy)
-  $ hg glog
-  o  4:c41c793e0ef1 added d
-  |   () [default] draft
-  o  3:ca1b80f7960a added c
-  |   () [default] draft
-  o  2:b1661037fa25 added b
-  |   () [default] draft
-  o  1:c7586e2a9264 added a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg up c7586e2a9264
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ echo bar > a
-  $ hg amend -m "watbar to a"
-  3 new orphan changesets
-  $ echo wat > a
-  $ hg amend -m "watbar to a"
-  $ hg evolve --all
-  move:[2] added b
-  atop:[6] watbar to a
-  move:[3] added c
-  move:[4] added d
-  working directory is now at 15c781f93cac
-  $ hg glog
-  @  9:15c781f93cac added d
-  |   () [default] draft
-  o  8:9e5fb1d5b955 added c
-  |   () [default] draft
-  o  7:88516dccf68a added b
-  |   () [default] draft
-  o  6:82b74d5dc678 watbar to a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ cd ../stacktest
-  $ hg up .^^^
-  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  $ echo wat > a
-  $ hg amend -m "watbar to a"
-  3 new orphan changesets
-  $ hg evolve --all
-  move:[2] added b
-  atop:[5] watbar to a
-  move:[3] added c
-  move:[4] added d
-  working directory is now at c72d2885eb51
-  $ hg glog
-  @  8:c72d2885eb51 added d
-  |   () [default] draft
-  o  7:3ce4be6d8e5e added c
-  |   () [default] draft
-  o  6:d5f148423c16 added b
-  |   () [default] draft
-  o  5:8e222f257bbf watbar to a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg pull ../stack2
-  pulling from ../stack2
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 4 changesets with 0 changes to 4 files (+1 heads)
-  5 new obsolescence markers
-  8 new content-divergent changesets
-  new changesets 82b74d5dc678:15c781f93cac (4 drafts)
-  (run 'hg heads' to see heads, 'hg merge' to merge)
-
-  $ hg glog
-  *  12:15c781f93cac added d
-  |   () [default] draft
-  *  11:9e5fb1d5b955 added c
-  |   () [default] draft
-  *  10:88516dccf68a added b
-  |   () [default] draft
-  *  9:82b74d5dc678 watbar to a
-  |   () [default] draft
-  | @  8:c72d2885eb51 added d
-  | |   () [default] draft
-  | *  7:3ce4be6d8e5e added c
-  | |   () [default] draft
-  | *  6:d5f148423c16 added b
-  | |   () [default] draft
-  | *  5:8e222f257bbf watbar to a
-  |/    () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
-
-  $ hg evolve --all --content-divergent
-  merge:[5] watbar to a
-  with: [9] watbar to a
-  base: [1] added a
-  updating to "local" side of the conflict: 8e222f257bbf
-  merging "other" content-divergent changeset '82b74d5dc678'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  6 new orphan changesets
-  merge:[6] added b
-  with: [10] added b
-  base: [2] added b
-  updating to "local" side of the conflict: d5f148423c16
-  merging "other" content-divergent changeset '88516dccf68a'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  merge:[7] added c
-  with: [11] added c
-  base: [3] added c
-  updating to "local" side of the conflict: 3ce4be6d8e5e
-  merging "other" content-divergent changeset '9e5fb1d5b955'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  merge:[8] added d
-  with: [12] added d
-  base: [4] added d
-  updating to "local" side of the conflict: c72d2885eb51
-  merging "other" content-divergent changeset '15c781f93cac'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 038fe7db3d88
-
-  $ hg glog
-  @  16:038fe7db3d88 added d
-  |   () [default] draft
-  o  15:b2cac10f3836 added c
-  |   () [default] draft
-  o  14:eadfd9d70680 added b
-  |   () [default] draft
-  o  13:f66f262fff6c watbar to a
-  |   () [default] draft
-  o  0:8fa14d15e168 added hgignore
-      () [default] draft
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-basic.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,1132 @@
+=======================================================
+Tests the resolution of content divergence: basic cases
+=======================================================
+
+This file intend to cover basic case of content divergence. See the other test
+file for more advanced cases.
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [defaults]
+  > amend=-d "0 0"
+  > fold=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [diff]
+  > git = 1
+  > unified = 0
+  > [ui]
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ mkcommits() {
+  >   for i in $@; do mkcommit $i ; done
+  > }
+
+Basic test of divergence: two divergent changesets with the same parents
+With --all --any we dedupe the divergent and solve the divergence once
+
+  $ hg init test1
+  $ cd test1
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 5f6d8a4bf34ab274ccc9f631c2536964b8a3666d
+  # Parent  9092f1db7931481f93b37d5c9fbcfc341bcd7318
+  added b
+  
+  diff --git a/b b/b
+  new file mode 100644
+  --- /dev/null
+  +++ b/b
+  @@ -0,0 +1,1 @@
+  +b
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent1
+  $ hg ci -Am "divergent"
+  adding bdivergent1
+  created new head
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 593c57f2117e33dd0884382f02789d948f548557
+  # Parent  9092f1db7931481f93b37d5c9fbcfc341bcd7318
+  divergent
+  
+  diff --git a/bdivergent1 b/bdivergent1
+  new file mode 100644
+  --- /dev/null
+  +++ b/bdivergent1
+  @@ -0,0 +1,1 @@
+  +bdivergent
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent2
+  $ hg ci -Am "divergent"
+  adding bdivergent2
+  created new head
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 8374d2ddc3a4d48428c3d2f80e4fc86f13736f96
+  # Parent  9092f1db7931481f93b37d5c9fbcfc341bcd7318
+  divergent
+  
+  diff --git a/bdivergent2 b/bdivergent2
+  new file mode 100644
+  --- /dev/null
+  +++ b/bdivergent2
+  @@ -0,0 +1,1 @@
+  +bdivergent
+
+  $ hg prune -s 8374d2ddc3a4 "desc('added b')"
+  1 changesets pruned
+  $ hg prune -s 593c57f2117e "desc('added b')" --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg log -G --patch
+  @  3:8374d2ddc3a4@default(draft) divergent [content-divergent]
+  |  diff --git a/bdivergent2 b/bdivergent2
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/bdivergent2
+  |  @@ -0,0 +1,1 @@
+  |  +bdivergent
+  |
+  | *  2:593c57f2117e@default(draft) divergent [content-divergent]
+  |/   diff --git a/bdivergent1 b/bdivergent1
+  |    new file mode 100644
+  |    --- /dev/null
+  |    +++ b/bdivergent1
+  |    @@ -0,0 +1,1 @@
+  |    +bdivergent
+  |
+  o  0:9092f1db7931@default(draft) added a []
+     diff --git a/a b/a
+     new file mode 100644
+     --- /dev/null
+     +++ b/a
+     @@ -0,0 +1,1 @@
+     +a
+  
+
+  $ hg evolve --all --any --content-divergent
+  merge:[2] divergent
+  with: [3] divergent
+  base: [1] added b
+  updating to "local" side of the conflict: 593c57f2117e
+  merging "other" content-divergent changeset '8374d2ddc3a4'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 45bf1312f454
+  $ hg log -G
+  @  4:45bf1312f454@default(draft) divergent []
+  |
+  o  0:9092f1db7931@default(draft) added a []
+  
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 45bf1312f45468b76158b33f8426e6530c8b35b1
+  # Parent  9092f1db7931481f93b37d5c9fbcfc341bcd7318
+  divergent
+  
+  diff --git a/bdivergent1 b/bdivergent1
+  new file mode 100644
+  --- /dev/null
+  +++ b/bdivergent1
+  @@ -0,0 +1,1 @@
+  +bdivergent
+  diff --git a/bdivergent2 b/bdivergent2
+  new file mode 100644
+  --- /dev/null
+  +++ b/bdivergent2
+  @@ -0,0 +1,1 @@
+  +bdivergent
+
+  $ cd ..
+
+Extra setup
+-----------
+
+(the test below were initially in a different file)
+
+  $ hg init cdiv
+  $ cd cdiv
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Merging branch difference
+-------------------------
+
+Creating content-divergence with branch change where base, divergent and other
+have different branches
+
+  $ hg branch -r . foobar
+  changed branch on 1 changesets
+
+  $ hg up c41c793e0ef1 --hidden
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48)
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: 9e5dffcb3d48)
+  $ echo bar > d
+  $ hg branch watwat
+  marked working directory as branch watwat
+  $ hg amend
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  6:264b04f771fb added d
+  |   () [watwat] draft
+  | *  5:9e5dffcb3d48 added d
+  |/    () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent --config ui.interactive=True<<EOF
+  > c
+  > EOF
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset '9e5dffcb3d48'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  content divergent changesets on different branches.
+  choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar?  c
+  working directory is now at 0ac42f1bc15c
+
+  $ hg glog
+  @  7:0ac42f1bc15c added d
+  |   () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Testing merging of commit messages
+-----------------------------------
+
+When base and one of the divergent has same commit messages and other divergent
+has different one
+
+  $ echo wat > d
+  $ hg amend
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ echo bar > d
+  $ hg ci -Aqm "added a d with bar in it, expect some beers"
+
+  $ hg prune -r 0ac42f1bc15c -s . --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  9:59081c9c425a added a d with bar in it, expect some beers
+  |   () [default] draft
+  | *  8:f621d00f5f0e added d
+  |/    () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[9] added a d with bar in it, expect some beers
+  with: [8] added d
+  base: [7] added d
+  merging "other" content-divergent changeset 'f621d00f5f0e'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at a9d6fd6b5e40
+
+  $ hg glog
+  @  10:a9d6fd6b5e40 added a d with bar in it, expect some beers
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+When base has different message and both divergents has same one
+
+  $ echo foo > d
+  $ hg amend -m "foo to d"
+
+  $ hg up a9d6fd6b5e40 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset a9d6fd6b5e40
+  (hidden revision 'a9d6fd6b5e40' was rewritten as: b10b07a394f1)
+  working directory parent is obsolete! (a9d6fd6b5e40)
+  (use 'hg evolve' to update to its successor: b10b07a394f1)
+  $ echo babar > d
+  $ hg amend -m "foo to d"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  12:0bb497fed24a foo to d
+  |   () [default] draft
+  | *  11:b10b07a394f1 foo to d
+  |/    () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[12] foo to d
+  with: [11] foo to d
+  base: [10] added a d with bar in it, expect some beers
+  merging "other" content-divergent changeset 'b10b07a394f1'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo foobar > d
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 11175423b5dc
+
+  $ hg glog
+  @  13:11175423b5dc foo to d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+When all three base, divergent and other has different commit messages creating
+conflicts
+
+  $ echo bar > d
+  $ hg amend -m "bar to d, expect beers"
+
+  $ hg up 11175423b5dc --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 11175423b5dc
+  (hidden revision '11175423b5dc' was rewritten as: 27f0463f169a)
+  working directory parent is obsolete! (11175423b5dc)
+  (use 'hg evolve' to update to its successor: 27f0463f169a)
+  $ echo wat > d
+  $ hg amend -m "wat to d, wat?"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  15:f542037ddf31 wat to d, wat?
+  |   () [default] draft
+  | *  14:27f0463f169a bar to d, expect beers
+  |/    () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[15] wat to d, wat?
+  with: [14] bar to d, expect beers
+  base: [13] foo to d
+  merging "other" content-divergent changeset '27f0463f169a'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo watbar > d
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ cat > editor.sh <<EOF
+  > #!/bin/sh
+  > printf "**showing editors text**\n\n"
+  > cat \$1
+  > printf "\n**done showing editors text**\n\n"
+  > cat > \$1 <<ENDOF
+  > watbar to d
+  > ENDOF
+  > EOF
+
+  $ HGEDITOR='sh ./editor.sh' hg evolve --continue
+  **showing editors text**
+  
+  HG: Conflicts while merging changeset description of content-divergent changesets.
+  HG: Resolve conflicts in commit messages to continue.
+  
+  <<<<<<< divergent
+  wat to d, wat?||||||| base
+  foo to d=======
+  bar to d, expect beers>>>>>>> other
+  
+  **done showing editors text**
+  
+  working directory is now at 89ea3eee2d69
+
+  $ hg glog
+  @  16:89ea3eee2d69 watbar to d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+
+Stabilize content-divergent changesets with same parent
+=======================================================
+
+
+  $ glog() {
+  >   hg log -G --template \
+  >     '{rev}:{node|short}@{branch}({phase}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
+  > }
+
+  $ hg init content-divergent-savanna
+  $ cd content-divergent-savanna
+  $ echo a > a
+  $ hg add a
+  $ hg ci -m 'root'
+  $ hg phase --public .
+  $ cat << EOF >> a
+  > flore
+  > arthur
+  > zephir
+  > some
+  > less
+  > conflict
+  > EOF
+  $ hg ci -m 'More addition'
+  $ glog
+  @  1:867e43582046@default(draft) bk:[] More addition
+  |
+  o  0:6569b5a81c7e@default(public) bk:[] root
+  
+  $ echo 'babar' >> a
+  $ hg amend
+  $ hg up --hidden 'min(desc("More addition"))'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 867e43582046
+  (hidden revision '867e43582046' was rewritten as: fc6349f931da)
+  working directory parent is obsolete! (867e43582046)
+  (use 'hg evolve' to update to its successor: fc6349f931da)
+  $ mv a a.old
+  $ echo 'jungle' > a
+  $ cat a.old >> a
+  $ rm a.old
+  $ hg amend
+  2 new content-divergent changesets
+  $ glog
+  @  3:051337a45e7c@default(draft) bk:[] More addition
+  |
+  | *  2:fc6349f931da@default(draft) bk:[] More addition
+  |/
+  o  0:6569b5a81c7e@default(public) bk:[] root
+  
+
+Stabilize it
+
+  $ hg evolve -qn --confirm --content-divergent
+  merge:[3] More addition
+  with: [2] More addition
+  base: [1] More addition
+  perform evolve? [Ny] n
+  abort: evolve aborted by user
+  [255]
+  $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
+  merge:[3] More addition
+  with: [2] More addition
+  base: [1] More addition
+  perform evolve? [Ny] y
+  hg update -c 051337a45e7c &&
+  hg merge fc6349f931da &&
+  hg commit -m "auto merge resolving conflict between 051337a45e7c and fc6349f931da"&&
+  hg up -C 867e43582046 &&
+  hg revert --all --rev tip &&
+  hg commit -m "`hg log -r 051337a45e7c --template={desc}`";
+  $ hg evolve -v --content-divergent
+  merge:[3] More addition
+  with: [2] More addition
+  base: [1] More addition
+  merging "other" content-divergent changeset 'fc6349f931da'
+  resolving manifests
+  merging a
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  committing files:
+  a
+  committing manifest
+  committing changelog
+  working directory is now at 5bf84d1d71d1
+  $ hg st
+  $ glog
+  @  4:5bf84d1d71d1@default(draft) bk:[] More addition
+  |
+  o  0:6569b5a81c7e@default(public) bk:[] root
+  
+  $ hg summary
+  parent: 4:5bf84d1d71d1 tip
+   More addition
+  branch: default
+  commit: (clean)
+  update: (current)
+  phases: 1 draft
+  $ hg export . --config diff.unified=3
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 5bf84d1d71d12f451bfe1e09b93045eb6338cd6c
+  # Parent  6569b5a81c7e307ddc076550e8c0f6d75b6effcd
+  More addition
+  
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,9 @@
+  +jungle
+   a
+  +flore
+  +arthur
+  +zephir
+  +some
+  +less
+  +conflict
+  +babar
+
+Check conflict during content-divergence resolution
+---------------------------------------------------
+
+
+  $ hg up --hidden 'min(desc("More addition"))'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 867e43582046
+  (hidden revision '867e43582046' was rewritten as: 5bf84d1d71d1)
+  working directory parent is obsolete! (867e43582046)
+  (use 'hg evolve' to update to its successor: 5bf84d1d71d1)
+  $ echo 'gotta break' >> a
+  $ hg amend
+  2 new content-divergent changesets
+
+# reamend so that the case is not the first precursor.
+
+  $ hg amend -m "More addition (2)"
+  $ hg phase 'contentdivergent()'
+  4: draft
+  6: draft
+
+  $ glog
+  @  6:13c1b75640a1@default(draft) bk:[] More addition (2)
+  |
+  | *  4:5bf84d1d71d1@default(draft) bk:[] More addition
+  |/
+  o  0:6569b5a81c7e@default(public) bk:[] root
+  
+
+  $ hg evolve -qn --content-divergent
+  hg update -c 13c1b75640a1 &&
+  hg merge 5bf84d1d71d1 &&
+  hg commit -m "auto merge resolving conflict between 13c1b75640a1 and 5bf84d1d71d1"&&
+  hg up -C 867e43582046 &&
+  hg revert --all --rev tip &&
+  hg commit -m "`hg log -r 13c1b75640a1 --template={desc}`";
+  $ hg evolve --content-divergent
+  merge:[6] More addition (2)
+  with: [4] More addition
+  base: [1] More addition
+  merging "other" content-divergent changeset '5bf84d1d71d1'
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ cat > a <<EOF
+  > jungle
+  > a
+  > flore
+  > arthur
+  > zephir
+  > some
+  > less
+  > conflict
+  > babar
+  > EOF
+
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 2346e1147fed
+  $ glog
+  @  7:2346e1147fed@default(draft) bk:[] More addition (2)
+  |
+  o  0:6569b5a81c7e@default(public) bk:[] root
+  
+  $ hg exp  --config diff.unified=3
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 2346e1147fedc8c9aa17f9ba7870dcd8be52f567
+  # Parent  6569b5a81c7e307ddc076550e8c0f6d75b6effcd
+  More addition (2)
+  
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,9 @@
+  +jungle
+   a
+  +flore
+  +arthur
+  +zephir
+  +some
+  +less
+  +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
+  
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-corner-cases.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,385 @@
+========================================================
+Tests the resolution of content divergence: corner cases
+========================================================
+
+This file intend to cover cases that are specific enough to not fit in the
+other cases.
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [defaults]
+  > amend=-d "0 0"
+  > fold=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [diff]
+  > git = 1
+  > unified = 0
+  > [ui]
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ mkcommits() {
+  >   for i in $@; do mkcommit $i ; done
+  > }
+
+Basic test of divergence: two divergent changesets with the same parents
+With --all --any we dedupe the divergent and solve the divergence once
+
+  $ hg init test1
+  $ cd test1
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent1
+  $ hg ci -Am "divergent"
+  adding bdivergent1
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent2
+  $ hg ci -Am "divergent"
+  adding bdivergent2
+  created new head
+
+  $ hg prune -s 8374d2ddc3a4 "desc('added b')"
+  1 changesets pruned
+  $ hg prune -s 593c57f2117e "desc('added b')" --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg log -G
+  @  3:8374d2ddc3a4@default(draft) divergent [content-divergent]
+  |
+  | *  2:593c57f2117e@default(draft) divergent [content-divergent]
+  |/
+  o  0:9092f1db7931@default(draft) added a []
+  
+
+  $ hg evolve --all --any --content-divergent
+  merge:[2] divergent
+  with: [3] divergent
+  base: [1] added b
+  updating to "local" side of the conflict: 593c57f2117e
+  merging "other" content-divergent changeset '8374d2ddc3a4'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 45bf1312f454
+  $ hg log -G
+  @  4:45bf1312f454@default(draft) divergent []
+  |
+  o  0:9092f1db7931@default(draft) added a []
+  
+Test divergence resolution when it yields to an empty commit (issue4950)
+cdivergent2 contains the same content than cdivergent1 and they are divergent
+versions of the revision _c
+
+  $ hg up .^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ mkcommit _c
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit cdivergent1
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo "cdivergent1" > cdivergent1
+  $ hg add cdivergent1
+  $ hg ci -m "add _c"
+  created new head
+
+  $ hg log -G
+  @  7:b2ae71172042@default(draft) add _c []
+  |
+  | o  6:e3ff64ce8d4c@default(draft) add cdivergent1 []
+  |/
+  | o  5:48819a835615@default(draft) add _c []
+  |/
+  | o  4:45bf1312f454@default(draft) divergent []
+  |/
+  o  0:9092f1db7931@default(draft) added a []
+  
+
+  $ hg prune -s b2ae71172042 48819a835615
+  1 changesets pruned
+  $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg log -G
+  @  7:b2ae71172042@default(draft) add _c [content-divergent]
+  |
+  | *  6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
+  |/
+  | o  4:45bf1312f454@default(draft) divergent []
+  |/
+  o  0:9092f1db7931@default(draft) added a []
+  
+  $ hg evolve --all --any --content-divergent
+  merge:[6] add cdivergent1
+  with: [7] add _c
+  base: [5] add _c
+  updating to "local" side of the conflict: e3ff64ce8d4c
+  merging "other" content-divergent changeset 'b2ae71172042'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  nothing changed
+  working directory is now at e3ff64ce8d4c
+
+  $ cd ..
+
+Test None docstring issue of evolve divergent, which caused hg crush
+
+  $ hg init test2
+  $ cd test2
+  $ mkcommits _a _b
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent11
+  $ hg ci -Am "bdivergent"
+  adding bdivergent11
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bdivergent > bdivergent22
+  $ hg ci -Am "bdivergent"
+  adding bdivergent22
+  created new head
+
+  $ hg log -G
+  @  3:6b096fb45070@default(draft) bdivergent []
+  |
+  | o  2:05a6b6a9e633@default(draft) bdivergent []
+  |/
+  | o  1:37445b16603b@default(draft) add _b []
+  |/
+  o  0:135f39f4bd78@default(draft) add _a []
+  
+
+  $ hg prune -s 6b096fb45070 37445b16603b
+  1 changesets pruned
+  $ hg prune -s 05a6b6a9e633 37445b16603b --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg log -G
+  @  3:6b096fb45070@default(draft) bdivergent [content-divergent]
+  |
+  | *  2:05a6b6a9e633@default(draft) bdivergent [content-divergent]
+  |/
+  o  0:135f39f4bd78@default(draft) add _a []
+  
+
+  $ cat >$TESTTMP/test_extension.py  << EOF
+  > from mercurial import merge
+  > origupdate = merge.update
+  > def newupdate(*args, **kwargs):
+  >   return origupdate(*args, **kwargs)
+  > merge.update = newupdate
+  > EOF
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > testextension=$TESTTMP/test_extension.py
+  > EOF
+  $ hg evolve --all
+  nothing to evolve on current working copy parent
+  (do you want to use --content-divergent)
+  [2]
+  $ hg evolve --content-divergent
+  merge:[3] bdivergent
+  with: [2] bdivergent
+  base: [1] add _b
+  merging "other" content-divergent changeset '05a6b6a9e633'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 73ff357d3975
+
+  $ cd ..
+
+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.
+
+  $ hg init localside
+  $ cd localside
+  $ for ch in a b c d e; do
+  > echo $ch > $ch;
+  > hg add $ch;
+  > hg ci -m "added "$ch;
+  > done;
+
+  $ hg glog
+  @  4:8d71eadcc9df added e
+  |   () [default] draft
+  o  3:9150fe93bec6 added d
+  |   () [default] draft
+  o  2:155349b645be added c
+  |   () [default] draft
+  o  1:5f6d8a4bf34a added b
+  |   () [default] draft
+  o  0:9092f1db7931 added a
+      () [default] draft
+
+  $ echo ee > e
+  $ hg amend -m "updated e"
+  $ 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
+
+  $ hg glog
+  @  6:de4ea3103326 updated e
+  |   () [default] draft
+  | *  5:ff6f7cd76a7c updated e
+  | |   () [default] draft
+  | x  3:9150fe93bec6 added d
+  | |   () [default] draft
+  | o  2:155349b645be added c
+  |/    () [default] draft
+  o  1:5f6d8a4bf34a added b
+  |   () [default] draft
+  o  0:9092f1db7931 added a
+      () [default] draft
+
+  $ hg evolve --content-divergent --any
+  merge:[5] updated e
+  with: [6] updated e
+  base: [4] added e
+  rebasing "other" content-divergent changeset de4ea3103326 on 9150fe93bec6
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff --no-git --config diff.unified=3
+  diff -r 9150fe93bec6 d
+  --- a/d	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 9150fe93bec6 - test: added d
+   d
+  +=======
+  +dd
+  +>>>>>>> evolving:    de4ea3103326 - test: updated e
+  diff -r 9150fe93bec6 e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +ee
+
+  $ echo dresolved > d
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 6:de4ea3103326 "updated e"
+  updating to "local" side of the conflict: ff6f7cd76a7c
+  merging "other" content-divergent changeset 'e504bd82de7e'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 83b1664a580f
+
+  $ hg glog -l1
+  @  8:83b1664a580f updated e
+  |   () [default] draft
+  ~
+
+  $ 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-interrupted.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,598 @@
+=======================================================
+Tests the resolution of content divergence: interrupted
+=======================================================
+
+This file intend to cover case where evolve has to be interrupted.
+
+This test aims at gather test case for --abort, --continue and --stop
+
+
+Tests for the --abort flag for `hg evolve` command while content-divergence resolution
+======================================================================================
+
+The `--abort` flag aborts the interrupted evolve by undoing all the work which
+was done during resolution i.e. stripping new changesets created, moving
+bookmarks back, moving working directory back.
+
+This test contains cases when `hg evolve` is doing content-divergence resolution.
+
+Setup
+=====
+
+  $ cat >> $HGRCPATH <<EOF
+  > [phases]
+  > publish = False
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init abortrepo
+  $ cd abortrepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+  $ echo bar > d
+  $ hg amend
+
+  $ hg up c41c793e0ef1 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: e49523854bc8)
+
+  $ echo foobar > d
+  $ hg amend
+  2 new content-divergent changesets
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset 'e49523854bc8'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg status -v
+  M d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     d
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # 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
+  working directory is now at 9c1631e352d9
+
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating multiple content-divergence where resolution of last one results in
+conflicts and resolution of first one resulted in no new commit
+-----------------------------------------------------------------------------
+
+  $ echo watbar > d
+  $ hg amend
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bar > c
+  $ hg amend
+  2 new orphan changesets
+  $ hg up ca1b80f7960a --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (ca1b80f7960a)
+  (use 'hg evolve' to update to its successor: 2ba73e31f264)
+  $ echo foobar > c
+  $ hg amend
+  2 new content-divergent changesets
+  $ echo bar > c
+  $ hg amend
+
+  $ hg glog --hidden
+  @  10:491e10505bae added c
+  |   () draft
+  | x  9:7398f702a162 added c
+  |/    () draft
+  | *  8:2ba73e31f264 added c
+  |/    () draft
+  | *  7:f0f1694f123e added d
+  | |   () draft
+  | | x  6:9c1631e352d9 added d
+  | |/    () draft
+  | | *  5:e49523854bc8 added d
+  | |/    () draft
+  | | x  4:c41c793e0ef1 added d
+  | |/    () draft
+  | x  3:ca1b80f7960a added c
+  |/    () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --all --content-divergent
+  merge:[8] added c
+  with: [10] added c
+  base: [3] added c
+  updating to "local" side of the conflict: 2ba73e31f264
+  merging "other" content-divergent changeset '491e10505bae'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[5] added d
+  with: [7] added d
+  base: [4] added d
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset 'f0f1694f123e'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  2 new content-divergent changesets
+  evolve aborted
+  working directory is now at 491e10505bae
+
+  $ hg glog --hidden
+  @  10:491e10505bae added c
+  |   () draft
+  | x  9:7398f702a162 added c
+  |/    () draft
+  | *  8:2ba73e31f264 added c
+  |/    () draft
+  | *  7:f0f1694f123e added d
+  | |   () draft
+  | | x  6:9c1631e352d9 added d
+  | |/    () draft
+  | | *  5:e49523854bc8 added d
+  | |/    () draft
+  | | x  4:c41c793e0ef1 added d
+  | |/    () draft
+  | x  3:ca1b80f7960a added c
+  |/    () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg obslog -r . --all
+  *  2ba73e31f264 (8) added c
+  |
+  | @  491e10505bae (10) added c
+  | |
+  | x  7398f702a162 (9) added c
+  |/     rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  ca1b80f7960a (3) added c
+       rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  $ cd ..
+
+Creating content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and relocating leads to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg init multiparent
+  $ cd multiparent
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg rebase -r . -d .^^^ --config extensions.rebase=
+  rebasing 4:c41c793e0ef1 "added d" (tip)
+  $ echo bar > c
+  $ hg add c
+  $ hg amend
+
+  $ hg up --hidden c41c793e0ef1
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
+  $ echo bar > d
+  $ hg amend
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  7:e49523854bc8 added d
+  |   () draft
+  | *  6:69bdd23a9b0d added d
+  | |   () draft
+  o |  3:ca1b80f7960a added c
+  | |   () draft
+  o |  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[7] added d
+  with: [6] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 69bdd23a9b0d on ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at e49523854bc8
+
+  $ hg glog
+  @  7:e49523854bc8 added d
+  |   () draft
+  | *  6:69bdd23a9b0d added d
+  | |   () draft
+  o |  3:ca1b80f7960a added c
+  | |   () draft
+  o |  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and merging divergent leads to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg up 69bdd23a9b0d
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rm c
+  $ echo wat > d
+  $ hg amend
+
+  $ hg glog
+  @  8:33e4442acf98 added d
+  |   () draft
+  | *  7:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[7] added d
+  with: [8] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset 'a663d1567f0b'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at 33e4442acf98
+
+  $ hg glog
+  @  8:33e4442acf98 added d
+  |   () draft
+  | *  7:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+  $ cd ..
+
+Tests for the --stop flag for `hg evolve` command while resolving content-divergence
+==================================================================================
+
+The `--stop` flag stops the interrupted evolution and delete the state file so
+user can do other things and comeback and do evolution later on
+
+This is testing cases when `hg evolve` command is doing content-divergence resolution.
+
+Setup
+=====
+
+  $ hg init stoprepo
+  $ cd stoprepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+  $ echo bar > d
+  $ hg amend
+
+  $ hg up c41c793e0ef1 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: e49523854bc8)
+
+  $ echo foobar > d
+  $ hg amend
+  2 new content-divergent changesets
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset 'e49523854bc8'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 9c1631e352d9
+
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Content divergence with parent change which will result in conflicts while
+merging
+---------------------------------------------------------------------------
+
+  $ hg rebase -r . -d .^^^ --config extensions.rebase=
+  rebasing 6:9c1631e352d9 "added d" (tip)
+
+  $ hg glog
+  @  7:517d4375cb72 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added d
+  with: [7] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset '606ad96040fc'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 517d4375cb72
+
+  $ hg glog
+  @  7:517d4375cb72 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Content-divergence with parent-change which will result in conflicts while
+relocation
+---------------------------------------------------------------------------
+
+  $ echo babar > c
+  $ hg add c
+  $ hg amend
+  $ hg glog
+  @  8:8fd1c4bd144c added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added d
+  with: [8] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r ca1b80f7960a c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: ca1b80f7960a - test: added c
+   foo
+  +=======
+  +babar
+  +>>>>>>> evolving:    8fd1c4bd144c - test: added d
+  diff -r ca1b80f7960a 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 @@
+  +foobar
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at ca1b80f7960a
+
+XXX: we should have preserved the wdir to be at rev 8
+  $ hg glog
+  *  8:8fd1c4bd144c added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | @  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+  $ cd ..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-meta.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,102 @@
++====================================================
++Tests the resolution of content divergence: metadata
++====================================================
+
+This file intend to cover cases focused around meta data merging.
+
+Setup
+-----
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > [phases]
+  > publish = False
+  > [extensions]
+  > rebase =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+Check we preserve the author properly
+-------------------------------------
+
+Testing issue6113 to make sure that content-divergence resolution don't
+replace initial author with the user running the resolution command:
+
+  $ hg init userfoo
+  $ cd userfoo
+  $ unset HGUSER
+  $ echo "[ui]" >> ./.hg/hgrc
+  $ echo "username = foo <foo@test.com>" >> ./.hg/hgrc
+  $ for ch in a b c; do
+  > echo $ch > $ch;
+  > hg add $ch;
+  > hg ci -m "added "$ch;
+  > done;
+
+  $ cd ..
+  $ hg init userbar
+  $ cd userbar
+  $ unset HGUSER
+  $ echo "[ui]" >> ./.hg/hgrc
+  $ echo "username = bar <bar@test.com>" >> ./.hg/hgrc
+  $ hg pull ./../userfoo -q
+
+  $ cd ../userfoo
+  $ hg up -r "desc('added b')"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo c > c
+  $ echo e > e
+  $ hg add c e
+  $ hg ci -m "added c e"
+  created new head
+
+  $ hg up -r "desc('added b')"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo cc > c
+  $ hg add c
+  $ hg ci -m "added c"
+  created new head
+
+  $ hg prune -r "min(desc('added c'))" -s "desc('added c e')"
+  1 changesets pruned
+  $ hg prune -r "min(desc('added c'))" -s "max(desc('added c'))" --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  4:6c06cda6dc99 added c
+  |   draft content-divergent
+  |
+  | *  3:0c9267e23c9d added c e
+  |/    draft content-divergent
+  |
+  o  1:1740ad2a1eda added b
+  |   draft
+  |
+  o  0:f863f39764c4 added a
+      draft
+  
+
+  $ cd ../userbar
+  $ hg pull ./../userfoo -q
+  2 new content-divergent changesets
+
+  $ hg evolve --content-divergent --any
+  merge:[3] added c e
+  with: [4] added c
+  base: [2] added c
+  updating to "local" side of the conflict: 0c9267e23c9d
+  merging "other" content-divergent changeset '6c06cda6dc99'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 443bd2972210
+
+Make sure resultant cset don't replace the initial user with user running the command:
+  $ hg log -r tip
+  changeset:   5:443bd2972210
+  tag:         tip
+  parent:      1:1740ad2a1eda
+  user:        foo <foo@test.com>
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c e
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-relocation.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,493 @@
+======================================================
+Tests the resolution of content divergence: relocation
+======================================================
+
+This file intend to cover case where changesets need to be moved to different parents
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [phases]
+  > publish = False
+  > [extensions]
+  > rebase =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+
+Testing resolution of content-divergent changesets when they are on different
+parents and resolution and relocation wont result in conflicts
+------------------------------------------------------------------------------
+
+  $ hg init multiparents
+  $ cd multiparents
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bar > b
+  $ hg amend
+  2 new orphan changesets
+
+  $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True
+  rebasing 2:b1661037fa25 "added b"
+  2 new content-divergent changesets
+
+  $ hg glog
+  *  6:da4b96f4a8d6 added b
+  |   () [default] draft
+  | @  5:7ed0642d644b added b
+  | |   () [default] draft
+  | | *  4:c41c793e0ef1 added d
+  | | |   () [default] draft
+  | | *  3:ca1b80f7960a added c
+  | | |   () [default] draft
+  | | x  2:b1661037fa25 added b
+  | |/    () [default] draft
+  | o  1:c7586e2a9264 added a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added b
+  with: [6] added b
+  base: [2] added b
+  rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264
+  updating to "local" side of the conflict: 7ed0642d644b
+  merging "other" content-divergent changeset '11f849d7159f'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 171614c9a791
+
+  $ hg glog
+  @  8:171614c9a791 added b
+  |   () [default] draft
+  | *  4:c41c793e0ef1 added d
+  | |   () [default] draft
+  | *  3:ca1b80f7960a added c
+  | |   () [default] draft
+  | x  2:b1661037fa25 added b
+  |/    () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 171614c9a7914c53f531373b95632323fdbbac8d
+  # Parent  c7586e2a92645e473645847a7b69a6dc52be4276
+  added b
+  
+  diff -r c7586e2a9264 -r 171614c9a791 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 @@
+  +bar
+
+Resolving orphans to get back to a normal graph
+
+  $ hg evolve --all
+  move:[3] added c
+  atop:[8] added b
+  move:[4] added d
+  working directory is now at 4ae4427ee9f8
+  $ hg glog
+  @  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+More testing!
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo x > x
+  $ hg ci -Aqm "added x"
+  $ hg glog -r .
+  @  11:71a392c714b5 added x
+  |   () [default] draft
+  ~
+
+  $ echo foo > x
+  $ hg branch bar
+  marked working directory as branch bar
+  (branches are permanent and global, did you want a bookmark?)
+  $ hg amend -m "added foo to x"
+
+  $ hg up 71a392c714b5 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 71a392c714b5
+  (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d)
+  working directory parent is obsolete! (71a392c714b5)
+  (use 'hg evolve' to update to its successor: 1e1a50385a7d)
+  $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True
+  rebasing 11:71a392c714b5 "added x"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  13:1e4f6b3bb39b added x
+  |   () [default] draft
+  | *  12:1e1a50385a7d added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[13] added x
+  with: [12] added foo to x
+  base: [11] added x
+  rebasing "other" content-divergent changeset 1e1a50385a7d on 4ae4427ee9f8
+  updating to "local" side of the conflict: 1e4f6b3bb39b
+  merging "other" content-divergent changeset '80cc9b1ec650'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at b006cf317e0e
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Branch bar
+  # Node ID b006cf317e0ed16dbe786c439577475580f645f1
+  # Parent  4ae4427ee9f8f0935211fd66360948b77ab5aee9
+  added foo to x
+  
+  diff -r 4ae4427ee9f8 -r b006cf317e0e 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 @@
+  +foo
+
+The above `hg exp` and the following log call demonstrates that message, content
+and branch change is preserved in case of relocation
+  $ hg glog
+  @  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Testing when both the content-divergence are on different parents and resolution
+will lead to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ echo y > y
+  $ hg ci -Aqm "added y"
+  $ hg glog -r .
+  @  16:fc6ad2bac162 added y
+  |   () [default] draft
+  ~
+
+  $ echo bar > y
+  $ hg amend
+
+  $ hg up fc6ad2bac162 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset fc6ad2bac162
+  (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba)
+  working directory parent is obsolete! (fc6ad2bac162)
+  (use 'hg evolve' to update to its successor: 2a9f6ccbdeba)
+  $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True
+  rebasing 16:fc6ad2bac162 "added y"
+  2 new content-divergent changesets
+  $ echo wat > y
+  $ hg amend
+
+  $ hg glog
+  @  19:b4575ed6fcfc added y
+  |   () [bar] draft
+  | *  17:2a9f6ccbdeba added y
+  | |   () [default] draft
+  o |  15:b006cf317e0e added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[19] added y
+  with: [17] added y
+  base: [16] added y
+  rebasing "other" content-divergent changeset 2a9f6ccbdeba on b006cf317e0e
+  updating to "local" side of the conflict: b4575ed6fcfc
+  merging "other" content-divergent changeset '48f745db3f53'
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo watbar > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 7bbcf24ddecf
+
+  $ hg glog
+  @  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg obslog -r . --all
+  @    7bbcf24ddecf (21) added y
+  |\
+  x |  48f745db3f53 (20) added y
+  | |    rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  b4575ed6fcfc (19) added y
+  | |    rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  x |  2a9f6ccbdeba (17) added y
+  | |    rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  96b677f01b81 (18) added y
+  |/     rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  fc6ad2bac162 (16) added y
+       rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+checking that relocated commit is there
+  $ hg exp 48f745db3f53 --hidden
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3
+  # Parent  b006cf317e0ed16dbe786c439577475580f645f1
+  added y
+  
+  diff -r b006cf317e0e -r 48f745db3f53 y
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar
+
+Testing when the relocation will result in conflicts and merging also:
+----------------------------------------------------------------------
+
+  $ hg glog
+  @  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up .^^^^
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+
+  $ echo z > z
+  $ hg ci -Aqm "added z"
+  $ hg glog -r .
+  @  22:daf1de08f3b0 added z
+  |   () [default] draft
+  ~
+
+  $ echo foo > y
+  $ hg add y
+  $ hg amend
+
+  $ hg up daf1de08f3b0 --hidden
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  updated to hidden changeset daf1de08f3b0
+  (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080)
+  working directory parent is obsolete! (daf1de08f3b0)
+  (use 'hg evolve' to update to its successor: 3f7a1f693080)
+  $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True
+  rebasing 22:daf1de08f3b0 "added z"
+  2 new content-divergent changesets
+  $ echo bar > z
+  $ hg amend
+
+  $ hg glog
+  @  25:53242575ffa9 added z
+  |   () [bar] draft
+  | *  23:3f7a1f693080 added z
+  | |   () [default] draft
+  o |  21:7bbcf24ddecf added y
+  | |   () [bar] draft
+  o |  15:b006cf317e0e added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent --any
+  merge:[25] added z
+  with: [23] added z
+  base: [22] added z
+  rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 7bbcf24ddecf y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 7bbcf24ddecf bar - test: added y
+   watbar
+  +=======
+  +foo
+  +>>>>>>> evolving:    3f7a1f693080 - test: added z
+  diff -r 7bbcf24ddecf z
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +z
+
+  $ echo foo > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 23:3f7a1f693080 "added z"
+  updating to "local" side of the conflict: 53242575ffa9
+  merging "other" content-divergent changeset 'cdb0643c69fc'
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 53242575ffa9 y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< local: 53242575ffa9 bar - test: added z
+   watbar
+  +=======
+  +foo
+  +>>>>>>> other: cdb0643c69fc - test: added z
+
+  $ echo foo > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 6fc7d9682de6
+
+  $ hg glog
+  @  27:6fc7d9682de6 added z
+  |   () [bar] draft
+  o  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Branch bar
+  # Node ID 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4
+  # Parent  7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b
+  added z
+  
+  diff -r 7bbcf24ddecf -r 6fc7d9682de6 y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -watbar
+  +foo
+  diff -r 7bbcf24ddecf -r 6fc7d9682de6 z
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar
+
+  $ cd ..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-stack.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,366 @@
+=================================================
+Tests the resolution of content divergence: stack
+=================================================
+
+This file intend to cover case with stacks of divergent changesets
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [phases]
+  > publish = False
+  > [extensions]
+  > rebase =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+Resolving content-divergence of a stack with same parents
+---------------------------------------------------------
+
+  $ hg init stacktest
+  $ cd stacktest
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+  $ hg init stack2
+  $ cd stack2
+  $ hg pull ../stacktest
+  pulling from ../stacktest
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 5 files
+  new changesets 8fa14d15e168:c41c793e0ef1 (5 drafts)
+  (run 'hg update' to get a working copy)
+  $ hg glog
+  o  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up c7586e2a9264
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  $ hg evolve --all
+  move:[2] added b
+  atop:[6] watbar to a
+  move:[3] added c
+  move:[4] added d
+  working directory is now at 15c781f93cac
+  $ hg glog
+  @  9:15c781f93cac added d
+  |   () [default] draft
+  o  8:9e5fb1d5b955 added c
+  |   () [default] draft
+  o  7:88516dccf68a added b
+  |   () [default] draft
+  o  6:82b74d5dc678 watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ../stacktest
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ hg evolve --all
+  move:[2] added b
+  atop:[5] watbar to a
+  move:[3] added c
+  move:[4] added d
+  working directory is now at c72d2885eb51
+  $ hg glog
+  @  8:c72d2885eb51 added d
+  |   () [default] draft
+  o  7:3ce4be6d8e5e added c
+  |   () [default] draft
+  o  6:d5f148423c16 added b
+  |   () [default] draft
+  o  5:8e222f257bbf watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg pull ../stack2
+  pulling from ../stack2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 4 files (+1 heads)
+  5 new obsolescence markers
+  8 new content-divergent changesets
+  new changesets 82b74d5dc678:15c781f93cac (4 drafts)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg glog
+  *  12:15c781f93cac added d
+  |   () [default] draft
+  *  11:9e5fb1d5b955 added c
+  |   () [default] draft
+  *  10:88516dccf68a added b
+  |   () [default] draft
+  *  9:82b74d5dc678 watbar to a
+  |   () [default] draft
+  | @  8:c72d2885eb51 added d
+  | |   () [default] draft
+  | *  7:3ce4be6d8e5e added c
+  | |   () [default] draft
+  | *  6:d5f148423c16 added b
+  | |   () [default] draft
+  | *  5:8e222f257bbf watbar to a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --all --content-divergent
+  merge:[5] watbar to a
+  with: [9] watbar to a
+  base: [1] added a
+  updating to "local" side of the conflict: 8e222f257bbf
+  merging "other" content-divergent changeset '82b74d5dc678'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  6 new orphan changesets
+  merge:[6] added b
+  with: [10] added b
+  base: [2] added b
+  updating to "local" side of the conflict: d5f148423c16
+  merging "other" content-divergent changeset '88516dccf68a'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[7] added c
+  with: [11] added c
+  base: [3] added c
+  updating to "local" side of the conflict: 3ce4be6d8e5e
+  merging "other" content-divergent changeset '9e5fb1d5b955'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[8] added d
+  with: [12] added d
+  base: [4] added d
+  updating to "local" side of the conflict: c72d2885eb51
+  merging "other" content-divergent changeset '15c781f93cac'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 038fe7db3d88
+
+  $ hg glog
+  @  16:038fe7db3d88 added d
+  |   () [default] draft
+  o  15:b2cac10f3836 added c
+  |   () [default] draft
+  o  14:eadfd9d70680 added b
+  |   () [default] draft
+  o  13:f66f262fff6c watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+Resolving content-divergence of a stack with different parents
+---------------------------------------------------------
+
+  $ cd ..
+  $ hg init stackrepo1
+  $ cd stackrepo1
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+
+  $ for ch in a b c d;
+  > do echo foo > $ch;
+  > hg add $ch;
+  > hg ci -qm "added "$ch;
+  > done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+  $ hg init stackrepo2
+  $ cd stackrepo2
+  $ hg pull ../stackrepo1
+  pulling from ../stackrepo1
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 5 files
+  new changesets 8fa14d15e168:c41c793e0ef1 (5 drafts)
+  (run 'hg update' to get a working copy)
+
+  $ hg glog
+  o  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up 8fa14d15e168
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo newfile > newfile
+  $ hg ci -Am "add newfile"
+  adding newfile
+  created new head
+  $ hg rebase -s c7586e2a9264 -d .
+  rebasing 1:c7586e2a9264 "added a"
+  rebasing 2:b1661037fa25 "added b"
+  rebasing 3:ca1b80f7960a "added c"
+  rebasing 4:c41c793e0ef1 "added d"
+
+  $ hg glog
+  o  9:d45f050514c2 added d
+  |   () [default] draft
+  o  8:8ed612937375 added c
+  |   () [default] draft
+  o  7:6eb54b5af3fb added b
+  |   () [default] draft
+  o  6:c04ff147ef79 added a
+  |   () [default] draft
+  @  5:2228e3b74514 add newfile
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ../stackrepo1
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ hg evolve --all
+  move:[2] added b
+  atop:[5] watbar to a
+  move:[3] added c
+  move:[4] added d
+  working directory is now at c72d2885eb51
+
+  $ hg glog
+  @  8:c72d2885eb51 added d
+  |   () [default] draft
+  o  7:3ce4be6d8e5e added c
+  |   () [default] draft
+  o  6:d5f148423c16 added b
+  |   () [default] draft
+  o  5:8e222f257bbf watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg pull ../stackrepo2
+  pulling from ../stackrepo2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 1 changes to 5 files (+1 heads)
+  4 new obsolescence markers
+  8 new content-divergent changesets
+  new changesets 2228e3b74514:d45f050514c2 (5 drafts)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg glog
+  *  13:d45f050514c2 added d
+  |   () [default] draft
+  *  12:8ed612937375 added c
+  |   () [default] draft
+  *  11:6eb54b5af3fb added b
+  |   () [default] draft
+  *  10:c04ff147ef79 added a
+  |   () [default] draft
+  o  9:2228e3b74514 add newfile
+  |   () [default] draft
+  | @  8:c72d2885eb51 added d
+  | |   () [default] draft
+  | *  7:3ce4be6d8e5e added c
+  | |   () [default] draft
+  | *  6:d5f148423c16 added b
+  | |   () [default] draft
+  | *  5:8e222f257bbf watbar to a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --all --content-divergent
+  merge:[10] added a
+  with: [5] watbar to a
+  base: [1] added a
+  rebasing "other" content-divergent changeset 8e222f257bbf on 2228e3b74514
+  updating to "local" side of the conflict: c04ff147ef79
+  merging "other" content-divergent changeset '186bdc2cdfa2'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  6 new orphan changesets
+  merge:[11] added b
+  with: [6] added b
+  base: [2] added b
+  rebasing "other" content-divergent changeset d5f148423c16 on c04ff147ef79
+  updating to "local" side of the conflict: 6eb54b5af3fb
+  merging "other" content-divergent changeset '8542f15656e7'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[12] added c
+  with: [7] added c
+  base: [3] added c
+  rebasing "other" content-divergent changeset 3ce4be6d8e5e on 6eb54b5af3fb
+  updating to "local" side of the conflict: 8ed612937375
+  merging "other" content-divergent changeset 'a690ce53104a'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[13] added d
+  with: [8] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset c72d2885eb51 on 8ed612937375
+  updating to "local" side of the conflict: d45f050514c2
+  merging "other" content-divergent changeset '1d1772990a3b'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 5f7a38bdb75c
+
+  $ hg glog
+  @  21:5f7a38bdb75c added d
+  |   () [default] draft
+  o  19:9865d598f0e0 added c
+  |   () [default] draft
+  o  17:ac70b8c8eb63 added b
+  |   () [default] draft
+  o  15:74fbf3e6a0b6 watbar to a
+  |   () [default] draft
+  o  9:2228e3b74514 add newfile
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+  $ cd ..
--- a/tests/test-evolve-continue.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-continue.t	Thu Apr 11 22:41:25 2019 +0200
@@ -31,7 +31,7 @@
   o  0:8fa14d15e168 added hgignore
       () draft
 
-Simple case of evolve --continue
+Simple case of evolve --continue (with --[no-]update flag)
 
   $ hg up ca1b80f7960a
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -53,7 +53,7 @@
   o  0:8fa14d15e168 added hgignore
       () draft
 
-  $ hg evolve --all
+  $ hg evolve --all --no-update
   move:[4] added d
   atop:[5] added c
   merging d
@@ -68,12 +68,12 @@
 
   $ hg evolve --continue
   evolving 4:c41c793e0ef1 "added d"
-  working directory is now at 2a4e03d422e2
+  working directory is now at cb6a2ab625bb
 
   $ hg glog
-  @  6:2a4e03d422e2 added d
+  o  6:2a4e03d422e2 added d
   |   () draft
-  o  5:cb6a2ab625bb added c
+  @  5:cb6a2ab625bb added c
   |   () draft
   o  2:b1661037fa25 added b
   |   () draft
@@ -82,6 +82,9 @@
   o  0:8fa14d15e168 added hgignore
       () draft
 
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 Case when conflicts resolution lead to empty wdir in evolve --continue
 
   $ echo foo > e
@@ -127,6 +130,7 @@
   $ hg evolve --continue
   evolving 7:ad0a59d83efe "added e"
   evolution of 7:ad0a59d83efe created no changes to commit
+  working directory is now at 00a5c774cc37
 
   $ hg glog
   @  8:00a5c774cc37 added d
@@ -306,8 +310,6 @@
   (no more unresolved files)
   continue: hg evolve --continue
 
-XXX: this should have asked for confirmation
-
   $ hg evolve --continue<<EOF
   > y
   > EOF
@@ -356,3 +358,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
--- a/tests/test-evolve-issue5832.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-issue5832.t	Thu Apr 11 22:41:25 2019 +0200
@@ -112,17 +112,17 @@
 Resolving instability using `hg evolve`
 
   $ hg evolve --any --all --config ui.interactive=True <<EOF
-  > 0
+  > 1
   > EOF
   move:[2] added b
   atop:[5] added a
   move:[4] merge commit
   ancestor '7235ef625ea3' split over multiple topological branches.
   choose an evolve destination:
-  0: [62fb70414f99] added c
-  1: [5841d7cf9893] added d
+  1: [62fb70414f99] added c
+  2: [5841d7cf9893] added d
   q: quit the prompt
-  enter the index of the revision you want to select: 0
+  enter the index of the revision you want to select: 1
   move:[9] merge commit
   atop:[6] added c
   working directory is now at 28a0775ac832
@@ -253,17 +253,17 @@
   could not solve instability, ambiguous destination: parent split across two branches
 
   $ hg evolve --any --all --config ui.interactive=True <<EOF
-  > 1
+  > 2
   > EOF
   move:[2] added b
   atop:[6] added a
   move:[4] merge commit
   ancestor 'cdf2ea1b9312' split over multiple topological branches.
   choose an evolve destination:
-  0: [62fb70414f99] added c
-  1: [5841d7cf9893] added d
+  1: [62fb70414f99] added c
+  2: [5841d7cf9893] added d
   q: quit the prompt
-  enter the index of the revision you want to select: 1
+  enter the index of the revision you want to select: 2
   move:[10] merge commit
   atop:[8] added d
   working directory is now at 460e6e72b7f9
@@ -398,16 +398,16 @@
   could not solve instability, ambiguous destination: parent split across two branches
 
   $ hg evolve --any --all --config ui.interactive=True <<EOF
-  > 1
+  > 2
   > EOF
   move:[2] added b
   atop:[6] added a
   ancestor 'b9b387427a53' split over multiple topological branches.
   choose an evolve destination:
-  0: [62fb70414f99] added c
-  1: [5841d7cf9893] added d
+  1: [62fb70414f99] added c
+  2: [5841d7cf9893] added d
   q: quit the prompt
-  enter the index of the revision you want to select: 1
+  enter the index of the revision you want to select: 2
   move:[4] merge commit
   atop:[8] added d
   move:[10] merge commit
--- a/tests/test-evolve-list.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-list.t	Thu Apr 11 22:41:25 2019 +0200
@@ -5,7 +5,7 @@
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
 
-Test the instability listing
+Test listing orphan changesets
   $ hg init r2
   $ cd r2
   $ echo a > a && hg ci -Am a
@@ -27,7 +27,7 @@
   
   $ cd ..
 
-Test the bumpedness listing
+Test listing phase-divergent changesets
   $ hg init r3
   $ cd r3
   $ echo a > a && hg ci -Am a
@@ -41,7 +41,7 @@
   
   $ cd ..
 
-Test the divergence listing
+Test listing content-divergent changesets
   $ hg init r1
   $ cd r1
   $ echo a > a && hg ci -Am a
--- a/tests/test-evolve-obshistory-lots-of-splits.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Thu Apr 11 22:41:25 2019 +0200
@@ -6,8 +6,8 @@
 
   $ . $TESTDIR/testlib/obshistory_setup.sh
 
-Test output with lots of splitted commit
-========================================
+Test output with lots of split commit
+=====================================
 
 Test setup
 ----------
--- a/tests/test-evolve-obshistory-split.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-obshistory-split.t	Thu Apr 11 22:41:25 2019 +0200
@@ -6,8 +6,8 @@
 
   $ . $TESTDIR/testlib/obshistory_setup.sh
 
-Test output with splitted commit
-================================
+Test output with split commit
+=============================
 
 Test setup
 ----------
@@ -98,7 +98,7 @@
 Check output on the client side
 -------------------------------
 
-Check that debugobshistory on splitted commit show both targets
+Check that debugobshistory on split commit show both targets
   $ hg obslog 471597cad322 --hidden --patch
   x  471597cad322 (1) A0
        rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
@@ -134,7 +134,7 @@
       }
   ]
 Check that debugobshistory on the first successor after split show
-the revision plus the splitted one
+the revision plus the split one
   $ hg obslog 337fec4d2edc --patch
   o  337fec4d2edc (2) A0
   |
@@ -155,7 +155,7 @@
          (No patch available, too many successors (2))
   
 Check that debugobshistory on the second successor after split show
-the revision plus the splitted one
+the revision plus the split one
   $ hg obslog f257fde29c7a --patch
   @  f257fde29c7a (3) A0
   |
@@ -175,7 +175,7 @@
          note: testing split
          (No patch available, too many successors (2))
   
-Obslog with all option all should also works on the splitted commit
+Obslog with all option all should also works on the split commit
   $ hg obslog -a 471597cad322 --hidden --patch
   o  337fec4d2edc (2) A0
   |
--- a/tests/test-evolve-order.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-order.t	Thu Apr 11 22:41:25 2019 +0200
@@ -231,8 +231,8 @@
   |
   ~
 
-Test multiple revision with some un-evolvable because parent is splitted
-------------------------------------------------------------------------
+Test multiple revision with some un-evolvable because parent is split
+---------------------------------------------------------------------
 
   $ hg up 'desc(c2prime)'
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-evolve-orphan-split.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-orphan-split.t	Thu Apr 11 22:41:25 2019 +0200
@@ -19,8 +19,8 @@
   $ hg add .hgignore
   $ hg ci -m "added hgignore"
 
-An orphan changeset with parent got splitted
---------------------------------------------
+An orphan changeset with parent got split
+-----------------------------------------
 
   $ for ch in a b c; do echo foo > $ch; done;
 
@@ -182,27 +182,27 @@
       () draft
 
   $ hg evolve --dry-run <<EOF
-  > 0
+  > 1
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
-  enter the index of the revision you want to select: 0
+  enter the index of the revision you want to select: 1
   move:[7] added d
   atop:[8] added a b c
   hg rebase -r d48a30875f01 -d f2632392aefe
 
   $ hg evolve --dry-run <<EOF
-  > 1
+  > 2
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
-  enter the index of the revision you want to select: 1
+  enter the index of the revision you want to select: 2
   move:[7] added d
   atop:[10] added a b c
   hg rebase -r d48a30875f01 -d 7f87764e5b64
@@ -215,8 +215,8 @@
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
   enter the index of the revision you want to select: foo
   invalid value 'foo' entered for index
@@ -227,8 +227,8 @@
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
   enter the index of the revision you want to select: 4
   invalid value '4' entered for index
@@ -239,8 +239,8 @@
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
   enter the index of the revision you want to select: -1
   invalid value '-1' entered for index
@@ -251,8 +251,8 @@
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
   enter the index of the revision you want to select: q
   could not solve instability, ambiguous destination: parent split across two branches
@@ -264,10 +264,10 @@
   > EOF
   ancestor 'd48a30875f01' split over multiple topological branches.
   choose an evolve destination:
-  0: [f2632392aefe] added a b c
-  1: [7f87764e5b64] added a b c
+  1: [f2632392aefe] added a b c
+  2: [7f87764e5b64] added a b c
   q: quit the prompt
   enter the index of the revision you want to select: 1
   move:[7] added d
-  atop:[10] added a b c
-  working directory is now at 1c6caa7c902a
+  atop:[8] added a b c
+  working directory is now at 71e4d45a7aaa
--- a/tests/test-evolve-phase-divergence.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-phase-divergence.t	Thu Apr 11 22:41:25 2019 +0200
@@ -1,11 +1,15 @@
 ** Test for handling of phase divergent changesets by `hg evolve` **
 ====================================================================
 
+  $ . $TESTDIR/testlib/common.sh
+
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) {phase}"
   > [extensions]
   > rebase =
+  > [extensions]
+  > evolve =
   > EOF
 
 Setting up a public repo
@@ -28,11 +32,11 @@
 Setting up a private non-publishing repo
 ----------------------------------------
 
-  $ hg clone -U public private
+  $ hg clone public private
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd private
   $ cat >> .hg/hgrc <<EOF
-  > [extensions]
-  > evolve = $evolvepath
   > [ui]
   > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
   > [phases]
@@ -45,6 +49,13 @@
 
   $ cp -a private alice
   $ cp -a private bob
+  $ cp -a private split
+  $ cp -a private split-across-branches
+  $ cp -a private split-and-amend
+  $ cp -a private merge-no-conflict
+
+Simple phase-divergence case
+============================
 
 Creating a phase-divergence changeset
 -------------------------------------
@@ -52,8 +63,6 @@
 Alice creating a draft changeset and pushing to main private repo
 
   $ cd alice
-  $ hg update
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo a >> a
   $ hg commit -u alice -m 'modify a'
   $ hg push ../private
@@ -86,7 +95,7 @@
   $ hg glog
   o  1:4d1169d82e47 modify a
   |   () draft
-  o  0:d3873e73d99e init
+  @  0:d3873e73d99e init
       () public
 
   $ hg push ../public
@@ -100,7 +109,7 @@
   $ hg glog
   o  1:4d1169d82e47 modify a
   |   () public
-  o  0:d3873e73d99e init
+  @  0:d3873e73d99e init
       () public
 
 *But* Alice decided to amend the changeset she had and then pulling from public
@@ -193,8 +202,7 @@
   $ hg evolve --phase-divergent
   recreate:[2] tweak a
   atop:[1] modify a
-  computing new diff
-  committed as 4d1169d82e47
+  no changes to commit
   working directory is now at 4d1169d82e47
 
   $ hg glog
@@ -225,9 +233,11 @@
   2 new obsolescence markers
   [1]
 
+phase-divergence that lead to new commit and bookmark movement
+==============================================================
+
 Creating more phase-divergence where a new resolution commit will be formed and
 also testing bookmark movement
---------------------------------------------------------------------------------
 
 Alice created a commit and push to private non-publishing repo
 
@@ -308,7 +318,6 @@
   $ hg evolve --phase-divergent
   recreate:[4] added bar to foo
   atop:[3] added foo to foo
-  computing new diff
   committed as 3d62500c673d
   working directory is now at 3d62500c673d
 
@@ -386,11 +395,14 @@
   added 1 changesets with 1 changes to 1 files
   2 new obsolescence markers
 
+
+phase divergence rebasing back to old changeset - with (unrelated?) conflict
+============================================================================
+
 Creating a phasedivergence changeset where the divergent changeset changed in a
 way that we rebase that on old public changeset, there will be conflicts, but
 the `hg evolve` command handles it very well and uses `hg revert` logic to
 prevent any conflicts
--------------------------------------------------------------------------------
 
 Alice creates one more changeset and pushes to private repo
 
@@ -459,7 +471,6 @@
   $ hg evolve --phase-divergent
   recreate:[7] foo to bar
   atop:[6] added bar to bar
-  computing new diff
   committed as 502e73736632
   working directory is now at 502e73736632
 
@@ -515,9 +526,11 @@
   added 1 changesets with 1 changes to 1 files
   2 new obsolescence markers
 
+different parents for successors and predecessors
+=================================================
+
 Creating phase-divergence with divergent changeset and precursor having
 different parents
------------------------------------------------------------------------
 
 Alice creates a changeset and pushes to private repo
 
@@ -596,8 +609,7 @@
   atop:[9] added x to x
   rebasing to destination parent: 502e73736632
   (leaving bookmark bm)
-  computing new diff
-  committed as 2352021b3785
+  no changes to commit
   working directory is now at 2352021b3785
 
 XXX: we should move bookmark here
@@ -643,9 +655,11 @@
   @@ -0,0 +1,1 @@
   +x
 
-Creating divergence with parent and content change both but not resulting in
+divergence with parent+content change both, no conflict
+=======================================================
+
+Creating divergence with parent cand content change both but not resulting in
 conflicts
------------------------------------------------------------------------------
 
 Alice is tired of pushing and pulling and will create phase-divergence locally
 
@@ -715,7 +729,6 @@
   recreate:[14] y to y and foobar to foo
   atop:[12] y to y and foobar to foo
   rebasing to destination parent: 2352021b3785
-  computing new diff
   committed as 8c2bb6fb44e9
   working directory is now at 8c2bb6fb44e9
 
@@ -757,9 +770,11 @@
   o  0:d3873e73d99e init
       () public
 
+divergence with parent+content change both, with conflict
+=========================================================
+
 Creating divergence with parent and content change both which results in
 conflicts while rebasing on parent
------------------------------------------------------------------------------
 
   $ echo l > l
   $ hg ci -Aqm "added l to l"
@@ -819,7 +834,6 @@
 
   $ hg evolve --continue
   evolving 19:5fd38c0de46e "added l to l"
-  computing new diff
   committed as e3090241a10c
   working directory is now at e3090241a10c
 
@@ -916,8 +930,7 @@
   recreate:[24] added f
   atop:[23] added g
   rebasing to destination parent: 21ae52e414e6
-  computing new diff
-  committed as 428f7900a969
+  no changes to commit
   working directory is now at 428f7900a969
 
   $ hg glog -r f3794e5a91dc::
@@ -931,127 +944,141 @@
   |   () public
   ~
 
-When the public changesets is splitted causing phase-divergence
----------------------------------------------------------------
+When the public changesets is split causing phase-divergence
+------------------------------------------------------------
+
+  $ cd ../split
 
   $ echo m > m
   $ echo n > n
   $ hg ci -Aqm "added m and n"
 
-  $ hg glog -r 21ae52e414e6::
-  @  26:849cee0a874b added m and n
+  $ hg glog
+  @  1:a51bce62c219 added m and n
   |   () draft
-  o  23:428f7900a969 added g
-  |   () public
-  o  22:21ae52e414e6 added f
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg prev
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  [23] added g
+  [0] init
   $ echo m > m
   $ hg ci -Aqm "added m"
   $ echo n > n
   $ hg ci -Aqm "added n"
 
-  $ hg glog -r 428f7900a969::
-  @  28:63ccb8ea7cae added n
+  $ hg glog
+  @  3:e1154ec0206a added n
   |   () draft
-  o  27:f313e2b90e70 added m
+  o  2:4f25cd9cd2bf added m
   |   () draft
-  | o  26:849cee0a874b added m and n
+  | o  1:a51bce62c219 added m and n
   |/    () draft
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 849cee0a874b --succ f313e2b90e70 --succ 63ccb8ea7cae --split
+  $ hg prune -r a51bce62c219 --succ 4f25cd9cd2bf --succ e1154ec0206a --split
   1 changesets pruned
 
-  $ hg phase -r 849cee0a874b --hidden --public
+  $ hg phase -r a51bce62c219 --hidden --public
   2 new phase-divergent changesets
 
-  $ hg glog -r 428f7900a969::
-  @  28:63ccb8ea7cae added n
+  $ hg glog
+  @  3:e1154ec0206a added n
   |   () draft
-  *  27:f313e2b90e70 added m
+  *  2:4f25cd9cd2bf added m
   |   () draft
-  | o  26:849cee0a874b added m and n
+  | o  1:a51bce62c219 added m and n
   |/    () public
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg evolve --all --phase-divergent
-  recreate:[27] added m
-  atop:[26] added m and n
-  computing new diff
-  committed as 870e1c3eddc3
+  recreate:[2] added m
+  atop:[1] added m and n
+  committed as 86419909e017
   1 new orphan changesets
-  recreate:[28] added n
-  atop:[26] added m and n
-  rebasing to destination parent: 428f7900a969
-  computing new diff
-  committed as 154b0179fb9b
-  working directory is now at 154b0179fb9b
+  recreate:[3] added n
+  atop:[1] added m and n
+  rebasing to destination parent: d3873e73d99e
+  committed as 89ba615ea1ec
+  working directory is now at 89ba615ea1ec
 
 XXX: this is messy, we should solve things in better way
-  $ hg glog -r 428f7900a969:: --hidden
-  @  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  $ hg glog --hidden
+  @  6:89ba615ea1ec phase-divergent update to a51bce62c219:
   |   () draft
-  | x  30:1ebf33547a82 added n
+  | x  5:ee4af146c5cf added n
   | |   () draft
-  +---o  29:870e1c3eddc3 phase-divergent update to 849cee0a874b:
+  +---o  4:86419909e017 phase-divergent update to a51bce62c219:
   | |     () draft
-  | | x  28:63ccb8ea7cae added n
+  | | x  3:e1154ec0206a added n
   | | |   () draft
-  | | x  27:f313e2b90e70 added m
+  | | x  2:4f25cd9cd2bf added m
   | |/    () draft
-  o |  26:849cee0a874b added m and n
+  o |  1:a51bce62c219 added m and n
   |/    () public
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r a51bce62c219 --all
+  o  86419909e017 (4) phase-divergent update to a51bce62c219:
+  |
+  | @  89ba615ea1ec (6) phase-divergent update to a51bce62c219:
+  | |
+  x |  4f25cd9cd2bf (2) added m
+  | |    rewritten(description, parent, content) as 86419909e017 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  ee4af146c5cf (5) added n
+  | |    rewritten(description, parent, content) as 89ba615ea1ec using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  e1154ec0206a (3) added n
+  |/     rewritten(parent) as ee4af146c5cf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  a51bce62c219 (1) added m and n
+       rewritten(description, parent, content) as 4f25cd9cd2bf, e1154ec0206a using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
 
 XXX: not sure this is the correct
-  $ hg exp 154b0179fb9b
+  $ hg exp 89ba615ea1ec
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 154b0179fb9b53d2f853d6ba04740bb3d7a5cabe
-  # Parent  849cee0a874be7c4e75dfacb5ad72aa5696951ba
-  phase-divergent update to 849cee0a874b:
+  # Node ID 89ba615ea1ec3ba5b25db9f7897eb29712d7e5d6
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
   
   added n
   
-  diff -r 849cee0a874b -r 154b0179fb9b m
+  diff -r a51bce62c219 -r 89ba615ea1ec m
   --- a/m	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -m
 
 XXX: not sure this is correct
-  $ hg exp 870e1c3eddc3
+  $ hg exp 86419909e017
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 870e1c3eddc34cc475e8e13d2fe1934210c1937e
-  # Parent  849cee0a874be7c4e75dfacb5ad72aa5696951ba
-  phase-divergent update to 849cee0a874b:
+  # Node ID 86419909e01787959aa6471aee605c6d604a3e0d
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
   
   added m
   
-  diff -r 849cee0a874b -r 870e1c3eddc3 n
+  diff -r a51bce62c219 -r 86419909e017 n
   --- a/n	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -n
 
-When the public changeset is splitted across various branches
---------------------------------------------------------------
+When the public changeset is split across various topological branches
+======================================================================
+
+  $ cd ../split-across-branches
 
   $ echo p > p
   $ echo q > q
@@ -1059,177 +1086,870 @@
 
   $ hg prev
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  [31] phase-divergent update to 849cee0a874b:
+  [0] init
   $ echo p > p
   $ hg ci -Aqm "added p"
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [31] phase-divergent update to 849cee0a874b:
+  [0] init
   $ echo q > q
   $ hg ci -Aqm "added q"
 
-  $ hg glog -r 154b0179fb9b::
-  @  34:e046341aa97c added q
+  $ hg glog
+  @  3:bb87595f9a77 added q
   |   () draft
-  | o  33:6f8c250eecff added p
+  | o  2:a47263294745 added p
   |/    () draft
-  | o  32:8a70f55b2af3 added p and q
+  | o  1:90859808ece6 added p and q
   |/    () draft
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 8a70f55b2af3 --succ 6f8c250eecff --succ e046341aa97c --split
+  $ hg prune -r 90859808ece6 --succ a47263294745 --succ bb87595f9a77 --split
   1 changesets pruned
 
-  $ hg phase -r 8a70f55b2af3 --public --hidden
+  $ hg phase -r 90859808ece6 --public --hidden
   2 new phase-divergent changesets
 
-  $ hg glog -r 154b0179fb9b::
-  @  34:e046341aa97c added q
+  $ hg glog
+  @  3:bb87595f9a77 added q
   |   () draft
-  | *  33:6f8c250eecff added p
+  | *  2:a47263294745 added p
   |/    () draft
-  | o  32:8a70f55b2af3 added p and q
+  | o  1:90859808ece6 added p and q
   |/    () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg evolve --list
-  6f8c250eecff: added p
-    phase-divergent: 8a70f55b2af3 (immutable precursor)
+  a47263294745: added p
+    phase-divergent: 90859808ece6 (immutable precursor)
   
-  e046341aa97c: added q
-    phase-divergent: 8a70f55b2af3 (immutable precursor)
+  bb87595f9a77: added q
+    phase-divergent: 90859808ece6 (immutable precursor)
   
   $ hg evolve --all --phase-divergent
-  recreate:[33] added p
-  atop:[32] added p and q
-  computing new diff
-  committed as f3e41d89b3c5
-  recreate:[34] added q
-  atop:[32] added p and q
-  computing new diff
-  committed as 605c306d4f87
-  working directory is now at 605c306d4f87
+  recreate:[2] added p
+  atop:[1] added p and q
+  committed as 25875a9cb640
+  recreate:[3] added q
+  atop:[1] added p and q
+  committed as 26f564f94bcc
+  working directory is now at 26f564f94bcc
 
-  $ hg glog -r 154b0179fb9b:: --hidden
-  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
+  $ hg glog --hidden
+  @  5:26f564f94bcc phase-divergent update to 90859808ece6:
   |   () draft
-  | o  35:f3e41d89b3c5 phase-divergent update to 8a70f55b2af3:
+  | o  4:25875a9cb640 phase-divergent update to 90859808ece6:
   |/    () draft
-  | x  34:e046341aa97c added q
+  | x  3:bb87595f9a77 added q
   | |   () draft
-  | | x  33:6f8c250eecff added p
+  | | x  2:a47263294745 added p
   | |/    () draft
-  o |  32:8a70f55b2af3 added p and q
+  o |  1:90859808ece6 added p and q
   |/    () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r 90859808ece6 --all
+  o  25875a9cb640 (4) phase-divergent update to 90859808ece6:
+  |
+  | @  26f564f94bcc (5) phase-divergent update to 90859808ece6:
+  | |
+  x |  a47263294745 (2) added p
+  | |    rewritten(description, parent, content) as 25875a9cb640 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  bb87595f9a77 (3) added q
+  |/     rewritten(description, parent, content) as 26f564f94bcc using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  90859808ece6 (1) added p and q
+       rewritten(description, content) as a47263294745, bb87595f9a77 using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
 
 XXX: not sure this is correct
-  $ hg exp 605c306d4f87
+  $ hg exp 26f564f94bcc
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 605c306d4f87fccfdb5e7dd1c750b6d4f813defb
-  # Parent  8a70f55b2af35452916dc89401a5ecf6553646a5
-  phase-divergent update to 8a70f55b2af3:
+  # Node ID 26f564f94bcc34e049eb112fd14ab1e5286f2325
+  # Parent  90859808ece64c9ca64dd29992db42353c70f164
+  phase-divergent update to 90859808ece6:
   
   added q
   
-  diff -r 8a70f55b2af3 -r 605c306d4f87 p
+  diff -r 90859808ece6 -r 26f564f94bcc p
   --- a/p	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -p
 
 XXX: not sure this is correct
-  $ hg exp f3e41d89b3c5
+  $ hg exp 25875a9cb640
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID f3e41d89b3c5f6ee49ccc734045856d7b025f048
-  # Parent  8a70f55b2af35452916dc89401a5ecf6553646a5
-  phase-divergent update to 8a70f55b2af3:
+  # Node ID 25875a9cb6400973b846c94f6a80410067c2cb1f
+  # Parent  90859808ece64c9ca64dd29992db42353c70f164
+  phase-divergent update to 90859808ece6:
   
   added p
   
-  diff -r 8a70f55b2af3 -r f3e41d89b3c5 q
+  diff -r 90859808ece6 -r 25875a9cb640 q
   --- a/q	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -q
 
-Testing the evolution of a phase-divergent merge with no conflicts
-------------------------------------------------------------------
+When the public changeset is split and amended
+==============================================
+
+  $ cd ../split-and-amend
+
+  $ echo m > m
+  $ echo n > n
+  $ hg ci -Aqm "added m and n"
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [0] init
+  $ echo m > m
+  $ hg ci -Aqm "added m"
+  $ echo n > n
+  $ hg ci -Aqm "added n"
+
+  $ hg glog
+  @  3:e1154ec0206a added n
+  |   () draft
+  o  2:4f25cd9cd2bf added m
+  |   () draft
+  | o  1:a51bce62c219 added m and n
+  |/    () draft
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg prune -r a51bce62c219 --succ 4f25cd9cd2bf --succ e1154ec0206a --split
+  1 changesets pruned
+
+  $ echo n2 > n
+  $ hg amend
 
-  $ hg glog -r 154b0179fb9b::
-  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
+  $ hg phase -r a51bce62c219 --public --hidden
+  2 new phase-divergent changesets
+
+  $ hg glog
+  @  4:52ca78bb98c7 added n
+  |   () draft
+  *  2:4f25cd9cd2bf added m
+  |   () draft
+  | o  1:a51bce62c219 added m and n
+  |/    () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg evolve --list
+  4f25cd9cd2bf: added m
+    phase-divergent: a51bce62c219 (immutable precursor)
+  
+  52ca78bb98c7: added n
+    phase-divergent: a51bce62c219 (immutable precursor)
+  
+  $ hg evolve --all --phase-divergent
+  recreate:[2] added m
+  atop:[1] added m and n
+  committed as 86419909e017
+  1 new orphan changesets
+  recreate:[4] added n
+  atop:[1] added m and n
+  rebasing to destination parent: d3873e73d99e
+  committed as 88b0dae5369a
+  working directory is now at 88b0dae5369a
+
+  $ hg glog --hidden
+  @  7:88b0dae5369a phase-divergent update to a51bce62c219:
   |   () draft
-  | o  35:f3e41d89b3c5 phase-divergent update to 8a70f55b2af3:
-  |/    () draft
-  o  32:8a70f55b2af3 added p and q
-  |   () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  | x  6:98dad8812511 added n
+  | |   () draft
+  +---o  5:86419909e017 phase-divergent update to a51bce62c219:
+  | |     () draft
+  | | x  4:52ca78bb98c7 added n
+  | | |   () draft
+  | | | x  3:e1154ec0206a added n
+  | | |/    () draft
+  | | x  2:4f25cd9cd2bf added m
+  | |/    () draft
+  o |  1:a51bce62c219 added m and n
+  |/    () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r a51bce62c219 --all
+  o  86419909e017 (5) phase-divergent update to a51bce62c219:
+  |
+  | @  88b0dae5369a (7) phase-divergent update to a51bce62c219:
+  | |
+  x |  4f25cd9cd2bf (2) added m
+  | |    rewritten(description, parent, content) as 86419909e017 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  98dad8812511 (6) added n
+  | |    rewritten(description, parent, content) as 88b0dae5369a using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  52ca78bb98c7 (4) added n
+  | |    rewritten(parent) as 98dad8812511 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  e1154ec0206a (3) added n
+  |/     rewritten(content) as 52ca78bb98c7 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  a51bce62c219 (1) added m and n
+       rewritten(description, parent, content) as 4f25cd9cd2bf, e1154ec0206a using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+XXX: not sure this is correct
+  $ hg exp 86419909e017
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 86419909e01787959aa6471aee605c6d604a3e0d
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
+  
+  added m
+  
+  diff -r a51bce62c219 -r 86419909e017 n
+  --- a/n	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -n
+
+XXX: not sure this is correct
+  $ hg exp 88b0dae5369a
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 88b0dae5369aaa3bceb6c0b647542594e2c72fb7
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
+  
+  added n
+  
+  diff -r a51bce62c219 -r 88b0dae5369a m
+  --- a/m	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -m
+  diff -r a51bce62c219 -r 88b0dae5369a n
+  --- a/n	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/n	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -n
+  +n2
+
+Testing the evolution of a phase-divergent merge with no conflicts
+==================================================================
+
+  $ cd ../merge-no-conflict
 
   $ echo h > h
   $ hg ci -Aqm "added h"
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [36] phase-divergent update to 8a70f55b2af3:
+  [0] init
   $ echo i > i
   $ hg ci -Aqm "added i"
-  $ hg merge -r ef8c23f37b55
+  $ hg merge -r a53d182199c1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci -m "merge h and i"
 
-  $ hg glog -r 605c306d4f87::
-  @    39:12ebe0d625d7 merge h and i
+  $ hg glog
+  @    3:205b2f5ecb7b merge h and i
   |\    () draft
-  | o  38:9bb561db4230 added i
+  | o  2:f0be5e638ecf added i
   | |   () draft
-  o |  37:ef8c23f37b55 added h
+  o |  1:a53d182199c1 added h
   |/    () draft
-  o  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg up ef8c23f37b55
+  $ hg up a53d182199c1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg merge -r 9bb561db4230
+  $ hg merge -r f0be5e638ecf
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci -m "merge h and i successor"
   created new head
-  $ hg glog -r 605c306d4f87::
-  @    40:d2aeda868461 merge h and i successor
+  $ hg glog
+  @    4:8d4acf488ab5 merge h and i successor
   |\    () draft
-  +---o  39:12ebe0d625d7 merge h and i
+  +---o  3:205b2f5ecb7b merge h and i
   | |/    () draft
-  | o  38:9bb561db4230 added i
+  | o  2:f0be5e638ecf added i
   | |   () draft
-  o |  37:ef8c23f37b55 added h
+  o |  1:a53d182199c1 added h
   |/    () draft
-  o  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 12ebe0d625d7 --succ .
+  $ hg prune -r 205b2f5ecb7b --succ .
   1 changesets pruned
 
-  $ hg phase 12ebe0d625d7 --hidden --public
+  $ hg phase 205b2f5ecb7b --hidden --public
   1 new phase-divergent changesets
 
 Resolution of phase-divergent merge commit using `hg evolve`
 
 XXX: we should handle phase-divergent merges
   $ hg evolve --phase-divergent
-  skipping d2aeda868461 : we do not handle merge yet
+  skipping 8d4acf488ab5 : we do not handle merge yet
+
+Check we preserve "cancelation" of changes
+==========================================
+
+This tests case where the phase divergence changesets cancelled some of the
+change made by the public predecessors. The cancellation of these changes need
+to be preserved.
+
+  $ hg init cancelled-changes
+  $ cd cancelled-changes
+  $ 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
+  > nine
+  > 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
+  > nine
+  > 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 E2
+  $ hg --hidden phase --public --rev 'desc(E1)'
+  1 new phase-divergent changesets
+  $ hg log -G --patch --hidden --rev 'not desc("root")'
+  @  changeset:   2:599454370881
+  |  tag:         tip
+  ~  parent:      0:6d1fdf6de7e2
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     instability: phase-divergent
+     summary:     E2
+  
+     diff -r 6d1fdf6de7e2 -r 599454370881 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -4,6 +4,6 @@
+      4
+      5
+      6
+     -7
+     +seven
+      8
+     -9
+     +nine
+     diff -r 6d1fdf6de7e2 -r 599454370881 romans
+     --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,5 +1,5 @@
+      I
+     -II
+     +ii
+      III
+      IV
+      V
+  
+  o  changeset:   1:3074c7249d20
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     E1
+  
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 letters
+     --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,7 +1,7 @@
+      a
+      b
+      c
+     -d
+     +D
+      e
+      f
+      g
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,9 +1,9 @@
+      1
+      2
+      3
+     -4
+     +four
+      5
+      6
+      7
+      8
+     -9
+     +nine
+  
+  $ hg evolve --list
+  599454370881: E2
+    phase-divergent: 3074c7249d20 (immutable precursor)
+  
+  $ hg obslog --all --patch
+  @  599454370881 (2) E2
+  |
+  o  3074c7249d20 (1) E1
+       rewritten(description, content) as 599454370881 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 3074c7249d20 -r 599454370881 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -E1
+         +E2
+  
+         diff -r 3074c7249d20 -r 599454370881 letters
+         --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,7 +1,7 @@
+          a
+          b
+          c
+         -D
+         +d
+          e
+          f
+          g
+         diff -r 3074c7249d20 -r 599454370881 numbers
+         --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,9 +1,9 @@
+          1
+          2
+          3
+         -four
+         +4
+          5
+          6
+         -7
+         +seven
+          8
+          nine
+         diff -r 3074c7249d20 -r 599454370881 romans
+         --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,5 +1,5 @@
+          I
+         -II
+         +ii
+          III
+          IV
+          V
+  
+  
+
+  $ hg evolve --phase-divergent --rev 'desc("E2")'
+  recreate:[2] E2
+  atop:[1] E1
+  committed as 9eebcb77a7e2
+  working directory is now at 9eebcb77a7e2
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 9eebcb77a7e2b240cb7dce095bbe608b5de91cc8
+  # Parent  3074c7249d2023b1fff891591d7e609695cd09c2
+  phase-divergent update to 3074c7249d20:
+  
+  E2
+  
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 letters
+  --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,7 +1,7 @@
+   a
+   b
+   c
+  -D
+  +d
+   e
+   f
+   g
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 numbers
+  --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,9 +1,9 @@
+   1
+   2
+   3
+  -four
+  +4
+   5
+   6
+  -7
+  +seven
+   8
+   nine
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 romans
+  --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,5 +1,5 @@
+   I
+  -II
+  +ii
+   III
+   IV
+   V
+  $ hg log -G --patch --rev 'not desc("root")'
+  @  changeset:   3:9eebcb77a7e2
+  |  tag:         tip
+  |  parent:      1:3074c7249d20
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     phase-divergent update to 3074c7249d20:
+  |
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 letters
+  |  --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,7 +1,7 @@
+  |   a
+  |   b
+  |   c
+  |  -D
+  |  +d
+  |   e
+  |   f
+  |   g
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 numbers
+  |  --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,9 +1,9 @@
+  |   1
+  |   2
+  |   3
+  |  -four
+  |  +4
+  |   5
+  |   6
+  |  -7
+  |  +seven
+  |   8
+  |   nine
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 romans
+  |  --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,5 +1,5 @@
+  |   I
+  |  -II
+  |  +ii
+  |   III
+  |   IV
+  |   V
+  |
+  o  changeset:   1:3074c7249d20
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     E1
+  
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 letters
+     --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,7 +1,7 @@
+      a
+      b
+      c
+     -d
+     +D
+      e
+      f
+      g
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,9 +1,9 @@
+      1
+      2
+      3
+     -4
+     +four
+      5
+      6
+      7
+      8
+     -9
+     +nine
+  
+  $ hg obslog --patch
+  @  9eebcb77a7e2 (3) phase-divergent update to 3074c7249d20:
+  |
+  x  599454370881 (2) E2
+  |    rewritten(description, parent, content) as 9eebcb77a7e2 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, changesets rebased)
+  |
+  o  3074c7249d20 (1) E1
+       rewritten(description, content) as 599454370881 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 3074c7249d20 -r 599454370881 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -E1
+         +E2
+  
+         diff -r 3074c7249d20 -r 599454370881 letters
+         --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,7 +1,7 @@
+          a
+          b
+          c
+         -D
+         +d
+          e
+          f
+          g
+         diff -r 3074c7249d20 -r 599454370881 numbers
+         --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,9 +1,9 @@
+          1
+          2
+          3
+         -four
+         +4
+          5
+          6
+         -7
+         +seven
+          8
+          nine
+         diff -r 3074c7249d20 -r 599454370881 romans
+         --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,5 +1,5 @@
+          I
+         -II
+         +ii
+          III
+          IV
+          V
+  
+  
+  $ 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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-public-content-divergent.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,2017 @@
+Test for handling of content divergence with public cset using `hg evolve`
+==========================================================================
+
+Setup
+=====
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > [phases]
+  > publish = False
+  > [extensions]
+  > rebase =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+Testing the case when both divergent cset are on the same parent and no-conflict in merging:
+-------------------------------------------------------------------------------------
+
+Prepare the repository:
+
+  $ hg init pubdiv
+  $ cd pubdiv
+  $ for ch in a b; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+  $ hg glog
+  @  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+Make an amend and change phase to public:
+
+  $ sed -i "1 i I am first" b
+  $ hg amend
+  $ hg phase --public
+
+Amend again to create a cset divergent to public one:
+
+  $ hg up 1 --hidden -q
+  updated to hidden changeset 5f6d8a4bf34a
+  (hidden revision '5f6d8a4bf34a' was rewritten as: 44f360db368f)
+  working directory parent is obsolete! (5f6d8a4bf34a)
+
+  $ echo "I am second" >> b
+  $ hg ci --amend -m "updated b"
+  1 new content-divergent changesets
+
+  $ hg glog
+  @  3:dcdaf152280a updated b
+  |   draft content-divergent
+  |
+  | o  2:44f360db368f added b
+  |/    public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+
+Lets resolve the public content-divergence:
+
+  $ hg evolve --content-divergent
+  merge:[2] added b
+  with: [3] updated b
+  base: [1] added b
+  updating to "local" side of the conflict: 44f360db368f
+  merging "other" content-divergent changeset 'dcdaf152280a'
+  merging b
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  committed as c1aa9cfb6cf8
+  working directory is now at c1aa9cfb6cf8
+
+Following graph log shows that it correctly merged the two divergent csets:
+
+  $ hg glog -p
+  @  5:c1aa9cfb6cf8 phase-divergent update to 44f360db368f:
+  |   draft
+  |
+  |  diff -r 44f360db368f -r c1aa9cfb6cf8 b
+  |  --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,2 +1,3 @@
+  |   I am first
+  |   b
+  |  +I am second
+  |
+  o  2:44f360db368f added b
+  |   public
+  |
+  |  diff -r 9092f1db7931 -r 44f360db368f b
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,2 @@
+  |  +I am first
+  |  +b
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+     diff -r 000000000000 -r 9092f1db7931 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
+  
+  $ hg evolve -l
+
+  $ cd ..
+
+Testing the case when both divergent cset has same parent and has conflict in merging:
+------------------------------------------------------------------------------
+
+Prepare the repository:
+
+  $ hg init pubdiv1
+  $ cd pubdiv1
+  $ for ch in a b; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+  $ hg glog
+  @  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+Make an amend and change phase to public:
+
+  $ echo "I am foo" > b
+  $ hg amend
+  $ hg phase --public
+
+Amend again to create a cset divergent to public one:
+
+  $ hg up 1 --hidden -q
+  updated to hidden changeset 5f6d8a4bf34a
+  (hidden revision '5f6d8a4bf34a' was rewritten as: 580f2d01e52c)
+  working directory parent is obsolete! (5f6d8a4bf34a)
+
+  $ echo "I am bar" > b
+  $ hg ci --amend -m "updated b"
+  1 new content-divergent changesets
+
+  $ hg glog
+  @  3:0e805383168e updated b
+  |   draft content-divergent
+  |
+  | o  2:580f2d01e52c added b
+  |/    public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+
+Lets resolve the divergence:
+
+  $ hg evolve --content-divergent
+  merge:[2] added b
+  with: [3] updated b
+  base: [1] added b
+  updating to "local" side of the conflict: 580f2d01e52c
+  merging "other" content-divergent changeset '0e805383168e'
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo "I am foobar" > b
+  $ hg resolve -m --tool union
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  committed as 1a739394e9d4
+  working directory is now at 1a739394e9d4
+
+  $ hg glog
+  @  5:1a739394e9d4 phase-divergent update to 580f2d01e52c:
+  |   draft
+  |
+  o  2:580f2d01e52c added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+Testing the case when divergence is not created by actual diff change, but because of rebasing:
+------------------------------------------------------------------------------------------------
+
+Prepare the repo:
+
+  $ cd ..
+  $ hg init rebasediv
+  $ cd rebasediv
+  $ for ch in a b c; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+
+  $ hg glog
+  @  2:155349b645be added c
+  |   draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+On server side: a new cset is added based on rev 1 and rev 2 is rebased on newly added cset:
+
+  $ hg up .^ -q
+  $ echo d > d
+  $ hg ci -Am "added d"
+  adding d
+  created new head
+
+  $ hg rebase -r 2 -d .
+  rebasing 2:155349b645be "added c"
+
+  $ hg glog
+  o  4:c0d7ee6604ea added c
+  |   draft
+  |
+  @  3:c9241b0f2d5b added d
+  |   draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+On user side: user has not pulled yet and amended the rev 2 which created the divergence after pull:
+  $ hg up 2 --hidden -q
+  updated to hidden changeset 155349b645be
+  (hidden revision '155349b645be' was rewritten as: c0d7ee6604ea)
+  working directory parent is obsolete! (155349b645be)
+
+  $ echo cc >> c
+  $ hg ci --amend -m "updated c"
+  2 new content-divergent changesets
+
+Lets change the phase to --public of branch which is pulled from server:
+  $ hg phase --public -r 4
+  $ hg glog -p
+  @  5:f5f9b4fc8b77 updated c
+  |   draft content-divergent
+  |
+  |  diff -r 5f6d8a4bf34a -r f5f9b4fc8b77 c
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,2 @@
+  |  +c
+  |  +cc
+  |
+  | o  4:c0d7ee6604ea added c
+  | |   public
+  | |
+  | |  diff -r c9241b0f2d5b -r c0d7ee6604ea 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
+  | |
+  | o  3:c9241b0f2d5b added d
+  |/    public
+  |
+  |    diff -r 5f6d8a4bf34a -r c9241b0f2d5b 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
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  |  diff -r 9092f1db7931 -r 5f6d8a4bf34a 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  0:9092f1db7931 added a
+      public
+  
+     diff -r 000000000000 -r 9092f1db7931 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
+  
+
+Evolve:
+  $ hg evolve --content-divergent
+  merge:[4] added c
+  with: [5] updated c
+  base: [2] added c
+  rebasing "other" content-divergent changeset f5f9b4fc8b77 on c9241b0f2d5b
+  updating to "local" side of the conflict: c0d7ee6604ea
+  merging "other" content-divergent changeset 'c3d442d80993'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  committed as 3b336cbee992
+  working directory is now at 3b336cbee992
+
+  $ hg glog -p
+  @  8:3b336cbee992 phase-divergent update to c0d7ee6604ea:
+  |   draft
+  |
+  |  diff -r c0d7ee6604ea -r 3b336cbee992 c
+  |  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +1,2 @@
+  |   c
+  |  +cc
+  |
+  o  4:c0d7ee6604ea added c
+  |   public
+  |
+  |  diff -r c9241b0f2d5b -r c0d7ee6604ea 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
+  |
+  o  3:c9241b0f2d5b added d
+  |   public
+  |
+  |  diff -r 5f6d8a4bf34a -r c9241b0f2d5b 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
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  |  diff -r 9092f1db7931 -r 5f6d8a4bf34a 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  0:9092f1db7931 added a
+      public
+  
+     diff -r 000000000000 -r 9092f1db7931 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
+  
+Check that we don't have any unstable cset now:
+  $ hg evolve -l
+  $ cd ..
+
+Testing the case when csets are on different parent and no conflict in relocation and merging:
+----------------------------------------------------------------------------------------------
+
+  $ hg init pubdiv2
+  $ cd pubdiv2
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dd > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg up 1
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dd > d
+  $ echo e > e
+  $ hg add d e
+  $ hg ci -m "added d e"
+  created new head
+
+  $ hg glog
+  @  5:4291d72ee19a added d e
+  |   draft
+  |
+  | o  4:93cd84bbdaca added d
+  | |   draft
+  | |
+  | | o  3:9150fe93bec6 added d
+  | |/    draft
+  | |
+  | o  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 3 -s 5
+  1 changesets pruned
+  $ hg prune 3 -s 4 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+Change phase to public for one head:
+  $ hg phase -r 4 --public
+
+  $ hg glog
+  @  5:4291d72ee19a added d e
+  |   draft content-divergent
+  |
+  | o  4:93cd84bbdaca added d
+  | |   public
+  | |
+  | o  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+
+  $ hg evolve --content-divergent --any
+  merge:[4] added d
+  with: [5] added d e
+  base: [3] added d
+  rebasing "other" content-divergent changeset 4291d72ee19a on 155349b645be
+  updating to "local" side of the conflict: 93cd84bbdaca
+  merging "other" content-divergent changeset 'f88581407163'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  committed as 4cbe48a0c3d9
+  working directory is now at 4cbe48a0c3d9
+
+  $ hg glog -l 1
+  @  8:4cbe48a0c3d9 phase-divergent update to 93cd84bbdaca:
+  |   draft
+  ~
+
+  $ hg evolve -l
+  $ cd ..
+
+Different parents, relocation conflict
+--------------------------------------
+
+Testing the case when csets are on different parent and conflict in relocation
+but not in merging.
+
+  $ hg init pubdiv3
+  $ cd pubdiv3
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo d > d
+  $ echo cfoo > c
+  $ echo e > e
+  $ hg add d c e
+  $ hg ci -m "added d c e"
+  created new head
+
+  $ hg up 'desc("added c")'
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dd > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   draft
+  |
+  | o  4:f31bcc378766 added d c e
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+  $ hg prune 'min(desc("re:added d$"))' -s 'max(desc("re:added d$"))'
+  1 changesets pruned
+  $ hg prune 'min(desc("re:added d$"))' -s 'desc("added d c e")' --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+Change phase to public for one head:
+  $ hg phase --public -r 'max(desc("re:added d$"))'
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   public
+  |
+  | *  4:f31bcc378766 added d c e
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added d c e
+  base: [3] added d
+  rebasing "other" content-divergent changeset f31bcc378766 on 155349b645be
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 155349b645be c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 155349b645be - test: added c
+   c
+  +=======
+  +cfoo
+  +>>>>>>> evolving:    f31bcc378766 - test: added d c e
+  diff -r 155349b645be 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
+  diff -r 155349b645be e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +e
+
+  $ echo c > c
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 4:f31bcc378766 "added d c e"
+  updating to "local" side of the conflict: 93cd84bbdaca
+  merging "other" content-divergent changeset 'bd28d3e4a228'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  committed as 412dde898967
+  working directory is now at 412dde898967
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 412dde898967b50e7d334aefff778a9af46d29d1
+  # Parent  93cd84bbdacaeb8f881c29a609dbdd30c38cbc57
+  phase-divergent update to 93cd84bbdaca:
+  
+  added d c e
+  
+  diff -r 93cd84bbdaca -r 412dde898967 e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +e
+
+  $ hg evolve -l
+  $ cd ..
+
+Testing the case when merging leads to conflicts but relocation won't:
+---------------------------------------------------------------------
+
+  $ hg init pubdiv3.5
+  $ cd pubdiv3.5
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dconflict > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dd > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   draft
+  |
+  | o  4:9411ad1fe615 added d
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+  $ hg prune 3 -s 5
+  1 changesets pruned
+  $ hg prune 3 -s 4 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+Change phase to public for one head:
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   public
+  |
+  | *  4:9411ad1fe615 added d
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added d
+  base: [3] added d
+  rebasing "other" content-divergent changeset 9411ad1fe615 on 155349b645be
+  updating to "local" side of the conflict: 93cd84bbdaca
+  merging "other" content-divergent changeset 'b5c690cdf1d5'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo d > d
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  committed as 2a0f44767904
+  working directory is now at 2a0f44767904
+
+  $ hg evolve -l
+  $ cd ..
+
+Testing the case when relocation and merging both leads to conflicts:
+--------------------------------------------------------------------
+
+  $ hg init pubdiv4
+  $ cd pubdiv4
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo cfoo > c
+  $ echo e > e
+  $ echo dconflict > d
+  $ hg add c e d
+  $ hg ci -m "added c e"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dd > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   draft
+  |
+  | o  4:3c17c7afaf6e added c e
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+  $ hg prune 3 -s 5
+  1 changesets pruned
+  $ hg prune 3 -s 4 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+Change phase to public for one head:
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   public
+  |
+  | *  4:3c17c7afaf6e added c e
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added c e
+  base: [3] added d
+  rebasing "other" content-divergent changeset 3c17c7afaf6e on 155349b645be
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 155349b645be c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 155349b645be - test: added c
+   c
+  +=======
+  +cfoo
+  +>>>>>>> evolving:    3c17c7afaf6e - test: added c e
+  diff -r 155349b645be 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 @@
+  +dconflict
+  diff -r 155349b645be e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +e
+
+  $ echo cfoo > c
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 4:3c17c7afaf6e "added c e"
+  updating to "local" side of the conflict: 93cd84bbdaca
+  merging "other" content-divergent changeset 'c4ce3d34e784'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  2 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo d > d
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  committed as b9082a9e66ce
+  working directory is now at b9082a9e66ce
+
+  $ hg evolve -l
+  $ cd ..
+
+Different parent, simple conflict on relocate, deleted file on actual merge
+---------------------------------------------------------------------------
+
+Changeset "added c e" is also removing 'd'. This should conflict with the update
+to 'd' in the successors of 'adding d' when solving the content divergence.
+
+  $ hg init pubdiv-parent-deleted-file
+  $ cd pubdiv-parent-deleted-file
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Aqm "added "$ch;
+  > done;
+
+  $ hg up 'desc("added b")'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo cfoo > c
+  $ echo e > e
+  $ hg add c e
+  $ hg ci -m "added c e"
+  created new head
+
+  $ hg up 'desc("re:added c$")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dd > d
+  $ hg add d
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog --patch --rev 'sort(all(), "topo")'
+  @  5:93cd84bbdaca added d
+  |   draft
+  |
+  |  diff -r 155349b645be -r 93cd84bbdaca 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 @@
+  |  +dd
+  |
+  | o  3:9150fe93bec6 added d
+  |/    draft
+  |
+  |    diff -r 155349b645be -r 9150fe93bec6 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
+  |
+  o  2:155349b645be added c
+  |   draft
+  |
+  |  diff -r 5f6d8a4bf34a -r 155349b645be 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
+  |
+  | o  4:e568fd1029bb added c e
+  |/    draft
+  |
+  |    diff -r 5f6d8a4bf34a -r e568fd1029bb 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 @@
+  |    +cfoo
+  |    diff -r 5f6d8a4bf34a -r e568fd1029bb e
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +e
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  |  diff -r 9092f1db7931 -r 5f6d8a4bf34a 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  0:9092f1db7931 added a
+      draft
+  
+     diff -r 000000000000 -r 9092f1db7931 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
+  
+  $ hg prune 'min(desc("added d"))' -s 'max(desc("added d"))'
+  1 changesets pruned
+  $ hg prune 'min(desc("added d"))' -s 'desc("added c e")' --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+Change phase to public for one head:
+  $ hg phase --public -r 'max(desc("added d"))'
+
+  $ hg glog
+  @  5:93cd84bbdaca added d
+  |   public
+  |
+  | *  4:e568fd1029bb added c e
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+
+  $ hg glog --patch --rev 'sort(all(), "topo")' --hidden
+  @  5:93cd84bbdaca added d
+  |   public
+  |
+  |  diff -r 155349b645be -r 93cd84bbdaca 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 @@
+  |  +dd
+  |
+  | x  3:9150fe93bec6 added d
+  |/    draft
+  |
+  |    diff -r 155349b645be -r 9150fe93bec6 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
+  |
+  o  2:155349b645be added c
+  |   public
+  |
+  |  diff -r 5f6d8a4bf34a -r 155349b645be 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
+  |
+  | *  4:e568fd1029bb added c e
+  |/    draft content-divergent
+  |
+  |    diff -r 5f6d8a4bf34a -r e568fd1029bb 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 @@
+  |    +cfoo
+  |    diff -r 5f6d8a4bf34a -r e568fd1029bb e
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +e
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  |  diff -r 9092f1db7931 -r 5f6d8a4bf34a 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  0:9092f1db7931 added a
+      public
+  
+     diff -r 000000000000 -r 9092f1db7931 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
+  
+
+  $ hg obslog --all --rev tip --patch
+  @  93cd84bbdaca (5) added d
+  |
+  | *  e568fd1029bb (4) added c e
+  |/
+  x  9150fe93bec6 (3) added d
+       rewritten(content) as 93cd84bbdaca using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 9150fe93bec6 -r 93cd84bbdaca d
+         --- a/d	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,1 +1,1 @@
+         -d
+         +dd
+  
+       rewritten(description, parent, content) as e568fd1029bb using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, changesets rebased)
+  
+
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added c e
+  base: [3] added d
+  rebasing "other" content-divergent changeset e568fd1029bb on 155349b645be
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 155349b645be c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 155349b645be - test: added c
+   c
+  +=======
+  +cfoo
+  +>>>>>>> evolving:    e568fd1029bb - test: added c e
+  diff -r 155349b645be e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +e
+
+  $ echo c > c
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 4:e568fd1029bb "added c e"
+  updating to "local" side of the conflict: 93cd84bbdaca
+  merging "other" content-divergent changeset '2af3359250d3'
+  file 'd' was deleted in other but was modified in local.
+  What do you want to do?
+  use (c)hanged version, (d)elete, or leave (u)nresolved? u
+  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg sum
+  parent: 5:93cd84bbdaca 
+   added d
+  parent: 6:2af3359250d3 tip (content-divergent)
+   added c e
+  branch: default
+  commit: 1 modified, 1 unknown, 1 unresolved (merge)
+  update: (current)
+  phases: 1 draft
+  content-divergent: 1 changesets
+  evolve: (evolve --continue)
+
+  $ echo resolved > d
+  $ hg resolve -m d
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  committed as bc1f4610744c
+  working directory is now at bc1f4610744c
+
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID bc1f4610744c6aa0e851d3876a61bfff6243b31c
+  # Parent  93cd84bbdacaeb8f881c29a609dbdd30c38cbc57
+  phase-divergent update to 93cd84bbdaca:
+  
+  added c e
+  
+  diff -r 93cd84bbdaca -r bc1f4610744c d
+  --- a/d	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -dd
+  +resolved
+  diff -r 93cd84bbdaca -r bc1f4610744c e
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +e
+
+  $ hg evolve -l
+  $ cd ..
+
+Testing the case when "merging results in same as public cset" where:
+both the csets are on same parent and no conflict in merging.
+---------------------------------------------------------------------
+
+Prepare the repo:
+
+  $ hg init pubdiv5
+  $ cd pubdiv5
+  $ for ch in a b c; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo ch > ch
+  $ hg add ch
+  $ hg ci -m "added ch"
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo ch > ch
+  $ hg add ch
+  $ hg ci -m "added c"
+  created new head
+
+  $ hg glog
+  @  4:f7c1071f1e7c added c
+  |   draft
+  |
+  | o  3:90522bccf499 added ch
+  |/    draft
+  |
+  | o  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 2 -s 3
+  1 changesets pruned
+  $ hg prune 2 -s 4 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 4
+
+  $ hg glog
+  @  4:f7c1071f1e7c added c
+  |   public
+  |
+  | *  3:90522bccf499 added ch
+  |/    draft content-divergent
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[4] added c
+  with: [3] added ch
+  base: [2] added c
+  merging "other" content-divergent changeset '90522bccf499'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  content-divergent changesets differ by descriptions only, discarding 90522bccf499
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   4:f7c1071f1e7c
+  tag:         tip
+  parent:      1:5f6d8a4bf34a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c
+  
+
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and no conflict in merging and relocation.
+---------------------------------------------------------------------------------
+
+Prepare the repo:
+
+  $ cd ..
+  $ hg init pubdiv6
+  $ cd pubdiv6
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+  adding d
+
+  $ hg up 1
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ hg add dh
+  $ hg ci -m "added dh"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ hg add dh
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   draft
+  |
+  | o  4:5acd58ef5066 added dh
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 3 -s 4
+  1 changesets pruned
+  $ hg prune 3 -s 5 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   public
+  |
+  | *  4:5acd58ef5066 added dh
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added dh
+  base: [3] added d
+  rebasing "other" content-divergent changeset 5acd58ef5066 on 155349b645be
+  updating to "local" side of the conflict: e800202333a4
+  merging "other" content-divergent changeset 'ae3429430ef1'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  content-divergent changesets differ by descriptions only, discarding ae3429430ef1
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   5:e800202333a4
+  tag:         tip
+  parent:      2:155349b645be
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added d
+  
+Testing the case when "merging results in same as public cset" where:
+both the csets are on same parent and merging leads to conflict.
+---------------------------------------------------------------------
+
+Prepare the repo:
+
+  $ cd ..
+  $ hg init pubdiv7
+  $ cd pubdiv7
+  $ for ch in a b c; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo chconflict > ch
+  $ hg add ch
+  $ hg ci -m "added ch"
+  created new head
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo ch > ch
+  $ hg add ch
+  $ hg ci -m "added c"
+  created new head
+
+  $ hg glog
+  @  4:f7c1071f1e7c added c
+  |   draft
+  |
+  | o  3:229da2719b19 added ch
+  |/    draft
+  |
+  | o  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 2 -s 3
+  1 changesets pruned
+  $ hg prune 2 -s 4 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 4
+
+  $ hg glog
+  @  4:f7c1071f1e7c added c
+  |   public
+  |
+  | *  3:229da2719b19 added ch
+  |/    draft content-divergent
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[4] added c
+  with: [3] added ch
+  base: [2] added c
+  merging "other" content-divergent changeset '229da2719b19'
+  merging ch
+  warning: conflicts while merging ch! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r f7c1071f1e7c ch
+  --- a/ch	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/ch	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< local: f7c1071f1e7c - test: added c
+   ch
+  +=======
+  +chconflict
+  +>>>>>>> other: 229da2719b19 - test: added ch
+
+  $ echo ch > ch
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  content-divergent changesets differ by descriptions only, discarding 229da2719b19
+  working directory is now at f7c1071f1e7c
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   4:f7c1071f1e7c
+  tag:         tip
+  parent:      1:5f6d8a4bf34a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c
+  
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and relocation leads to conflict but merging won't.
+------------------------------------------------------------------------------------------
+Prepare the repo:
+
+  $ cd ..
+  $ hg init pubdiv8
+  $ cd pubdiv8
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+  adding d
+
+  $ hg up 1
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ echo cc > c
+  $ hg add dh c
+  $ hg ci -m "added dh"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ hg add dh
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   draft
+  |
+  | o  4:f89a8e2f86ac added dh
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 3 -s 4
+  1 changesets pruned
+  $ hg prune 3 -s 5 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   public
+  |
+  | *  4:f89a8e2f86ac added dh
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added dh
+  base: [3] added d
+  rebasing "other" content-divergent changeset f89a8e2f86ac on 155349b645be
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo c > c
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 4:f89a8e2f86ac "added dh"
+  updating to "local" side of the conflict: e800202333a4
+  merging "other" content-divergent changeset 'bc309da55b88'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  content-divergent changesets differ by descriptions only, discarding bc309da55b88
+  working directory is now at e800202333a4
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   5:e800202333a4
+  tag:         tip
+  parent:      2:155349b645be
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added d
+  
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and merging leads to conflict but relocation won't.
+------------------------------------------------------------------------------------------
+Prepare the repo:
+
+  $ cd ..
+  $ hg init pubdiv9
+  $ cd pubdiv9
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+  adding d
+
+  $ hg up 1
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dhconflict > dh
+  $ hg add dh
+  $ hg ci -m "added dh"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ hg add dh
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   draft
+  |
+  | o  4:db0b7bba0aae added dh
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 3 -s 4
+  1 changesets pruned
+  $ hg prune 3 -s 5 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   public
+  |
+  | *  4:db0b7bba0aae added dh
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added dh
+  base: [3] added d
+  rebasing "other" content-divergent changeset db0b7bba0aae on 155349b645be
+  updating to "local" side of the conflict: e800202333a4
+  merging "other" content-divergent changeset 'a5bbf2042450'
+  merging dh
+  warning: conflicts while merging dh! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo dh > dh
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  content-divergent changesets differ by descriptions only, discarding a5bbf2042450
+  working directory is now at e800202333a4
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   5:e800202333a4
+  tag:         tip
+  parent:      2:155349b645be
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added d
+  
+
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and relocation and merging both leads to conflict:
+-----------------------------------------------------------------------------------------
+Prepare the repo:
+
+  $ cd ..
+  $ hg init pubdiv10
+  $ cd pubdiv10
+  $ for ch in a b c d; do
+  >   echo $ch > $ch;
+  >   hg ci -Am "added "$ch;
+  > done;
+  adding a
+  adding b
+  adding c
+  adding d
+
+  $ hg up 1
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo dhconflict > dh
+  $ echo cc > c
+  $ hg add dh c
+  $ hg ci -m "added dh"
+  created new head
+
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo dh > dh
+  $ hg add dh
+  $ hg ci -m "added d"
+  created new head
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   draft
+  |
+  | o  4:67b19bbd770f added dh
+  | |   draft
+  | |
+  +---o  3:9150fe93bec6 added d
+  | |     draft
+  | |
+  o |  2:155349b645be added c
+  |/    draft
+  |
+  o  1:5f6d8a4bf34a added b
+  |   draft
+  |
+  o  0:9092f1db7931 added a
+      draft
+  
+
+  $ hg prune 3 -s 4
+  1 changesets pruned
+  $ hg prune 3 -s 5 --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+  $ hg phase --public -r 5
+
+  $ hg glog
+  @  5:e800202333a4 added d
+  |   public
+  |
+  | *  4:67b19bbd770f added dh
+  | |   draft content-divergent
+  | |
+  o |  2:155349b645be added c
+  |/    public
+  |
+  o  1:5f6d8a4bf34a added b
+  |   public
+  |
+  o  0:9092f1db7931 added a
+      public
+  
+  $ hg evolve --content-divergent --any
+  merge:[5] added d
+  with: [4] added dh
+  base: [3] added d
+  rebasing "other" content-divergent changeset 67b19bbd770f on 155349b645be
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo c > c
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 4:67b19bbd770f "added dh"
+  updating to "local" side of the conflict: e800202333a4
+  merging "other" content-divergent changeset '09054d1f3c97'
+  merging dh
+  warning: conflicts while merging dh! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo dh > dh
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  content-divergent changesets differ by descriptions only, discarding 09054d1f3c97
+  working directory is now at e800202333a4
+
+  $ hg evolve -l
+
+  $ hg par
+  changeset:   5:e800202333a4
+  tag:         tip
+  parent:      2:155349b645be
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added d
+  
+
+  $ cd ..
+
+Test a pratical "rebase" case
+=============================
+
+Initial setup
+
+  $ hg init rebase-divergence
+  $ cd rebase-divergence
+  $ echo root >> root
+  $ hg add root
+  $ hg commit -m root
+  $ for x in c_A c_B c_C c_D; do
+  >     echo $x >> $x
+  >     hg add $x
+  >     hg commit -m $x
+  > done
+
+  $ hg up 'desc("c_A")'
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ for x in c_E c_F; do
+  >     echo $x >> $x
+  >     hg add $x
+  >     hg commit -m $x
+  > done
+  created new head
+
+(creating divergence locally for simplicity)
+
+  $ node=`hg log --rev 'desc("c_E")' -T '{node}'`
+  $ hg rebase -s $node -d 'desc("c_B")'
+  rebasing 5:4ab2719bbab9 "c_E"
+  rebasing 6:77ccbf8d837e "c_F" (tip)
+  $ hg phase --public tip
+  $ hg rebase --hidden -s $node -d 'desc("c_C")' --config experimental.evolution.allowdivergence=yes
+  rebasing 5:4ab2719bbab9 "c_E"
+  rebasing 6:77ccbf8d837e "c_F"
+  2 new content-divergent changesets
+
+  $ hg sum
+  parent: 8:a52ac76b45f5 
+   c_F
+  branch: default
+  commit: (clean)
+  update: 4 new changesets, 3 branch heads (merge)
+  phases: 4 draft
+  content-divergent: 2 changesets
+  $ hg evolve --list
+  b4a584aea4bd: c_E
+    content-divergent: c7d2d47c7240 (public) (precursor 4ab2719bbab9)
+  
+  8ae8db670b4a: c_F
+    content-divergent: a52ac76b45f5 (public) (precursor 77ccbf8d837e)
+  
+  $ hg log -G --patch
+  *  changeset:   10:8ae8db670b4a
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_F
+  |
+  |  diff -r b4a584aea4bd -r 8ae8db670b4a c_F
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_F	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_F
+  |
+  *  changeset:   9:b4a584aea4bd
+  |  parent:      3:abb77b893f28
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_E
+  |
+  |  diff -r abb77b893f28 -r b4a584aea4bd c_E
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_E	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_E
+  |
+  | @  changeset:   8:a52ac76b45f5
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_F
+  | |
+  | |  diff -r c7d2d47c7240 -r a52ac76b45f5 c_F
+  | |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |  +++ b/c_F	Thu Jan 01 00:00:00 1970 +0000
+  | |  @@ -0,0 +1,1 @@
+  | |  +c_F
+  | |
+  | o  changeset:   7:c7d2d47c7240
+  | |  parent:      2:eb1b4e1205b8
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_E
+  | |
+  | |  diff -r eb1b4e1205b8 -r c7d2d47c7240 c_E
+  | |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |  +++ b/c_E	Thu Jan 01 00:00:00 1970 +0000
+  | |  @@ -0,0 +1,1 @@
+  | |  +c_E
+  | |
+  +---o  changeset:   4:dbb960d6c97c
+  | |    user:        test
+  | |    date:        Thu Jan 01 00:00:00 1970 +0000
+  | |    summary:     c_D
+  | |
+  | |    diff -r abb77b893f28 -r dbb960d6c97c c_D
+  | |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |    +++ b/c_D	Thu Jan 01 00:00:00 1970 +0000
+  | |    @@ -0,0 +1,1 @@
+  | |    +c_D
+  | |
+  o |  changeset:   3:abb77b893f28
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     c_C
+  |
+  |    diff -r eb1b4e1205b8 -r abb77b893f28 c_C
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/c_C	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +c_C
+  |
+  o  changeset:   2:eb1b4e1205b8
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B
+  |
+  |  diff -r e31751786014 -r eb1b4e1205b8 c_B
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_B	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_B
+  |
+  o  changeset:   1:e31751786014
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A
+  |
+  |  diff -r 1e4be0697311 -r e31751786014 c_A
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_A	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_A
+  |
+  o  changeset:   0:1e4be0697311
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     root
+  
+     diff -r 000000000000 -r 1e4be0697311 root
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/root	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +root
+  
+
+Run automatic evolution
+
+  $ hg evolve --content-divergent --rev 'not public() and desc("c_E")::'
+  merge:[7] c_E
+  with: [9] c_E
+  base: [5] c_E
+  rebasing "other" content-divergent changeset b4a584aea4bd on eb1b4e1205b8
+  updating to "local" side of the conflict: c7d2d47c7240
+  merging "other" content-divergent changeset '0773642cfa95'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 new orphan changesets
+  merge:[8] c_F
+  with: [10] c_F
+  base: [6] c_F
+  rebasing "other" content-divergent changeset 8ae8db670b4a on c7d2d47c7240
+  updating to "local" side of the conflict: a52ac76b45f5
+  merging "other" content-divergent changeset '6a87ed4aa317'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg sum
+  parent: 8:a52ac76b45f5 tip
+   c_F
+  branch: default
+  commit: (clean)
+  update: 2 new changesets, 2 branch heads (merge)
+  phases: 2 draft
+
+  $ hg evolve --list
+
+  $ hg log -G --patch
+  @  changeset:   8:a52ac76b45f5
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_F
+  |
+  |  diff -r c7d2d47c7240 -r a52ac76b45f5 c_F
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_F	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_F
+  |
+  o  changeset:   7:c7d2d47c7240
+  |  parent:      2:eb1b4e1205b8
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_E
+  |
+  |  diff -r eb1b4e1205b8 -r c7d2d47c7240 c_E
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_E	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_E
+  |
+  | o  changeset:   4:dbb960d6c97c
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_D
+  | |
+  | |  diff -r abb77b893f28 -r dbb960d6c97c c_D
+  | |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |  +++ b/c_D	Thu Jan 01 00:00:00 1970 +0000
+  | |  @@ -0,0 +1,1 @@
+  | |  +c_D
+  | |
+  | o  changeset:   3:abb77b893f28
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     c_C
+  |
+  |    diff -r eb1b4e1205b8 -r abb77b893f28 c_C
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/c_C	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +c_C
+  |
+  o  changeset:   2:eb1b4e1205b8
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B
+  |
+  |  diff -r e31751786014 -r eb1b4e1205b8 c_B
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_B	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_B
+  |
+  o  changeset:   1:e31751786014
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A
+  |
+  |  diff -r 1e4be0697311 -r e31751786014 c_A
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c_A	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c_A
+  |
+  o  changeset:   0:1e4be0697311
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     root
+  
+     diff -r 000000000000 -r 1e4be0697311 root
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/root	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +root
+  
+  $ hg export tip
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID a52ac76b45f523a039fc4a938d79874f4bdb1a85
+  # Parent  c7d2d47c7240562be5cbd1a24080dd0396178709
+  c_F
+  
+  diff -r c7d2d47c7240 -r a52ac76b45f5 c_F
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c_F	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +c_F
+
+  $ hg obslog --rev a52ac76b45f5
+  @    a52ac76b45f5 (8) c_F
+  |\
+  x |  6a87ed4aa317 (12) c_F
+  | |    rewritten as a52ac76b45f5 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  x |  8ae8db670b4a (10) c_F
+  |/     rewritten(parent) as 6a87ed4aa317 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  77ccbf8d837e (6) c_F
+       rewritten(parent) as 8ae8db670b4a using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(parent) as a52ac76b45f5 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
--- a/tests/test-evolve-stop-contentdiv.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-Tests for the --stop flag for `hg evolve` command while resolving content-divergence
-==================================================================================
-
-The `--stop` flag stops the interrupted evolution and delete the state file so
-user can do other things and comeback and do evolution later on
-
-This is testing cases when `hg evolve` command is doing content-divergence resolution.
-
-Setup
-=====
-
-  $ cat >> $HGRCPATH <<EOF
-  > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ hg init stoprepo
-  $ cd stoprepo
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Creating content divergence, resolution of which will lead to conflicts
------------------------------------------------------------------------
-
-  $ echo bar > d
-  $ hg amend
-
-  $ hg up c41c793e0ef1 --hidden
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset c41c793e0ef1
-  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
-  working directory parent is obsolete! (c41c793e0ef1)
-  (use 'hg evolve' to update to its successor: e49523854bc8)
-
-  $ echo foobar > d
-  $ hg amend
-  2 new content-divergent changesets
-  $ hg glog --hidden
-  @  6:9c1631e352d9 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  |/    () draft
-  | x  4:c41c793e0ef1 added d
-  |/    () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[6] added d
-  with: [5] added d
-  base: [4] added d
-  merging "other" content-divergent changeset 'e49523854bc8'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg evolve --stop
-  stopped the interrupted evolve
-  working directory is now at 9c1631e352d9
-
-  $ hg glog --hidden
-  @  6:9c1631e352d9 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  |/    () draft
-  | x  4:c41c793e0ef1 added d
-  |/    () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Content divergence with parent change which will result in conflicts while
-merging
----------------------------------------------------------------------------
-
-  $ hg rebase -r . -d .^^^ --config extensions.rebase=
-  rebasing 6:9c1631e352d9 "added d" (tip)
-
-  $ hg glog
-  @  7:517d4375cb72 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  | |   () draft
-  | o  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[5] added d
-  with: [7] added d
-  base: [4] added d
-  rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
-  updating to "local" side of the conflict: e49523854bc8
-  merging "other" content-divergent changeset '606ad96040fc'
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg evolve --stop
-  stopped the interrupted evolve
-  working directory is now at 517d4375cb72
-
-  $ hg glog
-  @  7:517d4375cb72 added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  | |   () draft
-  | o  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Content-divergence with parent-change which will result in conflicts while
-relocation
----------------------------------------------------------------------------
-
-  $ echo babar > c
-  $ hg add c
-  $ hg amend
-  $ hg glog
-  @  8:8fd1c4bd144c added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  | |   () draft
-  | o  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --content-divergent
-  merge:[5] added d
-  with: [8] added d
-  base: [4] added d
-  rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ hg diff
-  diff -r ca1b80f7960a c
-  --- a/c	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,5 @@
-  +<<<<<<< destination: ca1b80f7960a - test: added c
-   foo
-  +=======
-  +babar
-  +>>>>>>> evolving:    8fd1c4bd144c - test: added d
-  diff -r ca1b80f7960a 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 @@
-  +foobar
-
-  $ hg evolve --stop
-  stopped the interrupted evolve
-  working directory is now at ca1b80f7960a
-
-XXX: we should have preserved the wdir to be at rev 8
-  $ hg glog
-  *  8:8fd1c4bd144c added d
-  |   () draft
-  | *  5:e49523854bc8 added d
-  | |   () draft
-  | @  3:ca1b80f7960a added c
-  | |   () draft
-  | o  2:b1661037fa25 added b
-  |/    () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
--- a/tests/test-evolve-templates.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-templates.t	Thu Apr 11 22:41:25 2019 +0200
@@ -245,8 +245,8 @@
   o  ea207398892e
   
 
-Test templates with splitted commit
-===================================
+Test templates with split commit
+================================
 
   $ hg init $TESTTMP/templates-local-split
   $ cd $TESTTMP/templates-local-split
@@ -1313,7 +1313,7 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     ROOT
   
-Diverge one of the splitted commit
+Diverge one of the split commit
 
   $ hg up 6
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
--- a/tests/test-evolve-topic.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve-topic.t	Thu Apr 11 22:41:25 2019 +0200
@@ -126,8 +126,8 @@
   $ hg stack
   ### topic: foo
   ### target: default (branch)
-  s4$ add fff (current unstable)
-  s3$ add eee (unstable)
+  s4@ add fff (current orphan)
+  s3$ add eee (orphan)
   s2: add ddd
   s1: add ccc
   s0^ add bbb (base)
@@ -265,10 +265,10 @@
   $ hg stack
   ### topic: bar
   ### target: default (branch)
-  s5$ add jjj (unstable)
-  s4$ add iii (unstable)
-  s3$ add hhh (unstable)
-  s2$ add ggg (current unstable)
+  s5$ add jjj (orphan)
+  s4$ add iii (orphan)
+  s3$ add hhh (orphan)
+  s2@ add ggg (current orphan)
   s1: add fff
   s0^ add eee (base)
 
--- a/tests/test-evolve.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-evolve.t	Thu Apr 11 22:41:25 2019 +0200
@@ -81,23 +81,22 @@
       explicitly assert support for the obsolescence feature (this can currently
       only be done via an extension).
   
-      Instability ==========
+      Instability
+      ===========
   
-      (note: the vocabulary is in the process of being updated)
-  
-      Rewriting changesets might introduce instability (currently 'trouble').
+      Rewriting changesets might introduce instability.
   
       There are two main kinds of instability: orphaning and diverging.
   
-      Orphans are changesets left behind when their ancestors are rewritten,
-      (currently: 'unstable'). Divergence has two variants:
+      Orphans are changesets left behind when their ancestors are rewritten.
+      Divergence has two variants:
   
       * Content-divergence occurs when independent rewrites of the same
-        changesets lead to different results. (currently: 'divergent')
+        changesets lead to different results.
       * Phase-divergence occurs when the old (obsolete) version of a changeset
-        becomes public. (currently: 'bumped')
+        becomes public.
   
-      If it possible to prevent local creation of orphans by using the following
+      It is possible to prevent local creation of orphans by using the following
       config:
   
         [experimental]
@@ -145,7 +144,7 @@
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
   1 public 
   $ hg prune 1
-  abort: cannot touch public changesets: 7c3bad9141dc
+  abort: cannot prune public changesets: 7c3bad9141dc
   (see 'hg help phases' for details)
   [255]
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
@@ -390,12 +389,12 @@
   4	feature-A: a nifty feature - test
   0	: base - test
 
-phase change turning obsolete changeset public issue a bumped warning
+phase change turning obsolete changeset public issues a phase divergence warning
 
   $ hg phase --hidden --public 99833d22b0c6
   1 new phase-divergent changesets
 
-all solving bumped troubled
+all solving phase-divergent
 
   $ glog
   @  6:47d52a103155@default(draft) another feature that rox
@@ -409,7 +408,6 @@
   $ hg evolve --any --traceback --phase-divergent
   recreate:[6] another feature that rox
   atop:[5] another feature (child of ba0ec09b1bab)
-  computing new diff
   committed as aca219761afb
   working directory is now at aca219761afb
   $ glog
@@ -429,7 +427,7 @@
   @@ -3,1 +3,1 @@
   -Zwei
   +deux
-  $ hg log -r 'phasedivergent()' # no more bumped
+  $ hg log -r 'phasedivergent()' # no more phase-divergent
 
 test evolve --all
   $ sed -i'' -e s/deux/to/ main-file-1
@@ -1000,8 +998,8 @@
   o  0:07c1c36d9ef0@default(draft) a0
   
 
-Possibility to select what trouble to solve first, asking for bumped before
-divergent
+Possibility to select what instability to solve first, asking for
+phase-divergent before content-divergent
   $ hg up -r "desc('a1__')"
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg revert -r d952e93add6f --all
@@ -1040,8 +1038,8 @@
   o  0	: a0 - test
   
 
-Now we have a bumped and an unstable changeset, we solve the bumped first
-normally the unstable changeset would be solve first
+Now we have a phase-divergent and an orphan changeset, we solve the
+phase-divergent first. Normally the orphan changeset would be solved first
 
   $ hg log -G
   @  11	: add new file bumped - test
@@ -1061,7 +1059,6 @@
   $ hg evolve -r "desc('add new file bumped')" --phase-divergent
   recreate:[11] add new file bumped
   atop:[10] a2
-  computing new diff
   committed as a8bb31d4b7f2
   working directory is now at a8bb31d4b7f2
   $ hg evolve --any
@@ -1080,7 +1077,7 @@
   o  0:07c1c36d9ef0@default(public) a0
   
 
-Check that we can resolve troubles in a revset with more than one commit
+Check that we can resolve instabilities in a revset with more than one commit
   $ hg up b88539ad24d7 -C
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ mkcommit gg
@@ -1310,11 +1307,11 @@
   $ mkcommit c5_
   created new head
   $ hg prune '0ef9ff75f8e2 + f1b85956c48c'
-  abort: touch will orphan 1 descendants
+  abort: prune will orphan 1 descendants
   (see 'hg help evolution.instability')
   [255]
   $ hg prune '98e171e2f272::0d9203b74542'
-  abort: touch will orphan 1 descendants
+  abort: prune will orphan 1 descendants
   (see 'hg help evolution.instability')
   [255]
   $ hg prune '0ef9ff75f8e2::'
@@ -1537,7 +1534,7 @@
   adding a
   adding b
   adding c
-Lets create a merge commit so that we can create orhpan merge later:
+Let's create a merge commit so that we can create orphan merge later:
   $ hg up 1 -q
   $ echo feature > f
   $ hg ci -Am "added feature f"
@@ -1584,7 +1581,7 @@
   
 
 To check `lastsolved` contain right value after completion of orphan-merge
-resolution there should be one more trouble to be evolved; lets create one:
+resolution there should be one more instability to be evolved; lets create one:
   $ hg up 1 -q
   $ echo d > d
   $ hg ci -Am "added d"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extension-isolation.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,171 @@
+============================
+Testing extensions isolation
+============================
+
+In this test case, we check that a repository using the extensions can co-exist
+with a repository not using the extension.
+
+  $ . $TESTDIR/testlib/common.sh
+
+Setup
+=====
+
+Create repo
+
+  $ hg init repo-evo
+  $ cat > repo-evo/.hg/hgrc << EOF
+  > [extensions]
+  > evolve=
+  > EOF
+  $ hg init repo-topic
+  $ cat > repo-topic/.hg/hgrc << EOF
+  > [extensions]
+  > topic=
+  > EOF
+  $ hg init repo-both
+  $ cat > repo-both/.hg/hgrc << EOF
+  > [extensions]
+  > evolve=
+  > topic=
+  > EOF
+  $ hg init repo-no-ext
+
+check setup
+
+  $ hg -R repo-evo  help -e evolve | head -n 1
+  warning: --repository ignored
+  evolve extension - extends Mercurial feature related to Changeset Evolution
+  $ hg -R repo-both  help -e evolve | head -n 1
+  warning: --repository ignored
+  evolve extension - extends Mercurial feature related to Changeset Evolution
+  $ hg -R repo-no-ext help -e evolve
+  warning: --repository ignored
+  abort: no such help topic: evolve
+  (try 'hg help --keyword evolve')
+  [255]
+  $ hg -R repo-no-ext help -e topic
+  warning: --repository ignored
+  abort: no such help topic: topic
+  (try 'hg help --keyword topic')
+  [255]
+
+start hgweb dir for all repo
+
+  $ cat > hgweb.conf << EOF
+  > [paths]
+  > / = *
+  > EOF
+
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid --web-conf hgweb.conf -A access.log -E error.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+Test isolation
+--------------
+
+As of 4.9 (and previous version). It seems like extensions are displayed as
+enabled even for repository where they are not supposed to be. See the output
+tagged `no-false`.
+
+(however, topic and evolve are not supposed to affect other repository as shown
+in the rest of this test).
+
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-no-ext/help/extensions' | grep 'enabled extensions' -A 7
+  [1]
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-evo/help/extensions' | grep 'enabled extensions' -A 7
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve
+   <dd>extends Mercurial feature related to Changeset Evolution
+  </dl>
+  <p>
+  disabled extensions:
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-topic/help/extensions' | grep 'enabled extensions' -A 7
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve (no-false !)
+   <dd>extends Mercurial feature related to Changeset Evolution (no-false !)
+   <dt>topic
+   <dd>support for topic branches
+  </dl>
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-both/help/extensions' | grep 'enabled extensions' -A 9
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve
+   <dd>extends Mercurial feature related to Changeset Evolution
+   <dt>topic
+   <dd>support for topic branches
+  </dl>
+  <p>
+  disabled extensions:
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-no-ext/help/extensions' | grep 'enabled extensions' -A 9
+  enabled extensions: (no-false !)
+  </p> (no-false !)
+  <dl> (no-false !)
+   <dt>evolve (no-false !)
+   <dd>extends Mercurial feature related to Changeset Evolution (no-false !)
+   <dt>topic (no-false !)
+   <dd>support for topic branches (no-false !)
+  </dl> (no-false !)
+  <p> (no-false !)
+  disabled extensions: (no-false !)
+
+make sure repos don't affect each other (and check both ways)
+
+Check evolve isolation
+-----------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Check topic isolation
+---------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Check coupled isolation
+-----------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-both | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Final cleanup
+-------------
+
+  $ cat error.log
+
+  $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
--- a/tests/test-grab.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-Test for the grab command
-
-  $ cat >> $HGRCPATH <<EOF
-  > [alias]
-  > glog = log -G -T "{rev}:{node|short} {desc}\n"
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ mkcommit() {
-  >    echo "$1" > "$1"
-  >    hg add "$1"
-  >    hg ci -m "add $1"
-  > }
-
-  $ hg init repo
-  $ cd repo
-  $ hg help grab
-  hg pick [-r] rev
-  
-  aliases: grab
-  
-  move a commit on the top of working directory parent and updates to it.
-  
-  options:
-  
-   -r --rev REV  revision to pick
-   -c --continue continue interrupted pick
-   -a --abort    abort interrupted pick
-  
-  (some details hidden, use --verbose to show complete help)
-
-  $ mkcommit a
-  $ mkcommit b
-  $ mkcommit c
-
-  $ hg glog
-  @  2:4538525df7e2 add c
-  |
-  o  1:7c3bad9141dc add b
-  |
-  o  0:1f0dee641bb7 add a
-  
-
-Grabbing an ancestor
-
-  $ hg pick -r 7c3bad9141dc
-  abort: cannot pick an ancestor revision
-  [255]
-
-Grabbing the working directory parent
-
-  $ hg pick -r .
-  abort: cannot pick an ancestor revision
-  [255]
-
-Specifying multiple revisions to grab
-
-  $ hg pick 1f0dee641bb7 -r 7c3bad9141dc
-  abort: specify just one revision
-  [255]
-
-Specifying no revisions to grab
-
-  $ hg pick
-  abort: empty revision set
-  [255]
-
-Continuing without interrupted grab
-
-  $ hg pick --continue
-  abort: no interrupted pick state exists
-  [255]
-
-Aborting without interrupted grab
-
-  $ hg pick --abort
-  abort: no interrupted pick state exists
-  [255]
-
-Specifying both continue and revs
-
-  $ hg up 1f0dee641bb7
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ hg pick -r 4538525df7e2 --continue
-  abort: cannot specify both --continue and revision
-  [255]
-
-Making new branch heads
-
-  $ mkcommit x
-  created new head
-  $ mkcommit y
-
-  $ hg glog
-  @  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  | o  2:4538525df7e2 add c
-  | |
-  | o  1:7c3bad9141dc add b
-  |/
-  o  0:1f0dee641bb7 add a
-  
-Grabbing a revision
-
-  $ hg pick 7c3bad9141dc
-  picking 1:7c3bad9141dc "add b"
-  1 new orphan changesets
-  $ hg glog
-  @  5:7c15c05db6fa add b
-  |
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  | *  2:4538525df7e2 add c
-  | |
-  | x  1:7c3bad9141dc add b
-  |/
-  o  0:1f0dee641bb7 add a
-  
-
-When grab does not create any changes
-
-  $ hg graft -r 4538525df7e2
-  grafting 2:4538525df7e2 "add c"
-
-  $ hg glog
-  @  6:c4636a81ebeb add c
-  |
-  o  5:7c15c05db6fa add b
-  |
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  | *  2:4538525df7e2 add c
-  | |
-  | x  1:7c3bad9141dc add b
-  |/
-  o  0:1f0dee641bb7 add a
-  
-  $ hg pick -r 4538525df7e2
-  picking 2:4538525df7e2 "add c"
-  note: picking 2:4538525df7e2 created no changes to commit
-
-  $ hg glog
-  @  6:c4636a81ebeb add c
-  |
-  o  5:7c15c05db6fa add b
-  |
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  o  0:1f0dee641bb7 add a
-  
-interrupted grab
-
-  $ hg up d46dc301d92f
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ echo foo > c
-  $ hg ci -Aqm "foo to c"
-  $ hg pick -r c4636a81ebeb
-  picking 6:c4636a81ebeb "add c"
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  unresolved merge conflicts (see hg help resolve)
-  [1]
-
-  $ echo foobar > c
-  $ hg resolve --all --mark
-  (no more unresolved files)
-  continue: hg pick --continue
-  $ hg pick --continue
-  $ hg glog
-  @  8:44e155eb95c7 add c
-  |
-  o  7:2ccc03d1d096 foo to c
-  |
-  | o  5:7c15c05db6fa add b
-  |/
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  o  0:1f0dee641bb7 add a
-  
-
-When interrupted grab results in no changes to commit
-
-  $ hg up d46dc301d92f
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ echo bar > c
-  $ hg add c
-  $ hg ci -m "foo to c"
-  created new head
-
-  $ hg up 44e155eb95c7
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-
-  $ hg pick 4e04628911f6
-  picking 9:4e04628911f6 "foo to c"
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  unresolved merge conflicts (see hg help resolve)
-  [1]
-  $ echo foobar > c
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg pick --continue
-
-  $ hg pick --continue
-  note: picking 9:4e04628911f6 created no changes to commit
-
-Testing the abort functionality of hg pick
-
-  $ echo foo > b
-  $ hg ci -Aqm "foo to b"
-  $ hg glog -r .^::
-  @  10:c437988de89f foo to b
-  |
-  o  8:44e155eb95c7 add c
-  |
-  ~
-
-  $ hg pick -r 7c15c05db6fa
-  picking 5:7c15c05db6fa "add b"
-  merging b
-  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  unresolved merge conflicts (see hg help resolve)
-  [1]
-
-  $ hg pick --abort
-  aborting pick, updating to c437988de89f
-
-  $ hg glog
-  @  10:c437988de89f foo to b
-  |
-  o  8:44e155eb95c7 add c
-  |
-  o  7:2ccc03d1d096 foo to c
-  |
-  | o  5:7c15c05db6fa add b
-  |/
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  o  0:1f0dee641bb7 add a
-  
-
-Trying to grab a public changeset
-
-  $ hg phase -r 7c15c05db6fa -p
-
-  $ hg pick -r 7c15c05db6fa
-  abort: cannot pick public changesets: 7c15c05db6fa
-  (see 'hg help phases' for details)
-  [255]
-
-  $ hg glog
-  @  10:c437988de89f foo to b
-  |
-  o  8:44e155eb95c7 add c
-  |
-  o  7:2ccc03d1d096 foo to c
-  |
-  | o  5:7c15c05db6fa add b
-  |/
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  o  0:1f0dee641bb7 add a
-  
-Checking phase preservation while grabbing secret changeset
-
-In case of merge conflicts
-
-  $ hg phase -r 7c15c05db6fa -s -f
-
-  $ hg pick -r 7c15c05db6fa
-  picking 5:7c15c05db6fa "add b"
-  merging b
-  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  unresolved merge conflicts (see hg help resolve)
-  [1]
-
-  $ echo bar > b
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg pick --continue
-
-  $ hg pick --continue
-  $ hg phase -r .
-  11: secret
-
-No merge conflicts
-
-  $ hg up d46dc301d92f
-  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  $ echo foo > l
-  $ hg add l
-  $ hg ci -qm "added l" --secret
-
-  $ hg phase -r .
-  12: secret
-
-  $ hg glog
-  @  12:508d572e7053 added l
-  |
-  | o  11:10427de9e26e add b
-  | |
-  | o  10:c437988de89f foo to b
-  | |
-  | o  8:44e155eb95c7 add c
-  | |
-  | o  7:2ccc03d1d096 foo to c
-  |/
-  o  4:d46dc301d92f add y
-  |
-  o  3:8e224524cd09 add x
-  |
-  o  0:1f0dee641bb7 add a
-  
-  $ hg up 10427de9e26e
-  3 files updated, 0 files merged, 1 files removed, 0 files unresolved
-
-  $ hg pick -r 508d572e7053
-  picking 12:508d572e7053 "added l"
-
-  $ hg phase -r .
-  13: secret
--- a/tests/test-obsolete.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-obsolete.t	Thu Apr 11 22:41:25 2019 +0200
@@ -236,7 +236,7 @@
   abort: push includes orphan changeset: 95de7fc6918d!
   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   [255]
-  $ hg push ../other-new -f # use f because there is unstability
+  $ hg push ../other-new -f # use f because there is an orphan
   pushing to ../other-new
   searching for changes
   adding changesets
@@ -431,7 +431,7 @@
   1 new phase-divergent changesets
 83b5778897ad try to obsolete immutable changeset 1f0dee641bb7
 # at core level the warning is not issued
-# this is now a big issue now that we have bumped warning
+# this is now a big issue now that we have phase divergence warning
   $ qlog -r 'obsolete()'
   3
   - 0d3f46688ccc
@@ -574,7 +574,7 @@
   obsoleted 1 changesets
   $ cd ..
 
-check bumped detection
+check phase divergence detection
 (make an obsolete changeset public)
 
   $ cd local
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pick.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,388 @@
+Test for the pick command
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -G -T "{rev}:{node|short} {desc}\n"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ hg init repo
+  $ cd repo
+  $ hg help pick
+  hg pick [-r] rev
+  
+  aliases: grab
+  
+  move a commit on the top of working directory parent and updates to it.
+  
+  options:
+  
+   -r --rev REV   revision to pick
+   -c --continue  continue interrupted pick
+   -a --abort     abort interrupted pick
+   -t --tool TOOL specify merge tool
+  
+  (some details hidden, use --verbose to show complete help)
+
+  $ mkcommit a
+  $ mkcommit b
+  $ mkcommit c
+
+  $ hg glog
+  @  2:4538525df7e2 add c
+  |
+  o  1:7c3bad9141dc add b
+  |
+  o  0:1f0dee641bb7 add a
+  
+
+Grabbing an ancestor
+
+  $ hg pick -r 7c3bad9141dc
+  abort: cannot pick an ancestor revision
+  [255]
+
+Grabbing the working directory parent
+
+  $ hg pick -r .
+  abort: cannot pick an ancestor revision
+  [255]
+
+Specifying multiple revisions to pick
+
+  $ hg pick 1f0dee641bb7 -r 7c3bad9141dc
+  abort: specify just one revision
+  [255]
+
+Specifying no revisions to pick
+
+  $ hg pick
+  abort: empty revision set
+  [255]
+
+Continuing without interrupted pick
+
+  $ hg pick --continue
+  abort: no interrupted pick state exists
+  [255]
+
+Aborting without interrupted pick
+
+  $ hg pick --abort
+  abort: no interrupted pick state exists
+  [255]
+
+Specifying both continue and revs
+
+  $ hg up 1f0dee641bb7
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg pick -r 4538525df7e2 --continue
+  abort: cannot specify both --continue and revision
+  [255]
+
+Making new branch heads
+
+  $ mkcommit x
+  created new head
+  $ mkcommit y
+
+  $ hg glog
+  @  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  | o  2:4538525df7e2 add c
+  | |
+  | o  1:7c3bad9141dc add b
+  |/
+  o  0:1f0dee641bb7 add a
+  
+Grabbing a revision
+
+  $ hg pick 7c3bad9141dc
+  picking 1:7c3bad9141dc "add b"
+  1 new orphan changesets
+  $ hg glog
+  @  5:7c15c05db6fa add b
+  |
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  | *  2:4538525df7e2 add c
+  | |
+  | x  1:7c3bad9141dc add b
+  |/
+  o  0:1f0dee641bb7 add a
+  
+
+When pick does not create any changes
+
+  $ hg graft -r 4538525df7e2
+  grafting 2:4538525df7e2 "add c"
+
+  $ hg glog
+  @  6:c4636a81ebeb add c
+  |
+  o  5:7c15c05db6fa add b
+  |
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  | *  2:4538525df7e2 add c
+  | |
+  | x  1:7c3bad9141dc add b
+  |/
+  o  0:1f0dee641bb7 add a
+  
+  $ hg pick -r 4538525df7e2
+  picking 2:4538525df7e2 "add c"
+  note: picking 2:4538525df7e2 created no changes to commit
+
+  $ hg glog
+  @  6:c4636a81ebeb add c
+  |
+  o  5:7c15c05db6fa add b
+  |
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  o  0:1f0dee641bb7 add a
+  
+interrupted pick
+
+  $ hg up d46dc301d92f
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo foo > c
+  $ hg ci -Aqm "foo to c"
+  $ hg pick -r c4636a81ebeb
+  picking 6:c4636a81ebeb "add c"
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+
+  $ echo foobar > c
+  $ hg resolve --all --mark
+  (no more unresolved files)
+  continue: hg pick --continue
+  $ hg pick --continue
+  $ hg glog
+  @  8:44e155eb95c7 add c
+  |
+  o  7:2ccc03d1d096 foo to c
+  |
+  | o  5:7c15c05db6fa add b
+  |/
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  o  0:1f0dee641bb7 add a
+  
+
+When interrupted pick results in no changes to commit
+
+  $ hg up d46dc301d92f
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bar > c
+  $ hg add c
+  $ hg ci -m "foo to c"
+  created new head
+
+  $ hg up 44e155eb95c7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg pick 4e04628911f6
+  picking 9:4e04628911f6 "foo to c"
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+  $ echo foobar > c
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg pick --continue
+
+  $ hg pick --continue
+  note: picking 9:4e04628911f6 created no changes to commit
+
+Testing the abort functionality of hg pick
+
+  $ echo foo > b
+  $ hg ci -Aqm "foo to b"
+  $ hg glog -r .^::
+  @  10:c437988de89f foo to b
+  |
+  o  8:44e155eb95c7 add c
+  |
+  ~
+
+  $ hg pick -r 7c15c05db6fa
+  picking 5:7c15c05db6fa "add b"
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+
+  $ hg pick --abort
+  aborting pick, updating to c437988de89f
+
+  $ hg glog
+  @  10:c437988de89f foo to b
+  |
+  o  8:44e155eb95c7 add c
+  |
+  o  7:2ccc03d1d096 foo to c
+  |
+  | o  5:7c15c05db6fa add b
+  |/
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  o  0:1f0dee641bb7 add a
+  
+
+Trying to pick a public changeset
+
+  $ hg phase -r 7c15c05db6fa -p
+
+  $ hg pick -r 7c15c05db6fa
+  abort: cannot pick public changesets: 7c15c05db6fa
+  (see 'hg help phases' for details)
+  [255]
+
+  $ hg glog
+  @  10:c437988de89f foo to b
+  |
+  o  8:44e155eb95c7 add c
+  |
+  o  7:2ccc03d1d096 foo to c
+  |
+  | o  5:7c15c05db6fa add b
+  |/
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  o  0:1f0dee641bb7 add a
+  
+Checking phase preservation while picking secret changeset
+
+In case of merge conflicts
+
+  $ hg phase -r 7c15c05db6fa -s -f
+
+  $ hg pick -r 7c15c05db6fa
+  picking 5:7c15c05db6fa "add b"
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+
+  $ echo bar > b
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg pick --continue
+
+  $ hg pick --continue
+  $ hg phase -r .
+  11: secret
+
+No merge conflicts
+
+  $ hg up d46dc301d92f
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo foo > l
+  $ hg add l
+  $ hg ci -qm "added l" --secret
+
+  $ hg phase -r .
+  12: secret
+
+  $ hg glog
+  @  12:508d572e7053 added l
+  |
+  | o  11:10427de9e26e add b
+  | |
+  | o  10:c437988de89f foo to b
+  | |
+  | o  8:44e155eb95c7 add c
+  | |
+  | o  7:2ccc03d1d096 foo to c
+  |/
+  o  4:d46dc301d92f add y
+  |
+  o  3:8e224524cd09 add x
+  |
+  o  0:1f0dee641bb7 add a
+  
+  $ hg up 10427de9e26e
+  3 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg pick -r 508d572e7053
+  picking 12:508d572e7053 "added l"
+
+  $ hg phase -r .
+  13: secret
+  $ cd ..
+
+Check pick behavior regarding working copy branch (issue6089)
+-------------------------------------------------------------
+
+The branch of the picked changeset should be preserved, and the working copy updated
+
+  $ hg init issue6089
+  $ cd issue6089
+
+  $ touch a
+  $ hg add a
+  $ hg ci -m 'first commit on default'
+
+  $ hg branch foo
+  marked working directory as branch foo
+  (branches are permanent and global, did you want a bookmark?)
+  $ touch b
+  $ hg add b
+  $ hg ci -m 'first commit on foo'
+
+  $ hg up default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo test > a
+  $ hg ci -m 'second commit on default'
+  $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()'
+  o  ffffffffffff: default
+  |
+  @  5f07cbf7d111: default
+  |
+  | o  96bb2057779e: foo
+  |/
+  o  d03a6bcc83cd: default
+  
+
+  $ hg pick 1
+  picking 1:96bb2057779e "first commit on foo"
+  $ hg log --template '{branch}\n' -r tip
+  foo
+  $ hg branch
+  foo
+  $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()'
+  o  ffffffffffff: foo
+  |
+  @  5344a77549bd: foo
+  |
+  o  5f07cbf7d111: default
+  |
+  o  d03a6bcc83cd: default
+  
+  $ cd ..
--- a/tests/test-prev-next.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-prev-next.t	Thu Apr 11 22:41:25 2019 +0200
@@ -213,13 +213,13 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [3] added b (2)
   $ hg next <<EOF
-  > 1
+  > 2
   > EOF
   ambiguous next changeset, choose one to update:
-  0: [e3b6d5df389b] added c
-  1: [9df671ccd2c7] added d
+  1: [e3b6d5df389b] added c
+  2: [9df671ccd2c7] added d
   q: quit the prompt
-  enter the index of the revision you want to select: 1
+  enter the index of the revision you want to select: 2
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [5] added d
 
@@ -236,13 +236,13 @@
   (2 unstable changesets to be evolved here, do you want --evolve?)
   [1]
   $ hg next --evolve <<EOF
-  > 0
+  > 1
   > EOF
   ambiguous next (unstable) changeset, choose one to evolve and update:
-  0: [e3b6d5df389b] added c
-  1: [9df671ccd2c7] added d
+  1: [e3b6d5df389b] added c
+  2: [9df671ccd2c7] added d
   q: quit the prompt
-  enter the index of the revision you want to select: 0
+  enter the index of the revision you want to select: 1
   move:[4] added c
   atop:[6] added b (3)
   working directory now at 5ce67c2407b0
@@ -284,8 +284,8 @@
   > q
   > EOF
   multiple parents, choose one to update:
-  0: [47ea25be8aea] added d
-  1: [5ce67c2407b0] added c
+  1: [47ea25be8aea] added d
+  2: [5ce67c2407b0] added c
   q: quit the prompt
   enter the index of the revision you want to select: q
   [8] added d
@@ -300,13 +300,13 @@
   [1]
 
   $ hg prev <<EOF
-  > 1
+  > 2
   > EOF
   multiple parents, choose one to update:
-  0: [47ea25be8aea] added d
-  1: [5ce67c2407b0] added c
+  1: [47ea25be8aea] added d
+  2: [5ce67c2407b0] added c
   q: quit the prompt
-  enter the index of the revision you want to select: 1
+  enter the index of the revision you want to select: 2
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [7] added c
 
@@ -339,7 +339,7 @@
   $ sleep 1
   $ hg prev
   waiting for lock on working directory of $TESTTMP/repo held by process '*' on host '*' (glob)
-  got lock after [4-6] seconds (re)
+  got lock after (\d+) seconds (re)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [0] one
   $ wait
@@ -349,7 +349,7 @@
   $ hg next --evolve
   waiting for lock on working directory of $TESTTMP/repo held by process '*' on host '*' (glob)
   1 new orphan changesets
-  got lock after [4-6] seconds (re)
+  got lock after (\d+) seconds (re)
   move:[2] two
   atop:[3] one
   working directory now at a7d885c75614
@@ -443,9 +443,14 @@
 
 Test that --merge still works fine with commands.update.check set
 
-XXX: yes we want --merge and we passed that!
+  $ hg config commands.update.check
+  noconflict
   $ echo hi > bar
   $ echo bar >> bar
+  $ hg next
+  abort: conflicting changes
+  (do you want --merge?)
+  [255]
   $ hg next --merge
   merging bar
   warning: conflicts while merging bar! (edit, then use 'hg resolve --mark')
@@ -459,7 +464,10 @@
 
 Testing --merge works with other values of commands.update.check also
 
-XXX: things are broken!
+  $ hg prev --config commands.update.check=abort
+  abort: uncommitted changes
+  (do you want --merge?)
+  [255]
   $ hg prev --merge --config commands.update.check=abort
   file 'bar' was deleted in other [destination] but was modified in local [working copy].
   What do you want to do?
@@ -477,6 +485,10 @@
   $ echo bar > bar
   $ hg add bar
 
+  $ hg next --config commands.update.check=abort
+  abort: uncommitted changes
+  (do you want --merge?)
+  [255]
   $ hg next --merge --config commands.update.check=abort
   merging bar
   warning: conflicts while merging bar! (edit, then use 'hg resolve --mark')
--- a/tests/test-prune.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-prune.t	Thu Apr 11 22:41:25 2019 +0200
@@ -92,7 +92,7 @@
 cannot prune public changesets
 
   $ hg prune 0
-  abort: cannot touch public changesets: 1f0dee641bb7
+  abort: cannot prune public changesets: 1f0dee641bb7
   (see 'hg help phases' for details)
   [255]
   $ hg debugobsolete
--- a/tests/test-push-checkheads-unpushed-D5.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-push-checkheads-unpushed-D5.t	Thu Apr 11 22:41:25 2019 +0200
@@ -24,7 +24,7 @@
 ..
 .. * push the new branch only -> push denied
 .. * push the existing branch only -> push allowed
-..   /!\ This push create unstability/orphaning on the other hand and we should
+..   /!\ This push create instability/orphaning on the other hand and we should
 ..  probably detect/warn agains that.
 ..
 .. graph-summary:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-share.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,20 @@
+Test that share-clones use the cache in the original repository.
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ hg init share-base
+  $ cd share-base/
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > evolve=
+  > share=
+  > EOF
+  $ hg debugbuilddag .+3:branchpoint+4*branchpoint+2
+  $ cd ..
+  $ hg --config extensions.share= share -U share-base share-client
+  $ cd share-client
+  $ hg debugupdatecache
+  $ test -d .hg/cache
+  [1]
+  $ test -d ../share-base/.hg/cache
+
--- a/tests/test-sharing.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-sharing.t	Thu Apr 11 22:41:25 2019 +0200
@@ -423,8 +423,9 @@
   ~
   $ cd ..
 
-Setup for "cowboy mode" shared mutable history (to illustrate divergent
-and bumped changesets).
+Setup for shared mutable history (to illustrate content-divergence and
+phase-divergent changesets).
+
   $ rm -rf review alice bob
   $ hg clone public alice
   updating to branch default
@@ -446,8 +447,7 @@
   $ hg shortlog -r .
   4:2fe6c4bd32d0  draft  fix bug 24 (v1)
 
-Since Alice and Bob are now in cowboy mode, Alice pulls Bob's draft
-changeset and amends it herself. ::
+Alice pulls Bob's draft changeset and amends it herself. ::
 
   $ cd ../alice
   $ hg pull -u ../bob
@@ -518,12 +518,12 @@
   base: [4] fix bug 24 (v1)
   merging "other" content-divergent changeset 'e3f99ce9d9cd'
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 711ede2d7a26
+  working directory is now at b1499b0f03ca
   $ hg log -q -r 'contentdivergent()'
 
 Figure SG10: Bob's repository after fixing divergence.
   $ hg --hidden shortlog -G -r 3::
-  @  7:711ede2d7a26  draft  fix bug 24 (v2 by bob)
+  @  7:b1499b0f03ca  draft  fix bug 24 (v2 by bob)
   |
   | x  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   |/
@@ -534,7 +534,7 @@
   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   |
   ~
-  $ hg --hidden shortlog -r 'precursors(711ede2d7a26)'
+  $ hg --hidden shortlog -r 'precursors(b1499b0f03ca)'
   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   $ cat file1
--- a/tests/test-split.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-split.t	Thu Apr 11 22:41:25 2019 +0200
@@ -19,6 +19,8 @@
   > [diff]
   > git = 1
   > unified = 0
+  > [commands]
+  > commit.interactive.unified = 0
   > [ui]
   > interactive = true
   > [extensions]
@@ -485,15 +487,15 @@
   $ hg add SPLIT1 SPLIT2
   $ hg branch another-branch
   marked working directory as branch another-branch
-  $ hg commit -m "To be splitted"
+  $ hg commit -m "To be split"
   $ hg log -G -l 3
-  @  changeset:   21:8dad923bdb9b
+  @  changeset:   21:b6bf93dd314b
   |  branch:      another-branch
   |  tag:         tip
   |  topic:       mytopic
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     To be splitted
+  |  summary:     To be split
   |
   o  changeset:   20:2532b288af61
   |  branch:      new-branch
@@ -516,10 +518,10 @@
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
   # Branch another-branch
-  # Node ID 8dad923bdb9bb3b99291caa5baeb03bbc30dfd33
+  # Node ID b6bf93dd314ba47b838befc7488b2223981684ea
   # Parent  2532b288af61bd19239a95ae2a3ecb9b0ad4b8e1
   # EXP-Topic mytopic
-  To be splitted
+  To be split
   
   diff --git a/SPLIT1 b/SPLIT1
   new file mode 100644
@@ -550,7 +552,7 @@
   
   no more change to split
 
-The splitted changesets should be on the 'another-branch'
+The split changesets should be on the 'another-branch'
   $ hg log -G -l 3
   @  changeset:   23:56a59faa8af7
   |  branch:      another-branch
@@ -582,19 +584,19 @@
   marked working directory as branch yet-another-branch
   $ touch SPLIT3 SPLIT4
   $ hg add SPLIT3 SPLIT4
-  $ hg commit -m "To be splitted again"
+  $ hg commit -m "To be split again"
 
   $ hg up "tip~1"
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
 
   $ hg log -G -l 2
-  o  changeset:   24:b1020d17c364
+  o  changeset:   24:9f56497dbac1
   |  branch:      yet-another-branch
   |  tag:         tip
   |  topic:       mytopic
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     To be splitted again
+  |  summary:     To be split again
   |
   @  changeset:   23:56a59faa8af7
   |  branch:      another-branch
@@ -628,13 +630,13 @@
   another-branch
 
   $ hg log -G -l 2
-  o  changeset:   24:b1020d17c364
+  o  changeset:   24:9f56497dbac1
   |  branch:      yet-another-branch
   |  tag:         tip
   |  topic:       mytopic
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     To be splitted again
+  |  summary:     To be split again
   |
   @  changeset:   23:56a59faa8af7
   |  branch:      another-branch
@@ -1119,3 +1121,96 @@
   |
   o  0:a5a1faba8d26 p (draft)
   
+  $ cd ..
+
+Testing that `hg split` preserve the phase of splitting cset(issue6048)
+-----------------------------------------------------------------------
+
+Prepare the repository:
+  $ hg init issue6048
+  $ cd issue6048
+  $ echo a > a
+  $ hg ci -Am "added a"
+  adding a
+
+  $ echo b > b
+  $ echo c > c
+  $ hg add b c
+  $ hg ci -m "added b c" --secret
+
+  $ hg glog -l1 -p --git
+  @  1:12e9cc39ba19 added b c (secret)
+  |  diff --git a/b b/b
+  ~  new file mode 100644
+     --- /dev/null
+     +++ b/b
+     @@ -0,0 +1,1 @@
+     +b
+     diff --git a/c b/c
+     new file mode 100644
+     --- /dev/null
+     +++ b/c
+     @@ -0,0 +1,1 @@
+     +c
+  
+To create commits with the number of split
+  $ echo 0 > num
+  $ cat > editor.sh << '__EOF__'
+  > NUM=$(cat num)
+  > NUM=`expr "$NUM" + 1`
+  > echo "$NUM" > num
+  > echo "split$NUM" > "$1"
+  > __EOF__
+  $ export HGEDITOR="\"sh\" \"editor.sh\""
+
+Splitting
+  $ hg split -r . << EOF
+  > y
+  > y
+  > n
+  > c
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding b
+  adding c
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +b
+  record change 1/2 to 'b'? [Ynesfdaq?] y
+  
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] n
+  
+  created new head
+  (consider using topic for lightweight branches. See 'hg help topic')
+  continue splitting? [Ycdq?] c
+
+  $ hg glog --git -p
+  @  3:1f8c09b13fa2 split2 (secret)
+  |  diff --git a/c b/c
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/c
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  o  2:bcba06966846 split1 (secret)
+  |  diff --git a/b b/b
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/b
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  0:9092f1db7931 added a (draft)
+     diff --git a/a b/a
+     new file mode 100644
+     --- /dev/null
+     +++ b/a
+     @@ -0,0 +1,1 @@
+     +a
+  
--- a/tests/test-stabilize-result.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,446 +0,0 @@
-  $ cat >> $HGRCPATH <<EOF
-  > [defaults]
-  > amend=-d "0 0"
-  > [extensions]
-  > hgext.rebase=
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ glog() {
-  >   hg log -G --template \
-  >     '{rev}:{node|short}@{branch}({phase}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
-  > }
-
-Test evolve removing the changeset being evolved
-
-  $ hg init empty
-  $ cd empty
-  $ echo a > a
-  $ hg ci -Am adda a
-  $ echo b > b
-  $ hg ci -Am addb b
-  $ echo a >> a
-  $ hg ci -m changea
-  $ hg bookmark changea
-  $ hg up 1
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  (leaving bookmark changea)
-  $ echo a >> a
-  $ hg amend -m changea
-  1 new orphan changesets
-  $ hg evolve -v --confirm
-  move:[2] changea
-  atop:[3] changea
-  perform evolve? [Ny] n
-  abort: evolve aborted by user
-  [255]
-  $ echo y | hg evolve -v --confirm --config ui.interactive=True
-  move:[2] changea
-  atop:[3] changea
-  perform evolve? [Ny] y
-  hg rebase -r cce2c55b8965 -d fb9d051ec0a4
-  resolving manifests
-  evolution of 2:cce2c55b8965 created no changes to commit
-
-  $ glog --hidden
-  @  3:fb9d051ec0a4@default(draft) bk:[changea] changea
-  |
-  | x  2:cce2c55b8965@default(draft) bk:[] changea
-  | |
-  | x  1:102a90ea7b4a@default(draft) bk:[] addb
-  |/
-  o  0:07f494440405@default(draft) bk:[] adda
-  
-  $ hg debugobsolete
-  102a90ea7b4a3361e4082ed620918c261189a36a fb9d051ec0a450a4aa2ffc8c324979832ef88065 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
-  cce2c55b896511e0b6e04173c9450ba822ebc740 0 {102a90ea7b4a3361e4082ed620918c261189a36a} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'evolve', 'user': 'test'}
-
-Test evolve with conflict
-
-  $ ls
-  a
-  b
-  $ hg pdiff a
-  diff -r 07f494440405 a
-  --- a/a	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,2 @@
-   a
-  +a
-  $ echo 'newer a' >> a
-  $ hg ci -m 'newer a'
-  $ hg gdown
-  gdown have been deprecated in favor of previous
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  [3] changea
-  $ echo 'a' > a
-  $ hg amend
-  1 new orphan changesets
-  $ hg evolve
-  move:[4] newer a
-  atop:[5] changea
-  merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-  $ hg revert -r "orphan()" a
-  $ hg diff
-  diff -r 66719795a494 a
-  --- a/a	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,3 @@
-   a
-  +a
-  +newer a
-  $ hg evolve --continue
-  abort: unresolved merge conflicts (see 'hg help resolve')
-  [255]
-  $ hg resolve -m a
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  evolving 4:3655f0f50885 "newer a"
-  working directory is now at 1cf0aacfd363
-
-Stabilize latecomer with different parent
-=========================================
-
-(the same-parent case is handled in test-evolve.t)
-
-  $ glog
-  @  6:1cf0aacfd363@default(draft) bk:[] newer a
-  |
-  o  5:66719795a494@default(draft) bk:[changea] changea
-  |
-  o  0:07f494440405@default(draft) bk:[] adda
-  
-Add another commit
-
-  $ hg gdown
-  gdown have been deprecated in favor of previous
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  [5] changea
-  $ echo 'c' > c
-  $ hg add c
-  $ hg commit -m 'add c'
-  created new head
-
-Get a successors of 8 on it
-
-  $ hg pick 1cf0aacfd363
-  picking 6:1cf0aacfd363 "newer a"
-
-Add real change to the successors
-
-  $ echo 'babar' >> a
-  $ hg amend
-
-Make precursors public
-
-  $ hg phase --hidden --public 1cf0aacfd363
-  1 new phase-divergent changesets
-  $ glog
-  @  9:99c21c89bcef@default(draft) bk:[] newer a
-  |
-  o  7:7bc2f5967f5e@default(draft) bk:[] add c
-  |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-
-Stabilize!
-
-  $ hg evolve --any --dry-run --phase-divergent
-  recreate:[9] newer a
-  atop:[6] newer a
-  hg rebase --rev 99c21c89bcef --dest 66719795a494;
-  hg update 1cf0aacfd363;
-  hg revert --all --rev 99c21c89bcef;
-  hg commit --msg "phase-divergent update to 99c21c89bcef"
-  $ hg evolve --any --confirm --phase-divergent
-  recreate:[9] newer a
-  atop:[6] newer a
-  perform evolve? [Ny] n
-  abort: evolve aborted by user
-  [255]
-  $ echo y | hg evolve --any --confirm --config ui.interactive=True --phase-divergent
-  recreate:[9] newer a
-  atop:[6] newer a
-  perform evolve? [Ny] y
-  rebasing to destination parent: 66719795a494
-  computing new diff
-  committed as 8fc63fe1f297
-  working directory is now at 8fc63fe1f297
-  $ glog
-  @  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  |
-  | o  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  o |  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-  $ hg exp
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 8fc63fe1f297f356d1156bbbbe865b9911efad74
-  # Parent  1cf0aacfd36310b18e403e1594871187e0364a82
-  phase-divergent update to 1cf0aacfd363:
-  
-  newer 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 @@
-   a
-   a
-   newer a
-  +babar
-
-Stabilize divergent changesets with same parent
-===============================================
-
-  $ rm a.orig
-  $ hg up 7bc2f5967f5e
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat << EOF >> a
-  > flore
-  > arthur
-  > zephir
-  > some
-  > less
-  > conflict
-  > EOF
-  $ hg ci -m 'More addition'
-  $ glog
-  @  12:3932c176bbaa@default(draft) bk:[] More addition
-  |
-  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  | |
-  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-  $ echo 'babar' >> a
-  $ hg amend
-  $ hg up --hidden 3932c176bbaa
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset 3932c176bbaa
-  (hidden revision '3932c176bbaa' was rewritten as: d2f173e25686)
-  working directory parent is obsolete! (3932c176bbaa)
-  (use 'hg evolve' to update to its successor: d2f173e25686)
-  $ mv a a.old
-  $ echo 'jungle' > a
-  $ cat a.old >> a
-  $ rm a.old
-  $ hg amend
-  2 new content-divergent changesets
-  $ glog
-  @  14:eacc9c8240fe@default(draft) bk:[] More addition
-  |
-  | *  13:d2f173e25686@default(draft) bk:[] More addition
-  |/
-  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  | |
-  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-
-Stabilize it
-
-  $ hg evolve -qn --confirm --content-divergent
-  merge:[14] More addition
-  with: [13] More addition
-  base: [12] More addition
-  perform evolve? [Ny] n
-  abort: evolve aborted by user
-  [255]
-  $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
-  merge:[14] More addition
-  with: [13] More addition
-  base: [12] More addition
-  perform evolve? [Ny] y
-  hg update -c eacc9c8240fe &&
-  hg merge d2f173e25686 &&
-  hg commit -m "auto merge resolving conflict between eacc9c8240fe and d2f173e25686"&&
-  hg up -C 3932c176bbaa &&
-  hg revert --all --rev tip &&
-  hg commit -m "`hg log -r eacc9c8240fe --template={desc}`";
-  $ hg evolve -v --content-divergent
-  merge:[14] More addition
-  with: [13] More addition
-  base: [12] More addition
-  merging "other" content-divergent changeset 'd2f173e25686'
-  resolving manifests
-  merging a
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  committing files:
-  a
-  committing manifest
-  committing changelog
-  working directory is now at 4d6ed26797bc
-  $ hg st
-  $ glog
-  @  15:4d6ed26797bc@default(draft) bk:[] More addition
-  |
-  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  | |
-  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-  $ hg summary
-  parent: 15:4d6ed26797bc tip
-   More addition
-  branch: default
-  commit: (clean)
-  update: 2 new changesets, 2 branch heads (merge)
-  phases: 3 draft
-  $ hg export .
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
-  # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
-  More addition
-  
-  diff -r 7bc2f5967f5e -r 4d6ed26797bc a
-  --- a/a	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,9 @@
-  +jungle
-   a
-  +flore
-  +arthur
-  +zephir
-  +some
-  +less
-  +conflict
-  +babar
-
-Check conflict during divergence resolution
--------------------------------------------------
-
-  $ hg up --hidden 3932c176bbaa
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to hidden changeset 3932c176bbaa
-  (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc)
-  working directory parent is obsolete! (3932c176bbaa)
-  (use 'hg evolve' to update to its successor: 4d6ed26797bc)
-  $ echo 'gotta break' >> a
-  $ hg amend
-  2 new content-divergent changesets
-# reamend so that the case is not the first precursor.
-  $ hg amend -m "More addition (2)"
-  $ hg phase 'contentdivergent()'
-  15: draft
-  17: draft
-
-  $ glog
-  @  17:0b336205a5d0@default(draft) bk:[] More addition (2)
-  |
-  | *  15:4d6ed26797bc@default(draft) bk:[] More addition
-  |/
-  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  | |
-  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-
-  $ hg evolve -qn --content-divergent
-  hg update -c 0b336205a5d0 &&
-  hg merge 4d6ed26797bc &&
-  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
-  hg up -C 3932c176bbaa &&
-  hg revert --all --rev tip &&
-  hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
-  $ hg evolve --content-divergent
-  merge:[17] More addition (2)
-  with: [15] More addition
-  base: [12] More addition
-  merging "other" content-divergent changeset '4d6ed26797bc'
-  merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  fix conflicts and see `hg help evolve.interrupted`
-  [1]
-
-  $ cat > a <<EOF
-  > jungle
-  > a
-  > flore
-  > arthur
-  > zephir
-  > some
-  > less
-  > conflict
-  > babar
-  > EOF
-
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  working directory is now at e8746835a2a1
-  $ glog
-  @  18:e8746835a2a1@default(draft) bk:[] More addition (2)
-  |
-  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
-  | |
-  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
-  | |
-  | o  6:1cf0aacfd363@default(public) bk:[] newer a
-  |/
-  o  5:66719795a494@default(public) bk:[changea] changea
-  |
-  o  0:07f494440405@default(public) bk:[] adda
-  
-  $ hg exp
-  # HG changeset patch
-  # User test
-  # Date 0 0
-  #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
-  # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
-  More addition (2)
-  
-  diff -r 7bc2f5967f5e -r e8746835a2a1 a
-  --- a/a	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,9 @@
-  +jungle
-   a
-  +flore
-  +arthur
-  +zephir
-  +some
-  +less
-  +conflict
-  +babar
--- a/tests/test-stack-branch.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-stack-branch.t	Thu Apr 11 22:41:25 2019 +0200
@@ -105,7 +105,7 @@
   phases: 4 draft
 
 Case with some of the branch unstable
-------------------------------------
+-------------------------------------
 
   $ echo bbb > ddd
   $ hg commit --amend
@@ -127,8 +127,8 @@
   
   $ hg stack
   ### target: foo (branch)
-  s4$ c_f (unstable)
-  s3$ c_e (unstable)
+  s4$ c_f (orphan)
+  s3$ c_e (orphan)
   s2@ c_d (current)
   s1: c_c
   s0^ c_b (base)
@@ -136,8 +136,8 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg stack
   ### target: foo (branch)
-  s4$ c_f (unstable)
-  s3$ c_e (current unstable)
+  s4$ c_f (orphan)
+  s3@ c_e (current orphan)
   s2: c_d
   s1: c_c
   s0^ c_b (base)
@@ -217,7 +217,7 @@
   s1: c_c
   s0^ c_b (base)
 
-Case with multiple heads on the topic with unstability involved
+Case with multiple heads on the topic with instability involved
 ---------------------------------------------------------------
 
 We amend the message to make sure the display base pick the right changeset
@@ -255,8 +255,8 @@
   s6: c_h
   s5: c_g
   s2^ c_D (base current)
-  s4$ c_f (unstable)
-  s3$ c_e (unstable)
+  s4$ c_f (orphan)
+  s3$ c_e (orphan)
   s2@ c_D (current)
   s1: c_c
   s0^ c_b (base)
@@ -289,8 +289,8 @@
   s6: c_h
   s5: c_g
   s2^ c_D (base current)
-  s4$ c_f (unstable)
-  s3$ c_e (unstable)
+  s4$ c_f (orphan)
+  s3$ c_e (orphan)
   s2@ c_D (current)
   s1: c_c
   s0^ c_b (base)
@@ -300,8 +300,8 @@
   s5: c_h
   s4: c_g
   s1^ c_D (base current)
-  s3$ c_f (unstable)
-  s2$ c_e (unstable)
+  s3$ c_f (orphan)
+  s2$ c_e (orphan)
   s1@ c_D (current)
   s0^ c_c (base)
 
@@ -312,7 +312,7 @@
   changed topic on 2 changesets to "sometopic"
   $ hg stack
   ### target: foo (branch)
-  s3$ c_f (unstable)
-  s2$ c_e (unstable)
+  s3$ c_f (orphan)
+  s2$ c_e (orphan)
   s1@ c_D (current)
   s0^ c_c (base)
--- a/tests/test-topic-stack-complex.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-topic-stack-complex.t	Thu Apr 11 22:41:25 2019 +0200
@@ -86,7 +86,7 @@
   $ hg stack
   ### topic: foo
   ### target: default (branch)
-  s4$ Added e and f (unstable)
+  s4$ Added e and f (orphan)
   s3@ split2 (current)
   s2: split1
   s1: Added a and b
@@ -129,8 +129,8 @@
   $ hg stack
   ### topic: foo (2 heads)
   ### target: default (branch), 2 behind
-  s4$ Added e and f (unstable)
-  s3$ split2 (unstable)
+  s4$ Added e and f (orphan)
+  s3$ split2 (orphan)
   s2@ split1 (current)
   s1: Added a and b
   s0^ Added foo (base)
@@ -161,9 +161,9 @@
   $ hg stack
   ### topic: foo (2 heads)
   ### target: default (branch)
-  s5: Added e and f
+  s5$ Added e and f (content divergent)
   s3^ split2 (base)
-  s4@ Added e and f (current)
+  s4@ Added e and f (content divergent current)
   s3: split2
   s2: split1
   s1: Added a and b
--- a/tests/test-topic-stack-data.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-topic-stack-data.t	Thu Apr 11 22:41:25 2019 +0200
@@ -61,7 +61,7 @@
   (see 'hg help topics' for more information)
   $ mkcommit baz_b
 
-A simple topic with unstability
+A simple topic with instability
 
   $ hg up 'desc(base_d)'
   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
@@ -266,7 +266,7 @@
   ### target: default (branch)
   s5: add bar_c
   s2^ add bar_b (base)
-  s4$ add bar_e (unstable)
+  s4$ add bar_e (orphan)
   s3: bar1_d
   s2: add bar_b
   s1: add bar_a
@@ -276,7 +276,7 @@
   ### target: default (branch)
   s5(9cbadf11b44d): add bar_c
   s2(e555c7e8c767)^ add bar_b (base)
-  s4(a920412b5a05)$ add bar_e (unstable)
+  s4(a920412b5a05)$ add bar_e (orphan)
   s3(6915989374b1): bar1_d
   s2(e555c7e8c767): add bar_b
   s1(a5c2b4e00bbf): add bar_a
@@ -296,7 +296,7 @@
   $ hg stack fuz
   ### topic: fuz
   ### target: default (branch), 1 behind
-  s3$ add fuz_c (unstable)
-  s2$ add fuz_b (unstable)
+  s3$ add fuz_c (orphan)
+  s2$ add fuz_b (orphan)
   s1: fuz1_a
   s0^ add base_d (base)
--- a/tests/test-topic-stack.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-topic-stack.t	Thu Apr 11 22:41:25 2019 +0200
@@ -331,8 +331,8 @@
   $ hg topic --list
   ### topic: foo
   ### target: default (branch)
-  s4$ c_f (unstable)
-  s3$ c_e (unstable)
+  s4$ c_f (orphan)
+  s3$ c_e (orphan)
   s2@ c_d (current)
   s1: c_c
   s0^ c_b (base)
@@ -341,16 +341,16 @@
   $ hg topic --list
   ### topic: foo
   ### target: default (branch)
-  s4$ c_f (unstable)
-  s3$ c_e (current unstable)
+  s4$ c_f (orphan)
+  s3@ c_e (current orphan)
   s2: c_d
   s1: c_c
   s0^ c_b (base)
   $ hg topic --list --color=debug
   [topic.stack.summary.topic|### topic: [topic.active|foo]]
   [topic.stack.summary.branches|### target: default (branch)]
-  [topic.stack.index topic.stack.index.unstable|s4][topic.stack.state topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.unstable|c_f][topic.stack.state topic.stack.state.unstable| (unstable)]
-  [topic.stack.index topic.stack.index.current topic.stack.index.unstable|s3][topic.stack.state topic.stack.state.current topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.unstable|c_e][topic.stack.state topic.stack.state.current topic.stack.state.unstable| (current unstable)]
+  [topic.stack.index topic.stack.index.orphan|s4][topic.stack.state topic.stack.state.orphan|$] [topic.stack.desc topic.stack.desc.orphan|c_f][topic.stack.state topic.stack.state.orphan| (orphan)]
+  [topic.stack.index topic.stack.index.current topic.stack.index.orphan|s3][topic.stack.state topic.stack.state.current topic.stack.state.orphan|@] [topic.stack.desc topic.stack.desc.current topic.stack.desc.orphan|c_e][topic.stack.state topic.stack.state.current topic.stack.state.orphan| (current orphan)]
   [topic.stack.index topic.stack.index.clean|s2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
   [topic.stack.index topic.stack.index.clean|s1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
   [topic.stack.index topic.stack.index.base|s0][topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b][topic.stack.state topic.stack.state.base| (base)]
@@ -477,8 +477,8 @@
   s6: c_h
   s5: c_g
   s2^ c_D (base current)
-  s4$ c_f (unstable)
-  s3$ c_e (unstable)
+  s4$ c_f (orphan)
+  s3$ c_e (orphan)
   s2@ c_D (current)
   s1: c_c
   s0^ c_b (base)
@@ -756,24 +756,24 @@
   $ hg stack red
   ### topic: red
   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
-  s5$ c_H (unstable)
+  s5$ c_H (orphan)
     ^ c_G
     ^ c_D
-  s4$ c_C (unstable)
+  s4$ c_C (orphan)
   s1^ c_B (base)
-  s3$ c_F (unstable)
-  s2$ c_E (unstable)
+  s3$ c_F (orphan)
+  s2$ c_E (orphan)
   s1: c_B
   s0^ c_A (base)
   $ hg stack blue
   ### topic: blue
   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
-  s3$ c_I (unstable)
+  s3$ c_I (orphan)
     ^ c_H
-  s2$ c_G (unstable)
+  s2$ c_G (orphan)
     ^ c_F
-  s1$ c_D (current unstable)
-  s0^ c_C (base unstable)
+  s1@ c_D (current orphan)
+  s0^ c_C (base orphan)
 
 more obsolescence
 
@@ -830,24 +830,24 @@
   $ hg stack red
   ### topic: red
   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
-  s5$ c_H (unstable)
+  s5$ c_H (orphan)
     ^ c_G
     ^ c_D
-  s4$ c_F (unstable)
-  s3$ c_E (unstable)
+  s4$ c_F (orphan)
+  s3$ c_E (orphan)
   s1^ c_B (base)
-  s2$ c_C (unstable)
+  s2$ c_C (orphan)
   s1: c_B
   s0^ c_A (base)
   $ hg stack blue
   ### topic: blue
   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
-  s3$ c_I (unstable)
+  s3$ c_I (orphan)
     ^ c_H
-  s2$ c_G (unstable)
+  s2$ c_G (orphan)
     ^ c_F
-  s1$ c_D (current unstable)
-  s0^ c_C (base unstable)
+  s1@ c_D (current orphan)
+  s0^ c_C (base orphan)
 
 Test stack behavior with a split
 --------------------------------
@@ -886,7 +886,7 @@
   $ hg stack
   ### topic: blue
   ### target: default (branch)
-  s3$ c_I (unstable)
+  s3$ c_I (orphan)
   s2@ c_G (current)
   s1: c_D
   s0^ c_A (base)
@@ -966,7 +966,7 @@
   $ hg stack
   ### topic: blue
   ### target: default (branch)
-  s4$ c_I (unstable)
+  s4$ c_I (orphan)
   s3@ c_G (current)
   s2: c_G
   s1: c_D
--- a/tests/test-topic-tutorial.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-topic-tutorial.t	Thu Apr 11 22:41:25 2019 +0200
@@ -1358,8 +1358,8 @@
   $ hg stack
   ### topic: tools
   ### target: default (branch), 2 behind
-  s3$ Adding drill (unstable)
-  s2$ Adding saw (unstable)
+  s3$ Adding drill (orphan)
+  s2$ Adding saw (orphan)
   s1@ Adding hammer to the shopping list (current)
   s0^ add a pair of shoes (base)
 
@@ -1375,7 +1375,7 @@
   $ hg stack
   ### topic: tools
   ### target: default (branch), 2 behind
-  s3$ Adding drill (unstable)
+  s3$ Adding drill (orphan)
   s2@ Adding saw (current)
   s1: Adding hammer to the shopping list
   s0^ add a pair of shoes (base)
--- a/tests/test-touch.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-touch.t	Thu Apr 11 22:41:25 2019 +0200
@@ -161,3 +161,12 @@
        rewritten(.*) as [0-9a-f]{12} using touch by test (.*) (re)
          note: testing with no successor
   
+
+Public phase
+
+  $ hg phase --public -r 2
+  $ hg touch 2
+  abort: cannot touch public changesets: * (glob)
+  (see 'hg help phases' for details)
+  [255]
+  $ hg touch --duplicate 2
--- a/tests/test-uncommit.t	Tue Jan 22 12:54:41 2019 -0500
+++ b/tests/test-uncommit.t	Thu Apr 11 22:41:25 2019 +0200
@@ -514,3 +514,22 @@
   (use 'hg prune .' to remove it)
   $ hg status
   ? foo
+
+Bad explicit paths abort, like the bundled commit extension
+
+  $ hg uncommit foo
+  abort: cannot uncommit "foo"
+  (file was untracked in working directory parent)
+  [255]
+
+  $ hg ci -Aqm 'add foo'
+  $ hg uncommit bar
+  abort: cannot uncommit "bar"
+  (file does not exist)
+  [255]
+  $ hg uncommit d
+  abort: cannot uncommit "d"
+  (file was not changed in working directory parent)
+  [255]
+
+  $ hg status
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-unstability-resolution-result.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,215 @@
+=================================================================
+Test automatic unstability resolution for multiple advanced cases
+=================================================================
+
+There are dedicated test case for each instability, but this file check some
+basic case for each type.
+
+XXX dispatching each these test case in appropriate file would make sense.
+
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > amend=-d "0 0"
+  > [extensions]
+  > hgext.rebase=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ glog() {
+  >   hg log -G --template \
+  >     '{rev}:{node|short}@{branch}({phase}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
+  > }
+
+Test evolve removing the orphan changeset being evolved
+
+  $ hg init empty
+  $ cd empty
+  $ echo a > a
+  $ hg ci -Am adda a
+  $ echo b > b
+  $ hg ci -Am addb b
+  $ echo a >> a
+  $ hg ci -m changea
+  $ hg bookmark changea
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (leaving bookmark changea)
+  $ echo a >> a
+  $ hg amend -m changea
+  1 new orphan changesets
+  $ hg evolve -v --confirm
+  move:[2] changea
+  atop:[3] changea
+  perform evolve? [Ny] n
+  abort: evolve aborted by user
+  [255]
+  $ echo y | hg evolve -v --confirm --config ui.interactive=True
+  move:[2] changea
+  atop:[3] changea
+  perform evolve? [Ny] y
+  hg rebase -r cce2c55b8965 -d fb9d051ec0a4
+  resolving manifests
+  evolution of 2:cce2c55b8965 created no changes to commit
+
+  $ glog --hidden
+  @  3:fb9d051ec0a4@default(draft) bk:[changea] changea
+  |
+  | x  2:cce2c55b8965@default(draft) bk:[] changea
+  | |
+  | x  1:102a90ea7b4a@default(draft) bk:[] addb
+  |/
+  o  0:07f494440405@default(draft) bk:[] adda
+  
+  $ hg debugobsolete
+  102a90ea7b4a3361e4082ed620918c261189a36a fb9d051ec0a450a4aa2ffc8c324979832ef88065 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  cce2c55b896511e0b6e04173c9450ba822ebc740 0 {102a90ea7b4a3361e4082ed620918c261189a36a} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'evolve', 'user': 'test'}
+
+Test evolve of orphan that run into conflict
+
+  $ ls
+  a
+  b
+  $ hg pdiff a
+  diff -r 07f494440405 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,2 @@
+   a
+  +a
+  $ echo 'newer a' >> a
+  $ hg ci -m 'newer a'
+  $ hg gdown
+  gdown have been deprecated in favor of previous
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [3] changea
+  $ echo 'a' > a
+  $ hg amend
+  1 new orphan changesets
+  $ hg evolve
+  move:[4] newer a
+  atop:[5] changea
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+  $ hg revert -r "orphan()" a
+  $ hg diff
+  diff -r 66719795a494 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,3 @@
+   a
+  +a
+  +newer a
+  $ hg evolve --continue
+  abort: unresolved merge conflicts (see 'hg help resolve')
+  [255]
+  $ hg resolve -m a
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  evolving 4:3655f0f50885 "newer a"
+  working directory is now at 1cf0aacfd363
+
+Stabilize phase-divergent changesets with a different parent
+============================================================
+
+(the same-parent case is handled in test-evolve.t)
+
+  $ glog
+  @  6:1cf0aacfd363@default(draft) bk:[] newer a
+  |
+  o  5:66719795a494@default(draft) bk:[changea] changea
+  |
+  o  0:07f494440405@default(draft) bk:[] adda
+  
+
+Add another commit
+
+  $ hg gdown
+  gdown have been deprecated in favor of previous
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [5] changea
+  $ echo 'c' > c
+  $ hg add c
+  $ hg commit -m 'add c'
+  created new head
+
+Get a successors of 8 on it
+
+  $ hg pick 1cf0aacfd363
+  picking 6:1cf0aacfd363 "newer a"
+
+Add real change to the successors
+
+  $ echo 'babar' >> a
+  $ hg amend
+
+Make precursors public
+
+  $ hg phase --hidden --public 1cf0aacfd363
+  1 new phase-divergent changesets
+  $ glog
+  @  9:99c21c89bcef@default(draft) bk:[] newer a
+  |
+  o  7:7bc2f5967f5e@default(draft) bk:[] add c
+  |
+  | o  6:1cf0aacfd363@default(public) bk:[] newer a
+  |/
+  o  5:66719795a494@default(public) bk:[changea] changea
+  |
+  o  0:07f494440405@default(public) bk:[] adda
+  
+
+Stabilize!
+
+  $ hg evolve --any --dry-run --phase-divergent
+  recreate:[9] newer a
+  atop:[6] newer a
+  hg rebase --rev 99c21c89bcef --dest 66719795a494;
+  hg update 1cf0aacfd363;
+  hg revert --all --rev 99c21c89bcef;
+  hg commit --msg "phase-divergent update to 99c21c89bcef"
+  $ hg evolve --any --confirm --phase-divergent
+  recreate:[9] newer a
+  atop:[6] newer a
+  perform evolve? [Ny] n
+  abort: evolve aborted by user
+  [255]
+  $ echo y | hg evolve --any --confirm --config ui.interactive=True --phase-divergent
+  recreate:[9] newer a
+  atop:[6] newer a
+  perform evolve? [Ny] y
+  rebasing to destination parent: 66719795a494
+  committed as 8fc63fe1f297
+  working directory is now at 8fc63fe1f297
+  $ glog
+  @  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  |
+  | o  7:7bc2f5967f5e@default(draft) bk:[] add c
+  | |
+  o |  6:1cf0aacfd363@default(public) bk:[] newer a
+  |/
+  o  5:66719795a494@default(public) bk:[changea] changea
+  |
+  o  0:07f494440405@default(public) bk:[] adda
+  
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 8fc63fe1f297f356d1156bbbbe865b9911efad74
+  # Parent  1cf0aacfd36310b18e403e1594871187e0364a82
+  phase-divergent update to 1cf0aacfd363:
+  
+  newer 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 @@
+   a
+   a
+   newer a
+  +babar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-unstable-orphan.t	Thu Apr 11 22:41:25 2019 +0200
@@ -0,0 +1,131 @@
+==================================
+Test for "orphan" type instability
+==================================
+
+This file gather test case around the "orphan" changeset instability. This
+instability happens when a changesets has obsolete ancestors.
+
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > amend=-d "0 0"
+  > fold=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [diff]
+  > git = 1
+  > unified = 0
+  > [ui]
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ mkstack() {
+  >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
+  >    hg update "$1" -C
+  >    shift
+  >    mkcommits $*
+  > }
+
+  $ mkcommits() {
+  >   for i in $@; do mkcommit $i ; done
+  > }
+
+orphan parent is obsolete with a single successor
+=================================================
+
+Test orphan resolution for a changeset orphan because its parent is obsolete
+with one successor.
+
+  $ hg init test1
+  $ cd test1
+  $ mkcommits _a _b _c
+  $ hg up "desc(_b)"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg amend -m "bprime"
+  1 new orphan changesets
+  $ hg log -G
+  @  3:36050226a9b9@default(draft) bprime
+  |
+  | *  2:102002290587@default(draft) add _c
+  | |
+  | x  1:37445b16603b@default(draft) add _b
+  |/
+  o  0:135f39f4bd78@default(draft) add _a
+  
+
+  $ hg evo --all --any --orphan
+  move:[2] add _c
+  atop:[3] bprime
+  working directory is now at fdcf3523a74d
+  $ hg log -G
+  @  4:fdcf3523a74d@default(draft) add _c
+  |
+  o  3:36050226a9b9@default(draft) bprime
+  |
+  o  0:135f39f4bd78@default(draft) add _a
+  
+
+  $ cd ..
+
+
+orphan parent is obsolete with a multiple successors (reversed order)
+=====================================================================
+
+Test orphan resolution for a changeset orphan because its parent is obsolete
+with multiple successors on the same branch but in reverse order (cross-split).
+
+  $ hg init test5
+  $ cd test5
+  $ mkcommits _a _b _c
+  $ hg up "desc(_a)"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ mkcommits bprimesplit1 bprimesplit2
+  created new head
+  $ hg prune "desc(_b)" -s "desc(bprimesplit1) + desc(bprimesplit2)" --split
+  1 changesets pruned
+  1 new orphan changesets
+  $ hg up "desc(_a)"
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ mkcommits bsecondsplit1 bsecondsplit2
+  created new head
+  $ hg prune "desc(bprimesplit1)" -s "desc(bsecondsplit2)"
+  1 changesets pruned
+  1 new orphan changesets
+  $ hg prune "desc(bprimesplit2)" -s "desc(bsecondsplit1)"
+  1 changesets pruned
+  $ hg log -G
+  @  6:59b942dbda14@default(draft) add bsecondsplit2
+  |
+  o  5:8ffdae67d696@default(draft) add bsecondsplit1
+  |
+  | *  2:102002290587@default(draft) add _c
+  | |
+  | x  1:37445b16603b@default(draft) add _b
+  |/
+  o  0:135f39f4bd78@default(draft) add _a
+  
+
+  $ hg evo --all --any --orphan
+  move:[2] add _c
+  atop:[6] add bsecondsplit2
+  working directory is now at 98e3f21461ff
+  $ hg log -G
+  @  7:98e3f21461ff@default(draft) add _c
+  |
+  o  6:59b942dbda14@default(draft) add bsecondsplit2
+  |
+  o  5:8ffdae67d696@default(draft) add bsecondsplit1
+  |
+  o  0:135f39f4bd78@default(draft) add _a
+  
+
+  $ cd ..
--- a/tests/test-unstable.t	Tue Jan 22 12:54:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-  $ cat >> $HGRCPATH <<EOF
-  > [defaults]
-  > amend=-d "0 0"
-  > fold=-d "0 0"
-  > [web]
-  > push_ssl = false
-  > allow_push = *
-  > [phases]
-  > publish = False
-  > [diff]
-  > git = 1
-  > unified = 0
-  > [ui]
-  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-  $ mkcommit() {
-  >    echo "$1" > "$1"
-  >    hg add "$1"
-  >    hg ci -m "add $1"
-  > }
-
-  $ mkstack() {
-  >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
-  >    hg update "$1" -C
-  >    shift
-  >    mkcommits $*
-  > }
-
-  $ mkcommits() {
-  >   for i in $@; do mkcommit $i ; done
-  > }
-
-==============================================================================
-Test instability resolution for a changeset unstable because its parent
-is obsolete with one successor
-==============================================================================
-  $ hg init test1
-  $ cd test1
-  $ mkcommits _a _b _c
-  $ hg up "desc(_b)"
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg amend -m "bprime"
-  1 new orphan changesets
-  $ hg log -G
-  @  3:36050226a9b9@default(draft) bprime
-  |
-  | *  2:102002290587@default(draft) add _c
-  | |
-  | x  1:37445b16603b@default(draft) add _b
-  |/
-  o  0:135f39f4bd78@default(draft) add _a
-  
-
-  $ hg evo --all --any --orphan
-  move:[2] add _c
-  atop:[3] bprime
-  working directory is now at fdcf3523a74d
-  $ hg log -G
-  @  4:fdcf3523a74d@default(draft) add _c
-  |
-  o  3:36050226a9b9@default(draft) bprime
-  |
-  o  0:135f39f4bd78@default(draft) add _a
-  
-
-  $ cd ..
-
-===============================================================================
-Test instability resolution for a changeset unstable because its parent
-is obsolete with multiple successors on one branches but in reverse
-order (cross-split).
-==============================================================================
-
-  $ hg init test5
-  $ cd test5
-  $ mkcommits _a _b _c
-  $ hg up "desc(_a)"
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ mkcommits bprimesplit1 bprimesplit2
-  created new head
-  $ hg prune "desc(_b)" -s "desc(bprimesplit1) + desc(bprimesplit2)" --split
-  1 changesets pruned
-  1 new orphan changesets
-  $ hg up "desc(_a)"
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ mkcommits bsecondsplit1 bsecondsplit2
-  created new head
-  $ hg prune "desc(bprimesplit1)" -s "desc(bsecondsplit2)"
-  1 changesets pruned
-  1 new orphan changesets
-  $ hg prune "desc(bprimesplit2)" -s "desc(bsecondsplit1)"
-  1 changesets pruned
-  $ hg log -G
-  @  6:59b942dbda14@default(draft) add bsecondsplit2
-  |
-  o  5:8ffdae67d696@default(draft) add bsecondsplit1
-  |
-  | *  2:102002290587@default(draft) add _c
-  | |
-  | x  1:37445b16603b@default(draft) add _b
-  |/
-  o  0:135f39f4bd78@default(draft) add _a
-  
-
-  $ hg evo --all --any --orphan
-  move:[2] add _c
-  atop:[6] add bsecondsplit2
-  working directory is now at 98e3f21461ff
-  $ hg log -G
-  @  7:98e3f21461ff@default(draft) add _c
-  |
-  o  6:59b942dbda14@default(draft) add bsecondsplit2
-  |
-  o  5:8ffdae67d696@default(draft) add bsecondsplit1
-  |
-  o  0:135f39f4bd78@default(draft) add _a
-  
-
-  $ cd ..