changeset 4464:05f8908df4ce

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 02 Apr 2019 20:32:15 +0200
parents e8515ee7a7cc (diff) 7d54a538dd1e (current diff)
children 6feeaf00db44
files hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/topic/topicmap.py
diffstat 34 files changed, 2688 insertions(+), 554 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Wed Feb 13 21:39:10 2019 +0800
+++ b/CHANGELOG	Tue Apr 02 20:32:15 2019 +0200
@@ -1,6 +1,15 @@
 Changelog
 =========
 
+8.5.0 - in progress
+-------------------
+
+  * evolve: improved support for content-divergence with public changesets,
+  * stack: support ranges in revsets indexing,
+  * pick: add the standard `--tool` option,
+  * stack: improved and speed --children flag up,
+  * stack: mention all divergences too.
+
 8.4.1 - in progress
 -------------------
 
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Tue Apr 02 20:32:15 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
@@ -176,11 +175,11 @@
         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:
@@ -523,7 +522,6 @@
 
         # 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)
@@ -548,8 +546,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 +556,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"))
@@ -776,14 +774,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()
@@ -1044,9 +1037,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 +1099,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 +1111,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:
@@ -1404,7 +1394,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."""
@@ -1419,7 +1409,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['.']
 
@@ -1480,7 +1471,8 @@
         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	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/compat.py	Tue Apr 02 20:32:15 2019 +0200
@@ -16,7 +16,6 @@
     obsolete,
     obsutil,
     repair,
-    revset,
     scmutil,
     util,
     ui as uimod,
@@ -54,43 +53,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 +70,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,15 +78,6 @@
 
     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
@@ -487,7 +425,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/evolvecmd.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 02 20:32:15 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):
@@ -281,7 +274,6 @@
         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()
@@ -320,9 +312,11 @@
         newid = repo.commitctx(new)
         replacementnode = newid
     if newid is None:
+        repo.ui.status(_('no changes to commit\n'))
         obsolete.createmarkers(repo, [(tmpctx, ())], 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],))],
                                flag=obsolete.bumpedfix, operation='evolve')
@@ -330,7 +324,6 @@
     # 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 +342,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 +376,20 @@
     evolvestate['other-divergent'] = other.node()
     evolvestate['base'] = base.node()
 
+    # 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 = other, divergent
+            evolvestate['divergent'] = divergent.node()
+            evolvestate['other-divergent'] = other.node()
+        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 +419,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 +447,48 @@
     # 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 = other, divergent
+                    evolvestate['divergent'] = divergent.node()
+                    evolvestate['other-divergent'] = other.node()
+                    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 = other, divergent
+            evolvestate['divergent'] = divergent.node()
+            evolvestate['other-divergent'] = other.node()
+            resolutionparent = divergent.p1().node()
     else:
         msg = _("skipping %s: have a different parent than %s "
                 "(not handled yet)\n") % (divergent, other)
@@ -499,8 +550,25 @@
 
     _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,
+                                      tmpctx=bumped)
 
 def _mergecontentdivergents(repo, progresscb, divergent, other, base,
                             evolvestate):
@@ -542,6 +610,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)
@@ -571,10 +664,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,6 +687,50 @@
     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 dirty working directory using
@@ -1298,10 +1442,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):
@@ -1456,7 +1602,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']
@@ -1554,7 +1700,7 @@
         # 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': []}
         evolvestate.addopts(stateopts)
@@ -1601,8 +1747,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})
@@ -1625,7 +1772,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)
@@ -1820,8 +1967,26 @@
                                         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, tmpctx=bumped)
         tr.close()
+        return ret
     finally:
         tr.release()
 
--- a/hgext3rd/evolve/metadata.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/metadata.py	Tue Apr 02 20:32:15 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.1.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/obsdiscovery.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue Apr 02 20:32:15 2019 +0200
@@ -88,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)
@@ -104,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),
--- a/hgext3rd/evolve/obshistory.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/obshistory.py	Tue Apr 02 20:32:15 2019 +0200
@@ -780,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 = []
@@ -838,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/utility.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/evolve/utility.py	Tue Apr 02 20:32:15 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/topic/__init__.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/topic/__init__.py	Tue Apr 02 20:32:15 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,7 +179,7 @@
               'topic.active': 'green',
              }
 
-__version__ = '0.13.1.dev'
+__version__ = '0.14.0.dev'
 
 testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8 4.9'
 minimumhgversion = '4.4'
--- a/hgext3rd/topic/revset.py	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/topic/revset.py	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/hgext3rd/topic/stack.py	Tue Apr 02 20:32:15 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"""
@@ -228,7 +219,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 +284,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 +321,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 +352,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/tests/test-evolve-abort-phasediv.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-abort-phasediv.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-content-divergence.t	Tue Apr 02 20:32:15 2019 +0200
@@ -595,7 +595,7 @@
   @@ -0,0 +1,1 @@
   +bar
 
-Testing when the relocation will result in conflicts and merging wont
+Testing when the relocation will result in conflicts and merging also:
 ----------------------------------------------------------------------
 
   $ hg glog
@@ -660,7 +660,7 @@
   o  0:8fa14d15e168 added hgignore
       () [default] draft
 
-  $ hg evolve --content-divergent
+  $ hg evolve --content-divergent --any
   merge:[25] added z
   with: [23] added z
   base: [22] added z
@@ -928,6 +928,189 @@
   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
 
 Test to make sure that evolve don't fall into unrecoverable state (issue6053)
 ------------------------------------------------------------------------------
--- a/tests/test-evolve-continue.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-continue.t	Tue Apr 02 20:32:15 2019 +0200
@@ -127,6 +127,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
--- a/tests/test-evolve-issue5832.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-issue5832.t	Tue Apr 02 20:32:15 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-obshistory-lots-of-splits.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-obshistory-split.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-order.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-orphan-split.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-phase-divergence.t	Tue Apr 02 20:32:15 2019 +0200
@@ -28,7 +28,9 @@
 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]
@@ -45,6 +47,10 @@
 
   $ 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
 
 Creating a phase-divergence changeset
 -------------------------------------
@@ -52,8 +58,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 +90,7 @@
   $ hg glog
   o  1:4d1169d82e47 modify a
   |   () draft
-  o  0:d3873e73d99e init
+  @  0:d3873e73d99e init
       () public
 
   $ hg push ../public
@@ -100,7 +104,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 +197,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
@@ -308,7 +311,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
 
@@ -459,7 +461,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
 
@@ -596,8 +597,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
@@ -715,7 +715,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
 
@@ -819,7 +818,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 +914,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 +928,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 branches
+----------------------------------------------------------
+
+  $ cd ../split-across-branches
 
   $ echo p > p
   $ echo q > q
@@ -1059,177 +1070,320 @@
 
   $ 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
 
+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 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
+  | 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
 ------------------------------------------------------------------
 
-  $ hg glog -r 154b0179fb9b::
-  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
-  |   () 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
-  ~
+  $ 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-public-content-divergent.t	Tue Apr 02 20:32:15 2019 +0200
@@ -0,0 +1,1711 @@
+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 troubled 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 ..
+
+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 cfoo > c
+  $ echo e > e
+  $ hg add c e
+  $ hg ci -m "added c e"
+  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:e568fd1029bb 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: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 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'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  committed as 06e4564a3897
+  working directory is now at 06e4564a3897
+
+  $ 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 ..
+
+
+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-templates.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-templates.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve-topic.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-evolve.t	Tue Apr 02 20:32:15 2019 +0200
@@ -409,7 +409,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
@@ -1061,7 +1060,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
--- a/tests/test-grab.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-grab.t	Tue Apr 02 20:32:15 2019 +0200
@@ -24,9 +24,10 @@
   
   options:
   
-   -r --rev REV  revision to pick
-   -c --continue continue interrupted pick
-   -a --abort    abort interrupted pick
+   -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)
 
--- a/tests/test-prev-next.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-prev-next.t	Tue Apr 02 20:32:15 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
 
--- a/tests/test-split.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-split.t	Tue Apr 02 20:32:15 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
--- a/tests/test-stabilize-result.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-stabilize-result.t	Tue Apr 02 20:32:15 2019 +0200
@@ -171,7 +171,6 @@
   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
--- a/tests/test-stack-branch.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-stack-branch.t	Tue Apr 02 20:32:15 2019 +0200
@@ -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)
@@ -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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-topic-stack-complex.t	Tue Apr 02 20:32:15 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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-topic-stack-data.t	Tue Apr 02 20:32:15 2019 +0200
@@ -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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-topic-stack.t	Tue Apr 02 20:32:15 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)]
@@ -488,8 +488,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)
@@ -767,24 +767,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
 
@@ -841,24 +841,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
 --------------------------------
@@ -897,7 +897,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)
@@ -977,7 +977,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	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-topic-tutorial.t	Tue Apr 02 20:32:15 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-topic.t	Wed Feb 13 21:39:10 2019 +0800
+++ b/tests/test-topic.t	Tue Apr 02 20:32:15 2019 +0200
@@ -860,6 +860,10 @@
   3: featureA
   $ tlog 'featureA#topic[0]'
   3: featureA
+  $ tlog 'featureA#topic[:]'
+  1: featureA
+  2: featureA
+  3: featureA
 
   $ tlog '2#t[-2]'
   $ tlog '2#t[-1]'
@@ -869,6 +873,10 @@
   $ tlog '2#t[1]'
   3: featureA
   $ tlog '2#t[2]'
+  $ tlog '2#t[-1:1]'
+  1: featureA
+  2: featureA
+  3: featureA
 
 stack subscript relation
 
@@ -898,6 +906,28 @@
 
   $ tlog 'featureA#s[0]'
   0: 
+  $ tlog 'featureA#s[0:0]'
+  0: 
+  $ tlog 'featureA#s[:]'
+  1: featureA
+  2: featureA
+  3: featureA
+  $ tlog 'featureA#s[2:]'
+  2: featureA
+  3: featureA
+  $ tlog 'featureA#s[:2]'
+  1: featureA
+  2: featureA
+  $ tlog 'featureA#s[0:1]'
+  0: 
+  1: featureA
+  $ tlog 'featureA#s[-1:0]'
+  0: 
+  3: featureA
+  $ tlog 'featureA#s[-3:3]'
+  1: featureA
+  2: featureA
+  3: featureA
   $ tlog 'featureA#s[1] and featureA#s[-3]'
   1: featureA
   $ tlog 'featureA#s[2] and featureA#s[-2]'