test-compat: merge mercurial-4.6 into mercurial-4.5 mercurial-4.5
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Aug 2018 01:58:44 +0200
branchmercurial-4.5
changeset 3924 f3713d41b85b
parent 3923 257481642686 (diff)
parent 3816 4c68dd62943c (current diff)
child 3929 e709e3817d7e
test-compat: merge mercurial-4.6 into mercurial-4.5
tests/test-discovery-obshashrange.t
tests/test-evolve-obshistory-amend-then-fold.t
tests/test-evolve-obshistory-amend.t
tests/test-evolve-obshistory-content-divergent.t
tests/test-evolve-obshistory-fold.t
tests/test-evolve-obshistory-lots-of-splits.t
tests/test-evolve-obshistory-phase-divergent.t
tests/test-evolve-obshistory-prune.t
tests/test-evolve-obshistory-split.t
tests/test-topic-flow-publish-flag.t
tests/test-topic-mode.t
tests/test-topic-stack.t
tests/test-topic-tutorial.t
tests/test-topic.t
--- a/.hgtags	Fri Jun 08 22:52:51 2018 +0530
+++ b/.hgtags	Thu Aug 02 01:58:44 2018 +0200
@@ -66,3 +66,4 @@
 6c772398eb4e209914e1074cdac4f3ebf714e437 7.2.1
 e4ac2e2c2086f977afa35e23a62f849e9305a225 7.3.0
 116cdd8c102ab0ae6295fb4886b0882e75e4d8f7 8.0.0
+0887c30255a1a1808d74a63b16e896d457f8ef32 8.0.1
--- a/CHANGELOG	Fri Jun 08 22:52:51 2018 +0530
+++ b/CHANGELOG	Thu Aug 02 01:58:44 2018 +0200
@@ -1,13 +1,37 @@
 Changelog
 =========
 
-8.0.1 -- in-progress
----------------------
+8.1.0 - in progress
+-------------------
 
+  * compatibility with mercurial 4.7rc0
+  * evolve: handle branch changes when solving content divergence,
+  * evolve: improve multiple aspect of divergence resolution
+            * branch changes handling,
+            * parent changes handling,
+            * divergent stack handling,
+  * evolve: merge commit messages when resolving content divergence (issue5877)
+  * evolve: show unfinished state information in `hg status -v` (issue5886)
+  * evolve: move bookmarks also when updating to successors (issue5923)
+  * amend: abort `--patch` by saving an empty file (issue5925)
+  * evolve: add a new `--no-update` flag to keep working copy on the initial
+            revision.
+  * evolve: new help section dedicated to resuming operation interrupted by
+            merge conflit, `hg help evolve.interrupted`.
+
+8.0.1 -- 2018-06-11
+-------------------
+
+  * compatibility with mercurial 4.6.1
   * next-prev: respect commands.update.check config option (issue5808)
   * next-prev: fix `evolve --abort` on conflicts (issue5897)
   * obslog: fix breakage when commit has no description
   * amend: use context manager for locks (issue5887)
+  * evolve: fix detection of interactive shell
+
+topic (0.9.1)
+
+  * topic: fix documentation formatting
 
 8.0.0 -- 2018-04-25
 -------------------
--- a/debian/changelog	Fri Jun 08 22:52:51 2018 +0530
+++ b/debian/changelog	Thu Aug 02 01:58:44 2018 +0200
@@ -1,8 +1,8 @@
-mercurial-evolve (8.0.0-1) UNRELEASED; urgency=medium
+mercurial-evolve (8.0.1-1) unstable; urgency=medium
 
   * New upstream release
 
- -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Wed, 25 Apr 2018 14:01:18 +0100
+ -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Wed, 11 June 2018 19:00:18 +0100
 
 mercurial-evolve (7.3.0-1) unstable; urgency=medium
 
--- a/hgext3rd/evolve/__init__.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Thu Aug 02 01:58:44 2018 +0200
@@ -309,6 +309,7 @@
     obscache,
     obsexchange,
     obshistory,
+    rewind,
     rewriteutil,
     safeguard,
     templatekw,
@@ -362,6 +363,7 @@
 eh.merge(templatekw.eh)
 eh.merge(compat.eh)
 eh.merge(cmdrewrite.eh)
+eh.merge(rewind.eh)
 uisetup = eh.final_uisetup
 extsetup = eh.final_extsetup
 reposetup = eh.final_reposetup
@@ -531,7 +533,7 @@
 
 # XXX SOME MAJOR CLEAN UP TO DO HERE XXX
 
-def _precursors(repo, s):
+def _precursors(repo, s, includeidentical=False):
     """Precursor of a changeset"""
     cs = set()
     nm = repo.changelog.nodemap
@@ -539,6 +541,8 @@
     node = repo.changelog.node
     for r in s:
         for p in markerbysubj.get(node(r), ()):
+            if not includeidentical and p[2] & rewind.identicalflag:
+                continue
             pr = nm.get(p[0])
             if pr is not None:
                 cs.add(pr)
@@ -1387,6 +1391,13 @@
 
 evolvestateversion = 0
 
+def _evolvemessage():
+    _msg = _('To continue:    hg evolve --continue\n'
+             'To abort:       hg evolve --abort\n'
+             'To stop:        hg evolve --stop\n'
+             '(also see `hg help evolve.interrupted`)')
+    return cmdutil._commentlines(_msg)
+
 @eh.uisetup
 def setupevolveunfinished(ui):
     data = ('evolvestate', False, False, _('evolve in progress'),
@@ -1398,6 +1409,10 @@
     cmdutil.afterresolvedstates.append(afterresolved)
     cmdutil.afterresolvedstates.append(grabresolved)
 
+    statedata = ('evolve', cmdutil.fileexistspredicate('evolvestate'),
+                 _evolvemessage)
+    cmdutil.STATES = (statedata, ) + cmdutil.STATES
+
 @eh.wrapfunction(hg, 'clean')
 def clean(orig, repo, *args, **kwargs):
     ret = orig(repo, *args, **kwargs)
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Aug 02 01:58:44 2018 +0200
@@ -207,6 +207,8 @@
                     afp.write(chunk)
 
         user_patch = afp.getvalue()
+        if not user_patch:
+            raise error.Abort(_("empty patch file, amend aborted"))
         if user_patch == previous_patch:
             raise error.Abort(_("patch unchanged"))
         afp.seek(0)
--- a/hgext3rd/evolve/compat.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/compat.py	Thu Aug 02 01:58:44 2018 +0200
@@ -10,6 +10,7 @@
 
 from mercurial import (
     context,
+    copies,
     mdiff,
     obsolete,
     obsutil,
@@ -27,11 +28,13 @@
     changesetdisplayer = logcmdutil.changesetdisplayer
     changesetprinter = logcmdutil.changesetprinter
     displaygraph = logcmdutil.displaygraph
+    changesetdiffer = logcmdutil.changesetdiffer
 except (AttributeError, ImportError):
     from mercurial import cmdutil
     changesetdisplayer = cmdutil.show_changeset
     changesetprinter = cmdutil.changeset_printer
     displaygraph = cmdutil.displaygraph
+    changesetdiffer = None
 
 from . import (
     exthelper,
@@ -209,3 +212,246 @@
     if updateresult is None:
         return bool(upres[-1])
     return bool(upres.unresolvedcount)
+
+# code imported from Mercurial core at ae17555ef93f + patch
+def fixedcopytracing(repo, c1, c2, base):
+    """A complete copy-patse of copies._fullcopytrace with a one line fix to
+    handle when the base is not parent of both c1 and c2. This should be
+    converted in a compat function once https://phab.mercurial-scm.org/D3896
+    gets in and once we drop support for 4.7, this should be removed."""
+
+    from mercurial import pathutil
+
+    # In certain scenarios (e.g. graft, update or rebase), base can be
+    # overridden We still need to know a real common ancestor in this case We
+    # can't just compute _c1.ancestor(_c2) and compare it to ca, because there
+    # can be multiple common ancestors, e.g. in case of bidmerge.  Because our
+    # caller may not know if the revision passed in lieu of the CA is a genuine
+    # common ancestor or not without explicitly checking it, it's better to
+    # determine that here.
+    #
+    # base.isancestorof(wc) is False, work around that
+    _c1 = c1.p1() if c1.rev() is None else c1
+    _c2 = c2.p1() if c2.rev() is None else c2
+    # an endpoint is "dirty" if it isn't a descendant of the merge base
+    # if we have a dirty endpoint, we need to trigger graft logic, and also
+    # keep track of which endpoint is dirty
+    if util.safehasattr(base, 'isancestorof'):
+        dirtyc1 = not base.isancestorof(_c1)
+        dirtyc2 = not base.isancestorof(_c2)
+    else: # hg <= 4.6
+        dirtyc1 = not base.descendant(_c1)
+        dirtyc2 = not base.descendant(_c2)
+    graft = dirtyc1 or dirtyc2
+    tca = base
+    if graft:
+        tca = _c1.ancestor(_c2)
+
+    limit = copies._findlimit(repo, c1.rev(), c2.rev())
+    if limit is None:
+        # no common ancestor, no copies
+        return {}, {}, {}, {}, {}
+    repo.ui.debug("  searching for copies back to rev %d\n" % limit)
+
+    m1 = c1.manifest()
+    m2 = c2.manifest()
+    mb = base.manifest()
+
+    # gather data from _checkcopies:
+    # - diverge = record all diverges in this dict
+    # - copy = record all non-divergent copies in this dict
+    # - fullcopy = record all copies in this dict
+    # - incomplete = record non-divergent partial copies here
+    # - incompletediverge = record divergent partial copies here
+    diverge = {} # divergence data is shared
+    incompletediverge = {}
+    data1 = {'copy': {},
+             'fullcopy': {},
+             'incomplete': {},
+             'diverge': diverge,
+             'incompletediverge': incompletediverge,
+            }
+    data2 = {'copy': {},
+             'fullcopy': {},
+             'incomplete': {},
+             'diverge': diverge,
+             'incompletediverge': incompletediverge,
+            }
+
+    # find interesting file sets from manifests
+    addedinm1 = m1.filesnotin(mb)
+    addedinm2 = m2.filesnotin(mb)
+    bothnew = sorted(addedinm1 & addedinm2)
+    if tca == base:
+        # unmatched file from base
+        u1r, u2r = copies._computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
+        u1u, u2u = u1r, u2r
+    else:
+        # unmatched file from base (DAG rotation in the graft case)
+        u1r, u2r = copies._computenonoverlap(repo, c1, c2, addedinm1, addedinm2,
+                                             baselabel='base')
+        # unmatched file from topological common ancestors (no DAG rotation)
+        # need to recompute this for directory move handling when grafting
+        mta = tca.manifest()
+        u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1.filesnotin(mta),
+                                             m2.filesnotin(mta),
+                                             baselabel='topological common ancestor')
+
+    for f in u1u:
+        copies._checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)
+
+    for f in u2u:
+        copies._checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
+
+    copy = dict(data1['copy'])
+    copy.update(data2['copy'])
+    fullcopy = dict(data1['fullcopy'])
+    fullcopy.update(data2['fullcopy'])
+
+    if dirtyc1:
+        copies._combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
+                              incompletediverge)
+    else:
+        copies._combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
+                              incompletediverge)
+
+    renamedelete = {}
+    renamedeleteset = set()
+    divergeset = set()
+    for of, fl in list(diverge.items()):
+        if len(fl) == 1 or of in c1 or of in c2:
+            del diverge[of] # not actually divergent, or not a rename
+            if of not in c1 and of not in c2:
+                # renamed on one side, deleted on the other side, but filter
+                # out files that have been renamed and then deleted
+                renamedelete[of] = [f for f in fl if f in c1 or f in c2]
+                renamedeleteset.update(fl) # reverse map for below
+        else:
+            divergeset.update(fl) # reverse map for below
+
+    if bothnew:
+        repo.ui.debug("  unmatched files new in both:\n   %s\n"
+                      % "\n   ".join(bothnew))
+    bothdiverge = {}
+    bothincompletediverge = {}
+    remainder = {}
+    both1 = {'copy': {},
+             'fullcopy': {},
+             'incomplete': {},
+             'diverge': bothdiverge,
+             'incompletediverge': bothincompletediverge
+            }
+    both2 = {'copy': {},
+             'fullcopy': {},
+             'incomplete': {},
+             'diverge': bothdiverge,
+             'incompletediverge': bothincompletediverge
+            }
+    for f in bothnew:
+        copies._checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
+        copies._checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
+
+    if dirtyc1 and dirtyc2:
+        pass
+    elif dirtyc1:
+        # incomplete copies may only be found on the "dirty" side for bothnew
+        assert not both2['incomplete']
+        remainder = copies._combinecopies({}, both1['incomplete'], copy, bothdiverge,
+                                          bothincompletediverge)
+    elif dirtyc2:
+        assert not both1['incomplete']
+        remainder = copies._combinecopies({}, both2['incomplete'], copy, bothdiverge,
+                                          bothincompletediverge)
+    else:
+        # incomplete copies and divergences can't happen outside grafts
+        assert not both1['incomplete']
+        assert not both2['incomplete']
+        assert not bothincompletediverge
+    for f in remainder:
+        assert f not in bothdiverge
+        ic = remainder[f]
+        if ic[0] in (m1 if dirtyc1 else m2):
+            # backed-out rename on one side, but watch out for deleted files
+            bothdiverge[f] = ic
+    for of, fl in bothdiverge.items():
+        if len(fl) == 2 and fl[0] == fl[1]:
+            copy[fl[0]] = of # not actually divergent, just matching renames
+
+    if fullcopy and repo.ui.debugflag:
+        repo.ui.debug("  all copies found (* = to merge, ! = divergent, "
+                      "% = renamed and deleted):\n")
+        for f in sorted(fullcopy):
+            note = ""
+            if f in copy:
+                note += "*"
+            if f in divergeset:
+                note += "!"
+            if f in renamedeleteset:
+                note += "%"
+            repo.ui.debug("   src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
+                                                              note))
+    del divergeset
+
+    if not fullcopy:
+        return copy, {}, diverge, renamedelete, {}
+
+    repo.ui.debug("  checking for directory renames\n")
+
+    # generate a directory move map
+    d1, d2 = c1.dirs(), c2.dirs()
+    # Hack for adding '', which is not otherwise added, to d1 and d2
+    d1.addpath('/')
+    d2.addpath('/')
+    invalid = set()
+    dirmove = {}
+
+    # examine each file copy for a potential directory move, which is
+    # when all the files in a directory are moved to a new directory
+    for dst, src in fullcopy.iteritems():
+        dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst)
+        if dsrc in invalid:
+            # already seen to be uninteresting
+            continue
+        elif dsrc in d1 and ddst in d1:
+            # directory wasn't entirely moved locally
+            invalid.add(dsrc + "/")
+        elif dsrc in d2 and ddst in d2:
+            # directory wasn't entirely moved remotely
+            invalid.add(dsrc + "/")
+        elif dsrc + "/" in dirmove and dirmove[dsrc + "/"] != ddst + "/":
+            # files from the same directory moved to two different places
+            invalid.add(dsrc + "/")
+        else:
+            # looks good so far
+            dirmove[dsrc + "/"] = ddst + "/"
+
+    for i in invalid:
+        if i in dirmove:
+            del dirmove[i]
+    del d1, d2, invalid
+
+    if not dirmove:
+        return copy, {}, diverge, renamedelete, {}
+
+    for d in dirmove:
+        repo.ui.debug("   discovered dir src: '%s' -> dst: '%s'\n" %
+                      (d, dirmove[d]))
+
+    movewithdir = {}
+    # check unaccounted nonoverlapping files against directory moves
+    for f in u1r + u2r:
+        if f not in fullcopy:
+            for d in dirmove:
+                if f.startswith(d):
+                    # new file added in a directory that was moved, move it
+                    df = dirmove[d] + f[len(d):]
+                    if df not in copy:
+                        movewithdir[f] = df
+                        repo.ui.debug(("   pending file src: '%s' -> "
+                                       "dst: '%s'\n") % (f, df))
+                    break
+
+    return copy, movewithdir, diverge, renamedelete, dirmove
+
+if util.safehasattr(copies, '_fullcopytracing'):
+    copies._fullcopytracing = fixedcopytracing
--- a/hgext3rd/evolve/evolvecmd.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Aug 02 01:58:44 2018 +0200
@@ -27,6 +27,7 @@
     phases,
     repair,
     scmutil,
+    simplemerge,
     util,
 )
 
@@ -49,6 +50,8 @@
 eh = exthelper.exthelper()
 mergetoolopts = commands.mergetoolopts
 
+abortmessage = _("see `hg help evolve.interrupted`\n")
+
 def _solveone(ui, repo, ctx, evolvestate, dryrun, confirm,
               progresscb, category):
     """Resolve the troubles affecting one revision
@@ -177,11 +180,8 @@
             ops = {'current': orig.node()}
             evolvestate.addopts(ops)
             evolvestate.save()
-            repo.ui.write_err(_('evolve failed!\n'))
-            repo.ui.write_err(
-                _("fix conflict and run 'hg evolve --continue'"
-                  " or use 'hg evolve --abort' to abort\n"))
-            raise
+            raise error.InterventionRequired(_("fix conflicts and see `hg help "
+                                               "evolve.interrupted`"))
 
 def _solvephasedivergence(ui, repo, bumped, evolvestate, dryrun=False,
                           confirm=False, progresscb=None):
@@ -245,15 +245,13 @@
                 tmpctx = repo[tmpid]
                 obsolete.createmarkers(repo, [(bumped, (tmpctx,))],
                                        operation='evolve')
+                evolvestate['temprevs'].append(tmpid)
         except MergeFailure:
             evolvestate['current'] = bumped.hex()
             evolvestate['precursor'] = prec.hex()
             evolvestate.save()
-            repo.ui.write_err(_('evolution failed!\n'))
-            msg = _("fix conflict then run 'hg evolve --continue' or "
-                    "use `hg evolve --abort`\n")
-            repo.ui.write_err(msg)
-            raise
+            raise error.InterventionRequired(_("fix conflicts and see `hg help "
+                                               "evolve.interrupted`"))
 
     return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx)
 
@@ -263,6 +261,7 @@
     assert tr is not None
     bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
     newid = None
+    replacementnode = None
 
     # function to update the bookmark from the rebased changeset to new resolved
     # changeset
@@ -309,6 +308,7 @@
                              extra=bumped.extra())
 
         newid = repo.commitctx(new)
+        replacementnode = newid
     if newid is None:
         obsolete.createmarkers(repo, [(tmpctx, ())], operation='evolve')
         newid = prec.node()
@@ -324,7 +324,7 @@
     # reroute the working copy parent to the new changeset
     with repo.dirstate.parentchange():
         repo.dirstate.setparents(newid, node.nullid)
-    return (True, newid)
+    return (True, replacementnode)
 
 def _solvedivergent(ui, repo, divergent, evolvestate, dryrun=False,
                     confirm=False, progresscb=None):
@@ -338,7 +338,21 @@
     """
     repo = repo.unfiltered()
     divergent = repo[divergent.rev()]
+    evolvestate['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
+    # strip that relocated commit. However if `--all` is passed, we need to
+    # reset this value for each content-divergence resolution which we are doing
+    # below.
+    evolvestate['relocated'] = None
+    evolvestate['relocating'] = False
+    # in case or relocation we get a new other node, we need to store the old
+    # other for purposes like `--abort` or `--stop`
+    evolvestate['old-other'] = None
     base, others = divergentdata(divergent)
+
+    # we don't handle split in content-divergence yet
     if len(others) > 1:
         othersstr = "[%s]" % (','.join([str(i) for i in others]))
         msg = _("skipping %d:%s with a changeset that got split"
@@ -355,6 +369,10 @@
         ui.write_err(msg)
         return (False, '')
     other = others[0]
+    evolvestate['other-divergent'] = other.node()
+    evolvestate['base'] = base.node()
+
+    # we don't handle merge content-divergent changesets yet
     if len(other.parents()) > 1:
         msg = _("skipping %s: %s changeset can't be "
                 "a merge (yet)\n") % (divergent, TROUBLES['CONTENTDIVERGENT'])
@@ -364,7 +382,53 @@
                  "| `hg prune` to kill older version.\n")
         ui.write_err(hint)
         return (False, '')
-    if other.p1() not in divergent.parents():
+
+    otherp1 = other.p1().rev()
+    divp1 = divergent.p1().rev()
+
+    # finding single successors of otherp1 and divp1
+    try:
+        otherp1 = utility._singlesuccessor(repo, other.p1())
+    except utility.MultipleSuccessorsError:
+        pass
+
+    try:
+        divp1 = utility._singlesuccessor(repo, divergent.p1())
+    except utility.MultipleSuccessorsError:
+        pass
+
+    # the changeset on which resolution changeset will be based on
+    resolutionparent = repo[divp1].node()
+
+    gca = repo.revs("ancestor(%d, %d)" % (otherp1, divp1))
+
+    # is relocation of one of the changeset required
+    relocatereq = False
+
+    # testing how both the divergent changesets are arranged, there can be 4
+    # possible cases here:
+    #
+    # 1) both have the same parents
+    # 2) both have different parents but greatest common anscestor of them is
+    #    parent of one of them
+    # 3) both have different parents and gca is not parent of any of them
+    # 4) one of them is parent of other
+    #
+    # we are handling 1) very good now.
+    # for 2) we will relocate one which is behind to the parent of ahead one and
+    # 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
+    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()
+    else:
         msg = _("skipping %s: have a different parent than %s "
                 "(not handled yet)\n") % (divergent, other)
         hint = _("| %(d)s, %(o)s are not based on the same changeset.\n"
@@ -399,10 +463,45 @@
         ui.write(('hg commit -m "`hg log -r %s --template={desc}`";\n'
                  % divergent))
         return (False, '')
+
+    evolvestate['resolutionparent'] = resolutionparent
+    # relocate the other divergent if required
+    if relocatereq:
+        # relocating will help us understand during the time of conflicts that
+        # whether conflicts occur at reloacting or they occured at merging
+        # content divergent changesets
+        evolvestate['relocating'] = True
+        ui.status(_('rebasing "other" content-divergent changeset %s on'
+                    ' %s\n' % (other, divergent.p1())))
+        try:
+            newother = relocate(repo, other, divergent.p1(), evolvestate,
+                                keepbranch=True)
+        except MergeFailure:
+            evolvestate['current'] = other.node()
+            evolvestate.save()
+            raise error.InterventionRequired(_("fix conflicts and see `hg help "
+                                               "evolve.interrupted`"))
+        evolvestate['old-other'] = other.node()
+        other = repo[newother]
+        evolvestate['relocating'] = False
+        evolvestate['relocated'] = other.node()
+        evolvestate['temprevs'].append(other.node())
+        evolvestate['other-divergent'] = other.node()
+
+    _mergecontentdivergents(repo, progresscb, divergent, other, base,
+                            evolvestate)
+    return _completecontentdivergent(ui, repo, progresscb, divergent, other,
+                                     base, evolvestate)
+
+def _mergecontentdivergents(repo, progresscb, divergent, other, base,
+                            evolvestate):
     if divergent not in repo[None].parents():
-        repo.ui.status(_('updating to "local" conflict\n'))
-        hg.update(repo, divergent.rev())
-    repo.ui.note(_('merging %s changeset\n') % TROUBLES['CONTENTDIVERGENT'])
+        repo.ui.status(_("updating to \"local\" side of the conflict: %s\n") %
+                       divergent.hex()[:12])
+        hg.updaterepo(repo, divergent.node(), False)
+    # merging the two content-divergent changesets
+    repo.ui.status(_("merging \"other\" %s changeset '%s'\n") %
+                   (TROUBLES['CONTENTDIVERGENT'], other.hex()[:12]))
     if progresscb:
         progresscb()
     stats = merge.update(repo,
@@ -412,40 +511,211 @@
                          ancestor=base.node(),
                          mergeancestor=True)
     hg._showstats(repo, stats)
+
+    # conflicts while merging content-divergent changesets
     if compat.hasconflict(stats):
-        repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
-                         "or 'hg update -C .' to abort\n"))
-        raise error.Abort('merge conflict between several amendments '
-                          '(this is not automated yet)',
-                          hint="""/!\ You can try:
-/!\ * manual merge + resolve => new cset X
-/!\ * hg up to the parent of the amended changeset (which are named W and Z)
-/!\ * hg revert --all -r X
-/!\ * hg ci -m "same message as the amended changeset" => new cset Y
-/!\ * hg prune -n Y W Z
-""")
+        tr = repo.currenttransaction()
+        tr.close()
+        evolvestate.save()
+        raise error.InterventionRequired(_("fix conflicts and see `hg help "
+                                           "evolve.interrupted`"))
+
+def _completecontentdivergent(ui, repo, progresscb, divergent, other,
+                              base, evolvestate):
+    """completes the content-divergence resolution"""
+    # no conflicts were there in merging content divergent changesets, let's
+    # resume resolution
     if progresscb:
         progresscb()
     emtpycommitallowed = repo.ui.backupconfig('ui', 'allowemptycommit')
     tr = repo.currenttransaction()
     assert tr is not None
+    # whether to store the obsmarker in the evolvestate
+    storemarker = False
+    resparent = evolvestate['resolutionparent']
     try:
-        repo.ui.setconfig('ui', 'allowemptycommit', True, 'evolve')
         with repo.dirstate.parentchange():
-            repo.dirstate.setparents(divergent.node(), node.nullid)
-        oldlen = len(repo)
-        cmdrewrite.amend(ui, repo, message='', logfile='')
-        if oldlen == len(repo):
-            new = divergent
+            repo.dirstate.setparents(resparent, node.nullid)
+
+        dirstatedance(repo, divergent, resparent, None)
+
+        # merge the branches
+        mergebranches(repo, divergent, other, base)
+        # merge the commit messages
+        desc = mergecommitmessages(ui, base.description(),
+                                   divergent.description(),
+                                   other.description())
+
+        # new node if any formed as the replacement
+        newnode = None
+
+        mergehook(repo, base, divergent, other)
+
+        newnode = repo.commit(text=desc, user=repo.ui.username())
+        if newnode == divergent.node() or newnode is None:
             # no changes
+            new = divergent
+            storemarker = True
+            repo.ui.status(_("nothing changed\n"))
+            hg.updaterepo(repo, divergent.rev(), False)
         else:
-            new = repo['.']
+            new = repo[newnode]
+            newnode = new.node()
+            hg.updaterepo(repo, new.rev(), False)
+            obsolete.createmarkers(repo, [(divergent, (new,))], operation='evolve')
+
+        # creating markers and moving phases post-resolution
         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
+            # want to store more data and serialize obsmarker in a better way in
+            # future
+            evolvestate['obsmarkers'].append((other.node(), new.node()))
+
         phases.retractboundary(repo, tr, other.phase(), [new.node()])
-        return (True, new.node())
+        return (True, newnode)
     finally:
         repo.ui.restoreconfig(emtpycommitallowed)
 
+def dirstatedance(repo, oldparent, newparent, match):
+    """utility function to fix the dirstate when we change parents from
+    oldparent to newparent with a directory working directory using
+    repo.dirstate.setparents()
+
+    Lets refer oldparent as Pold
+               newparent as Pnew
+
+    Now when we are on oldparent with a dirty working directory, there are three
+    types of files which we are concerned about. They are files having modified,
+    added and removed status.
+
+    Lets refer modified files as Fm
+               added files as Fa
+               removed files as Fr
+
+    Now, between Pold and Pnew, files can be modified, files can be added, files
+    can be removed.
+
+    Lets refer modification of a file between Pold to Pnew as Cm
+               addition of a file between Pold to Pnew as Ca
+               removal of a file between Pold to Pnew as Cr
+
+    Now let's play combinations and permutations:
+
+    |---------------------------------------------------------------|
+    | Type of file |  Changes between |   End status with Pnew as   |
+    |   in wdir    |    Pold -> Pnew  |       wdir parent           |
+    |--------------|------------------|-----------------------------|
+    |              |                  |                             |
+    |   Fm         |      Cm          |       Modified or clean     |
+    |--------------|------------------|-----------------------------|
+    |   Fm         |      Cr          |           Added             |
+    |--------------|------------------|-----------------------------|
+    |   Fm         |      Ca          |       Not possible (1)      |
+    |--------------|------------------|-----------------------------|
+    |   Fa         |      Ca          |       Modified or clean     |
+    |--------------|------------------|-----------------------------|
+    |   Fa         |      Cm          |       Not possible (2)      |
+    |--------------|------------------|-----------------------------|
+    |   Fa         |      Cr          |       Not possible (2)      |
+    |--------------|------------------|-----------------------------|
+    |   Fr         |      Cr          | File should be untracked (3)|
+    |--------------|------------------|-----------------------------|
+    |   Fr         |      Ca          |       Not possible (4)      |
+    |--------------|------------------|-----------------------------|
+    |   Fr         |      Cm          |           Removed           |
+    |--------------|------------------|-----------------------------|
+
+    (1): File is modified in wdir, it means file was present in Pold, so
+         addition of that file between Pold to Pnew is not possible
+
+    (2): File was added in wdir, it means file was not present in Pold, so
+         deletion or modification of that file from Pold to Pnew is not possible
+
+    (3): File should be dropped from the dirstate, Pnew has it removed, so no
+         need to mark that removed again
+
+    (4): File was removed in wdir, it means file was present in Pold, so
+         addition of that file between Pold to Pnew is not possible
+
+    """
+
+    # falling back to an existing function, in future we should have logic in
+    # this function only
+    cmdrewrite._uncommitdirstate(repo, oldparent, match, True)
+
+def mergehook(repo, base, divergent, other):
+    """function which extensions can wrap and merge data introduced by them
+    while resolving content-divergence"""
+    pass
+
+def mergebranches(repo, divergent, other, base):
+    """merges the branch information for content-divergent changesets and sets
+    the dirstate branch accordingly
+    If unable to merge, prompts user to select a branch
+
+    If the branch name is different from the branch of divergent changeset, it
+    sets the current branch using repo.dirstate.setbranch()
+    """
+    divbranch = divergent.branch()
+    basebranch = base.branch()
+    othbranch = other.branch()
+    # content divergent changes were on different branches, ask user to
+    # select one
+    if divbranch != othbranch:
+
+        if basebranch == othbranch and basebranch != divbranch:
+            # we will be amending the divergent changeset so branch will be
+            # preserved
+            pass
+        elif basebranch == divbranch and basebranch != othbranch:
+            repo.dirstate.setbranch(othbranch)
+        else:
+            # all the three branches are different
+            index = repo.ui.promptchoice(_("content divergent changesets on "
+                                           "different branches.\nchoose branch"
+                                           " for the resolution changeset. (a) "
+                                           "%s or (b) %s or (c) %s? $$ &a $$ &b"
+                                           " $$ &c") %
+                                         (basebranch, divbranch, othbranch), 0)
+
+            if index == 0:
+                repo.dirstate.setbranch(basebranch)
+            elif index == 1:
+                pass
+            elif index == 2:
+                repo.dirstate.setbranch(othbranch)
+
+def mergecommitmessages(ui, basedesc, divdesc, othdesc):
+    """merges the commit messages and return the new merged message and whether
+    there were conflicts or not while merging the messages"""
+
+    merger = simplemerge.Merge3Text(basedesc, divdesc, othdesc)
+    mdesc = []
+    kwargs = {}
+    kwargs['name_base'] = 'base'
+    kwargs['base_marker'] = '|||||||'
+    for line in merger.merge_lines(name_a='divergent', name_b='other',
+                                   **kwargs):
+        mdesc.append(line)
+
+    desc = ''.join(mdesc)
+    if merger.conflicts:
+
+        prefixes = ("HG: Conflicts while merging changeset description of"
+                    " content-divergent changesets.\nHG: Resolve conflicts"
+                    " in commit messages to continue.\n\n")
+
+        resolveddesc = ui.edit(prefixes + desc, ui.username(), action='desc')
+        # make sure we remove the prefixes part from final commit message
+        if prefixes in resolveddesc:
+            # hack, we should find something better
+            resolveddesc = resolveddesc[len(prefixes):]
+        desc = resolveddesc
+
+    return desc
+
 class MergeFailure(error.Abort):
     pass
 
@@ -1010,9 +1280,14 @@
 
     return opts
 
-def _cleanup(ui, repo, startnode, showprogress):
+def _cleanup(ui, repo, startnode, showprogress, shouldupdate):
     if showprogress:
         ui.progress(_('evolve'), None)
+
+    if not shouldupdate:
+        unfi = repo.unfiltered()
+        succ = utility._singlesuccessor(repo, unfi[startnode])
+        hg.updaterepo(repo, repo[succ].node(), False)
     if repo['.'] != startnode:
         ui.status(_('working directory is now at %s\n') % repo['.'])
 
@@ -1063,6 +1338,7 @@
      ('', 'orphan', False, _('solves only orphan changesets (default)')),
      ('a', 'all', False, _('evolve all troubled changesets related to the '
                            'current  working directory and its descendants')),
+     ('', 'update', True, _('update to the head of evolved changesets')),
      ('c', 'continue', False, _('continue an interrupted evolution')),
      ('', 'stop', False, _('stop the interrupted evolution')),
      ('', 'abort', False, _('abort the interrupted evolution')),
@@ -1139,6 +1415,28 @@
     You can also use the evolve command to list the troubles affecting your
     repository by using the --list flag. You can choose to display only some
     categories of troubles with the --unstable, --divergent or --bumped flags.
+
+    Interrupted
+    ===========
+
+    The `hg evolve` command is an all purpose tool that solve all kind of
+    instabilities in your repository. Sometimes, instability resolution will lead
+    to merge conflict that cannot be solved without a human intervention (same as
+    `hg merge`). This can lead to an "interrupted state" where human assistance is
+    requested. There are three things which you can do when you face a similar
+    situation:
+
+      - `hg evolve --continue`:
+         fix all the conflicts using `hg resolve` and then run this to continue the
+         interrupted evolve
+
+      - `hg evolve --stop`:
+         stops the current interrupted evolve,. keeping all the successful steps,
+         but delaying to resolution of the remaining step for later.
+
+      - `hg evolve --abort`:
+         aborts the interrupted evolve and undoes all the resolution which have
+         happened
     """
 
     opts = _checkevolveopts(repo, opts)
@@ -1152,6 +1450,7 @@
     revopt = opts['rev']
     stopopt = opts['stop']
     abortopt = opts['abort']
+    shouldupdate = opts['update']
 
     troublecategories = ['phase_divergent', 'content_divergent', 'orphan']
     specifiedcategories = [t.replace('_', '')
@@ -1169,6 +1468,7 @@
     elif len(specifiedcategories) == 1:
         targetcat = specifiedcategories[0]
     elif repo['.'].obsolete():
+        oldid = repo['.'].node()
         displayer = compat.changesetdisplayer(ui, repo,
                                               {'template': shorttemplate})
         # no args and parent is obsolete, update to successors
@@ -1189,7 +1489,12 @@
         if dryrunopt:
             return 0
         res = hg.update(repo, ctx.rev())
+        newid = ctx.node()
+
         if ctx != startnode:
+            with repo.wlock(), repo.lock(), repo.transaction('evolve') as tr:
+                bmupdater = rewriteutil.bookmarksupdater(repo, oldid, tr)
+                bmupdater(newid)
             ui.status(_('working directory is now at %s\n') % ctx)
         return res
 
@@ -1221,10 +1526,7 @@
         if not evolvestate:
             raise error.Abort(_('no interrupted evolve to stop'))
         evolvestate.load()
-        pctx = repo['.']
-        hg.updaterepo(repo, pctx.node(), True)
-        ui.status(_('stopped the interrupted evolve\n'))
-        ui.status(_('working directory is now at %s\n') % pctx)
+        stopevolve(ui, repo, evolvestate)
         evolvestate.delete()
         return
     elif abortopt:
@@ -1251,15 +1553,14 @@
         # For the progress bar to show
         count = len(revs)
         # Order the revisions
-        if targetcat == 'orphan':
-            revs = _orderrevs(repo, revs)
+        revs = _orderrevs(repo, revs)
 
         # 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': [],
                      'command': 'evolve', 'orphanmerge': False,
-                     'bookmarkchanges': []}
+                     'bookmarkchanges': [], 'temprevs': [], 'obsmarkers': []}
         evolvestate.addopts(stateopts)
         for rev in revs:
             curctx = repo[rev]
@@ -1268,7 +1569,7 @@
                             progresscb, targetcat)
             seen += 1
             if ret[0]:
-                evolvestate['replacements'][curctx.node()] = [ret[1]]
+                evolvestate['replacements'][curctx.node()] = ret[1]
             else:
                 evolvestate['skippedrevs'].append(curctx.node())
 
@@ -1278,25 +1579,52 @@
                 ret = _solveone(ui, repo, repo[ret[1]], evolvestate, dryrunopt,
                                 confirmopt, progresscb, targetcat)
                 if ret[0]:
-                    evolvestate['replacements'][curctx.node()] = [ret[1]]
+                    evolvestate['replacements'][curctx.node()] = ret[1]
                 else:
                     evolvestate['skippedrevs'].append(curctx.node())
 
                 evolvestate['orphanmerge'] = False
 
     progresscb()
-    _cleanup(ui, repo, startnode, showprogress)
+    _cleanup(ui, repo, startnode, showprogress, shouldupdate)
+
+def stopevolve(ui, repo, evolvestate):
+    """logic for handling of `hg evolve --stop`"""
+    updated = False
+    pctx = None
+    if (evolvestate['command'] == 'evolve' and
+        evolvestate['category'] == 'contentdivergent' and
+        evolvestate['relocated']):
+        oldother = evolvestate['old-other']
+        if oldother:
+            with repo.wlock(), repo.lock():
+                repo = repo.unfiltered()
+                hg.updaterepo(repo, oldother, True)
+                strips = [evolvestate['relocated']]
+                repair.strip(ui, repo, strips, False)
+                updated = True
+                pctx = repo[oldother]
+    if not updated:
+        pctx = repo['.']
+        hg.updaterepo(repo, pctx.node(), True)
+    ui.status(_('stopped the interrupted evolve\n'))
+    ui.status(_('working directory is now at %s\n') % pctx)
 
 def abortevolve(ui, repo, evolvestate):
     """ logic for handling of `hg evolve --abort`"""
 
     with repo.wlock(), repo.lock():
+        repo = repo.unfiltered()
         evolvedctx = []
         # boolean value to say whether we should strip or not
         cleanup = True
         startnode = evolvestate['startnode']
         for old, new in evolvestate['replacements'].iteritems():
-            evolvedctx.append(repo[new[0]])
+            if new:
+                evolvedctx.append(repo[new])
+        for temp in evolvestate['temprevs']:
+            if temp:
+                evolvedctx.append(repo[temp])
         evolvedrevs = [c.rev() for c in evolvedctx]
 
         # checking if phase changed of any of the evolved rev
@@ -1316,6 +1644,23 @@
                            "branch\n"))
             cleanup = False
 
+        # finding the indices of the obsmarkers to be stripped and stripping
+        # them
+        if evolvestate['obsmarkers']:
+            stripmarkers = set()
+            for m in evolvestate['obsmarkers']:
+                m = (m[0], m[1])
+                stripmarkers.add(m)
+            indices = []
+            allmarkers = obsutil.getmarkers(repo)
+            for i, m in enumerate(allmarkers):
+                marker = (m.prednode(), m.succnodes()[0])
+                if marker in stripmarkers:
+                    indices.append(i)
+
+            repair.deleteobsmarkers(repo.obsstore, indices)
+            repo.ui.debug('deleted %d obsmarkers\n' % len(indices))
+
         if cleanup:
             if evolvedrevs:
                 strippoints = [c.node()
@@ -1357,6 +1702,8 @@
             _completeorphan(ui, repo, evolvestate)
         elif evolvestate['category'] == 'phasedivergent':
             _completephasedivergent(ui, repo, evolvestate)
+        elif evolvestate['category'] == 'contentdivergent':
+            _continuecontentdivergent(ui, repo, evolvestate, progresscb)
         else:
             repo.ui.status(_("continuing interrupted '%s' resolution is not yet"
                              " supported\n") % evolvestate['category'])
@@ -1380,6 +1727,41 @@
                         evolvestate['skippedrevs'].append(curctx.node())
         return
 
+def _continuecontentdivergent(ui, repo, evolvestate, progresscb):
+    """function to continue the interrupted content-divergence resolution."""
+    tr = None
+    try:
+        tr = repo.transaction('evolve')
+        divergent = evolvestate['divergent']
+        base = evolvestate['base']
+        repo = repo.unfiltered()
+        if evolvestate['relocating']:
+            newother = _completerelocation(ui, repo, evolvestate)
+            current = repo[evolvestate['current']]
+            obsolete.createmarkers(repo, [(current, (repo[newother],))],
+                                   operation='evolve')
+            evolvestate['relocating'] = False
+            evolvestate['relocated'] = newother
+            evolvestate['temprevs'].append(newother)
+            evolvestate['other-divergent'] = newother
+            # continue the resolution by merging the content-divergence
+            _mergecontentdivergents(repo, progresscb,
+                                    repo[divergent],
+                                    repo[newother],
+                                    repo[base],
+                                    evolvestate)
+
+        other = evolvestate['other-divergent']
+        ret = _completecontentdivergent(ui, repo, progresscb,
+                                        repo[divergent],
+                                        repo[other],
+                                        repo[base],
+                                        evolvestate)
+        evolvestate['replacements'][divergent] = ret[1]
+        tr.close()
+    finally:
+        tr.release()
+
 def _completephasedivergent(ui, repo, evolvestate):
     """function to complete the interrupted phase-divergence resolution.
 
@@ -1391,6 +1773,7 @@
         # need to start transaction for bookmark changes
         tr = repo.transaction('evolve')
         node = _completerelocation(ui, repo, evolvestate)
+        evolvestate['temprevs'].append(node)
         # resolving conflicts can lead to empty wdir and node can be None in
         # those cases
         ctx = repo[evolvestate['current']]
@@ -1399,8 +1782,8 @@
 
         # now continuing the phase-divergence resolution part
         prec = repo[evolvestate['precursor']]
-        _resolvephasedivergent(ui, repo, prec, ctx, newctx)
-        evolvestate['replacements'][ctx.node()] = node
+        retvalue = _resolvephasedivergent(ui, repo, prec, ctx, newctx)
+        evolvestate['replacements'][ctx.node()] = retvalue[1]
         tr.close()
     finally:
         tr.release()
--- a/hgext3rd/evolve/metadata.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/metadata.py	Thu Aug 02 01:58:44 2018 +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.0.1.dev'
-testedwith = '4.3.2 4.4.2 4.5.2 4.6'
+__version__ = '8.1.0.dev'
+testedwith = '4.3.2 4.4.2 4.5.2 4.6.1'
 minimumhgversion = '4.3'
 buglink = 'https://bz.mercurial-scm.org/'
--- a/hgext3rd/evolve/obshistory.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/obshistory.py	Thu Aug 02 01:58:44 2018 +0200
@@ -15,17 +15,12 @@
     graphmod,
     patch,
     obsolete,
+    obsutil,
     node as nodemod,
     scmutil,
     util,
 )
 
-try:
-    from mercurial import obsutil
-    obsutil.marker
-except ImportError:
-    obsutil = None
-
 from mercurial.i18n import _
 
 from . import (
@@ -52,7 +47,8 @@
     [('G', 'graph', True, _("show the revision DAG")),
      ('r', 'rev', [], _('show the specified revision or revset'), _('REV')),
      ('a', 'all', False, _('show all related changesets, not only precursors')),
-     ('p', 'patch', False, _('show the patch between two obs versions'))
+     ('p', 'patch', False, _('show the patch between two obs versions')),
+     ('f', 'filternonlocal', False, _('filter out non local commits')),
     ] + commands.formatteropts,
     _('hg olog [OPTION]... [REV]'))
 def cmdobshistory(ui, repo, *revs, **opts):
@@ -95,35 +91,112 @@
     revs.reverse()
     _debugobshistoryrevs(ui, repo, revs, opts)
 
+def _successorsandmarkers(repo, ctx):
+    """compute the raw data needed for computing obsfate
+    Returns a list of dict, one dict per successors set
+    """
+    ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
+
+    # closestsuccessors returns an empty list for pruned revisions, remap it
+    # into a list containing an empty list for future processing
+    if ssets == []:
+        ssets = [[]]
+
+    # Try to recover pruned markers
+    succsmap = repo.obsstore.successors
+    fullsuccessorsets = [] # successor set + markers
+    for sset in ssets:
+        if sset:
+            fullsuccessorsets.append(sset)
+        else:
+            # successorsset return an empty set() when ctx or one of its
+            # successors is pruned.
+            # In this case, walk the obs-markers tree again starting with ctx
+            # and find the relevant pruning obs-makers, the ones without
+            # successors.
+            # Having these markers allow us to compute some information about
+            # its fate, like who pruned this changeset and when.
+
+            # XXX we do not catch all prune markers (eg rewritten then pruned)
+            # (fix me later)
+            foundany = False
+            for mark in succsmap.get(ctx.node(), ()):
+                if not mark[1]:
+                    foundany = True
+                    sset = obsutil._succs()
+                    sset.markers.add(mark)
+                    fullsuccessorsets.append(sset)
+            if not foundany:
+                fullsuccessorsets.append(obsutil._succs())
+
+    values = []
+    for sset in fullsuccessorsets:
+        values.append({'successors': sset, 'markers': sset.markers})
+
+    return values
+
 class obsmarker_printer(compat.changesetprinter):
     """show (available) information about a node
 
     We display the node, description (if available) and various information
     about obsolescence markers affecting it"""
 
+    def __init__(self, ui, repo, *args, **kwargs):
+
+        if kwargs.pop('obspatch', False):
+            if compat.changesetdiffer is None:
+                kwargs['matchfn'] = scmutil.matchall(repo)
+            else:
+                kwargs['differ'] = scmutil.matchall(repo)
+
+        super(obsmarker_printer, self).__init__(ui, repo, *args, **kwargs)
+        diffopts = kwargs.get('diffopts', {})
+
+        # Compat 4.6
+        if not util.safehasattr(self, "_includediff"):
+            self._includediff = diffopts and diffopts.get('patch')
+
+        self.template = diffopts and diffopts.get('template')
+        self.filter = diffopts and diffopts.get('filternonlocal')
+
     def show(self, ctx, copies=None, matchfn=None, **props):
         if self.buffered:
             self.ui.pushbuffer(labeled=True)
 
             changenode = ctx.node()
 
-            _props = self.diffopts.copy()
-            _props.update(props)
+            _props = {"template": self.template}
             fm = self.ui.formatter('debugobshistory', _props)
+
             _debugobshistorydisplaynode(fm, self.repo, changenode)
 
+            markerfm = fm.nested("markers")
+
             # Succs markers
-            succs = self.repo.obsstore.successors.get(changenode, ())
-            succs = sorted(succs)
+            if self.filter is False:
+                succs = self.repo.obsstore.successors.get(changenode, ())
+                succs = sorted(succs)
+
+                for successor in succs:
+                    _debugobshistorydisplaymarker(markerfm, successor,
+                                                  ctx.node(), self.repo,
+                                                  self._includediff)
 
-            markerfm = fm.nested("markers")
-            for successor in succs:
-                _debugobshistorydisplaymarker(markerfm, successor,
-                                              ctx.node(), self.repo, self.diffopts)
+            else:
+                r = _successorsandmarkers(self.repo, ctx)
+
+                for succset in sorted(r):
+                    markers = succset["markers"]
+                    if not markers:
+                        continue
+                    successors = succset["successors"]
+                    _debugobshistorydisplaysuccsandmarkers(markerfm, successors, markers, ctx.node(), self.repo, self._includediff)
+
             markerfm.end()
 
             markerfm.plain('\n')
             fm.end()
+
             self.hunk[ctx.node()] = self.ui.popbuffer()
         else:
             ### graph output is buffered only
@@ -136,12 +209,10 @@
         '''
         pass
 
-def patchavailable(node, repo, marker):
+def patchavailable(node, repo, successors):
     if node not in repo:
         return False, "context is not local"
 
-    successors = marker[1]
-
     if len(successors) == 0:
         return False, "no successors"
     elif len(successors) > 1:
@@ -229,7 +300,7 @@
             stack.pop()
     return False
 
-def _obshistorywalker(repo, revs, walksuccessors=False):
+def _obshistorywalker(repo, revs, walksuccessors=False, filternonlocal=False):
     """ Directly inspired by graphmod.dagwalker,
     walk the obs marker tree and yield
     (id, CHANGESET, ctx, [parentinfo]) tuples
@@ -282,9 +353,18 @@
             if cand in repo:
                 changectx = repo[cand]
             else:
-                changectx = missingchangectx(repo, cand)
+                if filternonlocal is False:
+                    changectx = missingchangectx(repo, cand)
+                else:
+                    continue
 
-            childrens = [(graphmod.PARENT, x) for x in nodeprec.get(cand, ())]
+            if filternonlocal is False:
+                relations = nodeprec.get(cand, ())
+            else:
+                relations = obsutil.closestpredecessors(repo, cand)
+            # print("RELATIONS", relations, list(closestpred))
+            childrens = [(graphmod.PARENT, x) for x in relations]
+            # print("YIELD", changectx, childrens)
             yield (cand, graphmod.CHANGESET, changectx, childrens)
 
 def _obshistorywalker_links(repo, revs, walksuccessors=False):
@@ -343,13 +423,10 @@
     return sorted(seen), nodesucc, nodeprec
 
 def _debugobshistorygraph(ui, repo, revs, opts):
-    matchfn = None
-    if opts.get('patch'):
-        matchfn = scmutil.matchall(repo)
 
-    displayer = obsmarker_printer(ui, repo.unfiltered(), matchfn, opts, buffered=True)
+    displayer = obsmarker_printer(ui, repo.unfiltered(), obspatch=True, diffopts=opts, buffered=True)
     edges = graphmod.asciiedges
-    walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False))
+    walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False), opts.get('filternonlocal', False))
     compat.displaygraph(ui, repo, walker, displayer, edges)
 
 def _debugobshistoryrevs(ui, repo, revs, opts):
@@ -373,7 +450,8 @@
 
         markerfm = fm.nested("markers")
         for successor in sorted(succs):
-            _debugobshistorydisplaymarker(markerfm, successor, ctxnode, unfi, opts)
+            includediff = opts and opts.get("patch")
+            _debugobshistorydisplaymarker(markerfm, successor, ctxnode, unfi, includediff)
         markerfm.end()
 
         precs = precursors.get(ctxnode, ())
@@ -415,7 +493,7 @@
              label="evolve.node evolve.missing_change_ctx")
     fm.plain('\n')
 
-def _debugobshistorydisplaymarker(fm, marker, node, repo, opts):
+def _debugobshistorydisplaymarker(fm, marker, node, repo, includediff=False):
     succnodes = marker[1]
     date = marker[4]
     metadata = dict(marker[3])
@@ -489,8 +567,145 @@
         fm.write('note', "%s", metadata['note'], label="evolve.note")
 
     # Patch display
-    if opts.get('patch'):
-        _patchavailable = patchavailable(node, repo, marker)
+    if includediff is True:
+        _patchavailable = patchavailable(node, repo, marker[1])
+
+        if _patchavailable[0] is True:
+            succ = _patchavailable[1]
+
+            basectx = repo[node]
+            succctx = repo[succ]
+            # Description patch
+            descriptionpatch = getmarkerdescriptionpatch(repo,
+                                                         basectx.description(),
+                                                         succctx.description())
+
+            if descriptionpatch:
+                # add the diffheader
+                diffheader = "diff -r %s -r %s changeset-description\n" % \
+                             (basectx, succctx)
+                descriptionpatch = diffheader + descriptionpatch
+
+                def tolist(text):
+                    return [text]
+
+                fm.plain("\n")
+
+                for chunk, label in patch.difflabel(tolist, descriptionpatch):
+                    chunk = chunk.strip('\t')
+                    if chunk and chunk != '\n':
+                        fm.plain('    ')
+                    fm.write('desc-diff', '%s', chunk, label=label)
+
+            # Content patch
+            diffopts = patch.diffallopts(repo.ui, {})
+            matchfn = scmutil.matchall(repo)
+            firstline = True
+            for chunk, label in patch.diffui(repo, node, succ, matchfn,
+                                             changes=None, opts=diffopts,
+                                             prefix='', relroot=''):
+                if firstline:
+                    fm.plain('\n')
+                    firstline = False
+                if chunk and chunk != '\n':
+                    fm.plain('    ')
+                fm.write('patch', '%s', chunk, label=label)
+        else:
+            nopatch = "    (No patch available, %s)" % _patchavailable[1]
+            fm.plain("\n")
+            # TODO: should be in json too
+            fm.plain(nopatch)
+
+    fm.plain("\n")
+
+def _debugobshistorydisplaysuccsandmarkers(fm, succnodes, markers, node, repo, includediff=False):
+    """
+    This function is a duplication of _debugobshistorydisplaymarker modified
+    to accept multiple markers as input.
+    """
+    fm.startitem()
+    fm.plain('  ')
+
+    # Detect pruned revisions
+    verb = _successorsetverb(succnodes, markers)["verb"]
+
+    fm.write('verb', '%s', verb,
+             label="evolve.verb")
+
+    # Effect flag
+    metadata = [dict(marker[3]) for marker in markers]
+    ef1 = [data.get('ef1') for data in metadata]
+
+    effectflag = 0
+    for ef in ef1:
+        if ef:
+            effectflag |= int(ef)
+
+    if effectflag:
+        effect = []
+
+        # XXX should be a dict
+        if effectflag & DESCCHANGED:
+            effect.append('description')
+        if effectflag & METACHANGED:
+            effect.append('meta')
+        if effectflag & USERCHANGED:
+            effect.append('user')
+        if effectflag & DATECHANGED:
+            effect.append('date')
+        if effectflag & BRANCHCHANGED:
+            effect.append('branch')
+        if effectflag & PARENTCHANGED:
+            effect.append('parent')
+        if effectflag & DIFFCHANGED:
+            effect.append('content')
+
+        if effect:
+            fmteffect = fm.formatlist(effect, 'effect', sep=', ')
+            fm.write('effect', '(%s)', fmteffect)
+
+    if len(succnodes) > 0:
+        fm.plain(' as ')
+
+        shortsnodes = (nodemod.short(succnode) for succnode in sorted(succnodes))
+        nodes = fm.formatlist(shortsnodes, 'succnodes', sep=', ')
+        fm.write('succnodes', '%s', nodes,
+                 label="evolve.node")
+
+    # Operations
+    operations = obsutil.markersoperations(markers)
+    if operations:
+        fm.plain(' using ')
+        fm.write('operation', '%s', ", ".join(operations), label="evolve.operation")
+
+    fm.plain(' by ')
+
+    # Users
+    users = obsutil.markersusers(markers)
+    fm.write('user', '%s', ", ".join(users),
+             label="evolve.user")
+    fm.plain(' ')
+
+    # Dates
+    dates = obsutil.markersdates(markers)
+    if dates:
+        min_date = min(dates)
+        max_date = max(dates)
+
+        if min_date == max_date:
+            fm.write("date", "(at %s)", fm.formatdate(min_date), label="evolve.date")
+        else:
+            fm.write("date", "(between %s and %s)", fm.formatdate(min_date),
+                     fm.formatdate(max_date), label="evolve.date")
+
+    # initial support for showing note
+    # if metadata.get('note'):
+    #     fm.plain('\n    note: ')
+    #     fm.write('note', "%s", metadata['note'], label="evolve.note")
+
+    # Patch display
+    if includediff is True:
+        _patchavailable = patchavailable(node, repo, succnodes)
 
         if _patchavailable[0] is True:
             succ = _patchavailable[1]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext3rd/evolve/rewind.py	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,176 @@
+from __future__ import absolute_import
+
+import collections
+import hashlib
+
+from mercurial import (
+    cmdutil,
+    error,
+    hg,
+    obsolete,
+    obsutil,
+    scmutil,
+)
+
+from mercurial.i18n import _
+
+from . import (
+    exthelper,
+    rewriteutil,
+    compat,
+)
+
+eh = exthelper.exthelper()
+
+# flag in obsolescence markers to link to identical version
+identicalflag = 4
+
+@eh.command(
+    '^rewind',
+    [('', 'to', [], _("rewind to these revision")),
+     ('', 'as-divergence', None, _("preserve current latest successors")),
+     ('', 'exact', None, _("only rewind explicitly selected revisions")),
+     ('', 'from', [], _("rewind these revisions to their predecessors")),
+    ],
+    _(''))
+def rewind(ui, repo, **opts):
+    """rewind stacks of changeset to a previous content
+
+    This command can be used to restore stacks of changesets to an obsolete
+    state, creating identical identical copies.
+
+    There are two mains way to select the rewind target. Rewinding "from"
+    changesets will restore the direct precursors of theses changesets (and
+    obsolete the changeset you rewind from). Rewinding "to" will restore the
+    changeset you have selected (and obsolete their latest successors).
+
+    By default, we rewind from the working copy parents, restoring its
+    precursor.
+
+    When we rewind to an obsolete version, we also rewind to all its obsolete
+    ancestors. To only rewind to the explicitly selection changesets use the
+    `--exact` flag. Using the `--exact` flag can restore some changesets as
+    orphan.
+
+    The latest successors the obsolete changesets will be superseed by these
+    new copies. This behavior can be disabled using `--as-divergence`, the
+    current latest successors won't be affected and content-divergence will
+    appears between them and the restored version of the obsolete changesets.
+
+    Current rought edges:
+
+      * fold: rewinding to only some of the initially folded changesets will be
+              problematic. The fold result is marked obsolete and the part not
+              rewinded too are "lost".  Please use --as-divergence when you
+              need to perform such operation.
+
+      * :hg:`rewind` might affect changeset outside the current stack. Without --exact, we
+              also restore ancestors of the rewind target, obsoleting their
+              latest successors (unless --as-divergent is provided). In some
+              case, these latest successors will be on branches unrelated to
+              the changeset you rewind from.
+              (We plan to automatically detect this cases in the future)
+
+    """
+    unfi = repo.unfiltered()
+
+    successorsmap = collections.defaultdict(set)
+    rewindmap = {}
+    sscache = {}
+    with repo.wlock(), repo.lock():
+        # stay on the safe side: prevent local case in case we need to upgrade
+        cmdutil.bailifchanged(repo)
+
+        rewinded = _select_rewinded(repo, opts)
+
+        if not opts['as_divergence']:
+            for rev in rewinded:
+                ctx = unfi[rev]
+                ssets = obsutil.successorssets(repo, ctx.node(), sscache)
+                if 1 < len(ssets):
+                    msg = _('rewind confused by divergence on %s') % ctx
+                    hint = _('solve divergence first or use "--as-divergence"')
+                    raise error.Abort(msg, hint=hint)
+                if ssets and ssets[0]:
+                    for succ in ssets[0]:
+                        successorsmap[succ].add(ctx.node())
+
+        # Check that we can rewind these changesets
+        with repo.transaction('rewind'):
+            for rev in sorted(rewinded):
+                ctx = unfi[rev]
+                rewindmap[ctx.node()] = _revive_revision(unfi, rev, rewindmap)
+
+            relationships = []
+            cl = unfi.changelog
+            wctxp = repo[None].p1()
+            update_target = None
+            for (source, dest) in sorted(successorsmap.items()):
+                newdest = [rewindmap[d] for d in sorted(dest, key=cl.rev)]
+                rel = (unfi[source], tuple(unfi[d] for d in newdest))
+                relationships.append(rel)
+                if wctxp.node() == source:
+                    update_target = newdest[-1]
+            obsolete.createmarkers(unfi, relationships, operation='rewind')
+            if update_target is not None:
+                hg.updaterepo(repo, update_target, False)
+
+    repo.ui.status(_('rewinded to %d changesets\n') % len(rewinded))
+    if relationships:
+        repo.ui.status(_('(%d changesets obsoleted)\n') % len(relationships))
+    if update_target is not None:
+        ui.status(_('working directory is now at %s\n') % repo['.'])
+
+def _select_rewinded(repo, opts):
+    """select the revision we shoudl rewind to
+    """
+    unfi = repo.unfiltered()
+    rewinded = set()
+    revsto = opts.get('to')
+    revsfrom = opts.get('from')
+    if not (revsto or revsfrom):
+        revsfrom.append('.')
+    if revsto:
+        rewinded.update(scmutil.revrange(repo, revsto))
+    if revsfrom:
+        succs = scmutil.revrange(repo, revsfrom)
+        rewinded.update(unfi.revs('precursors(%ld)', succs))
+
+    if not rewinded:
+        raise error.Abort('no revision to rewind to')
+
+    if not opts['exact']:
+        rewinded = unfi.revs('obsolete() and ::%ld', rewinded)
+
+    return sorted(rewinded)
+
+def _revive_revision(unfi, rev, rewindmap):
+    """rewind a single revision rev.
+    """
+    ctx = unfi[rev]
+    extra = ctx.extra().copy()
+    # rewind hash should be unique over multiple rewind.
+    user = unfi.ui.config('devel', 'user.obsmarker')
+    if not user:
+        user = unfi.ui.username()
+    date = unfi.ui.configdate('devel', 'default-date')
+    if date is None:
+        date = compat.makedate()
+    noise = "%s\0%s\0%d\0%d" % (ctx.node(), user, date[0], date[1])
+    extra['__rewind-hash__'] = hashlib.sha256(noise).hexdigest()
+
+    p1 = ctx.p1().node()
+    p1 = rewindmap.get(p1, p1)
+    p2 = ctx.p2().node()
+    p2 = rewindmap.get(p2, p2)
+
+    extradict = {'extra': extra}
+
+    new, unusedvariable = rewriteutil.rewrite(unfi, ctx, [], ctx,
+                                              [p1, p2],
+                                              commitopts=extradict)
+
+    obsolete.createmarkers(unfi, [(ctx, (unfi[new],))],
+                           flag=identicalflag, operation='rewind')
+
+    return new
--- a/hgext3rd/evolve/stablerange.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/stablerange.py	Thu Aug 02 01:58:44 2018 +0200
@@ -157,29 +157,29 @@
     @abc.abstractmethod
     def subranges(self, repo, rangeid):
         """return the stable sub-ranges of a rangeid"""
-        raise NotImplemented()
+        raise NotImplementedError()
 
     @abc.abstractmethod
     def revsfromrange(self, repo, rangeid):
         """return revision contained in a range"""
-        raise NotImplemented()
+        raise NotImplementedError()
 
     @abc.abstractmethod
     def depthrev(self, repo, rev):
         """depth a revision"""
         # Exist to allow basic implementation to ignore the depthcache
         # Could be demoted to _depthrev.
-        raise NotImplemented()
+        raise NotImplementedError()
 
     @abc.abstractmethod
     def warmup(self, repo, upto=None):
         """warmup the stable range cache"""
-        raise NotImplemented()
+        raise NotImplementedError()
 
     @abc.abstractmethod
     def rangelength(self, repo, rangeid):
         """number of revision in <range>"""
-        raise NotImplemented()
+        raise NotImplementedError()
 
     def _slicepoint(self, repo, rangeid):
         """find the standard slicing point for a range"""
--- a/hgext3rd/evolve/stablesort.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/stablesort.py	Thu Aug 02 01:58:44 2018 +0200
@@ -178,10 +178,10 @@
     if not revs:
         return []
     elif len(revs) == 1:
-        heads = list(revs)
+        heads = list(sorted(revs))
     else:
         # keeps heads only
-        heads = sorted(repo.revs('heads(%ld::%ld)', revs, revs), key=tiebreaker)
+        heads = sorted(repo.revs('sort(heads(%ld::%ld))', revs, revs), key=tiebreaker)
 
     results = []
     while heads:
@@ -247,7 +247,7 @@
     return result
 
 def stablesort_mergepoint_head_basic(repo, revs, limit=None):
-    heads = repo.revs('heads(%ld)', revs)
+    heads = repo.revs('sort(heads(%ld))', revs)
     if not heads:
         return []
     elif 2 < len(heads):
@@ -260,7 +260,7 @@
     return revs[-limit:]
 
 def stablesort_mergepoint_head_debug(repo, revs, limit=None):
-    heads = repo.revs('heads(%ld)', revs)
+    heads = repo.revs('sort(heads(%ld))', revs)
     if not heads:
         return []
     elif 2 < len(heads):
@@ -305,7 +305,7 @@
     return bottom + mid + top
 
 def stablesort_mergepoint_head_cached(repo, revs, limit=None):
-    heads = repo.revs('heads(%ld)', revs)
+    heads = repo.revs('sort(heads(%ld))', revs)
     if not heads:
         return []
     elif 2 < len(heads):
@@ -505,7 +505,7 @@
             recordjump(previous, lower, size)
 
 def stablesort_mergepoint_head_ondisk(repo, revs, limit=None):
-    heads = repo.revs('heads(%ld)', revs)
+    heads = repo.revs('sort(heads(%ld))', revs)
     if not heads:
         return []
     elif 2 < len(heads):
--- a/hgext3rd/evolve/state.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/state.py	Thu Aug 02 01:58:44 2018 +0200
@@ -48,6 +48,9 @@
     def __getitem__(self, key):
         return self.opts[key]
 
+    def get(self, key, default=None):
+        return self.opts.get(key, default)
+
     def __setitem__(self, key, value):
         updates = {key: value}
         self.opts.update(updates)
--- a/hgext3rd/evolve/utility.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/evolve/utility.py	Thu Aug 02 01:58:44 2018 +0200
@@ -5,8 +5,6 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import collections
-
 from mercurial import (
     obsutil,
 )
@@ -94,23 +92,20 @@
     # dependencies = {3: [6], 6:[]}
     # Means that: 6 has no dependency, 3 depends on 6 to be solved
     dependencies = {}
-    # rdependencies is the inverted dict of dependencies
-    rdependencies = collections.defaultdict(set)
 
     for r in revs:
         dependencies[r] = set()
         for p in repo[r].parents():
-            try:
-                succ = _singlesuccessor(repo, p)
-            except MultipleSuccessorsError as exc:
-                tset = set()
-                for node in exc.successorssets[0]:
-                    tset.add(repo[node].rev())
-                dependencies[r] = tset
-                continue
-            if succ in revs:
-                dependencies[r].add(succ)
-                rdependencies[succ].add(r)
+            for succ in _successorrevs(repo, p):
+                if succ in revs:
+                    dependencies[r].add(succ)
+
+    # rdependencies is the inverted dict of dependencies
+    rdependencies = {r: set() for r in revs}
+    for r, deps in dependencies.items():
+        for dep in deps:
+            rdependencies[dep].add(r)
+
     return dependencies, rdependencies
 
 def _singlesuccessor(repo, p):
@@ -135,6 +130,14 @@
 
     return repo[newer[0][0]].rev()
 
+def _successorrevs(repo, ctx):
+    try:
+        return {_singlesuccessor(repo, ctx)}
+    except MultipleSuccessorsError as exc:
+        return {repo[node].rev()
+                for successorsset in exc.successorssets
+                for node in successorsset}
+
 def revselectionprompt(ui, repo, revs, customheader=""):
     """function to prompt user to choose a revision from all the revs and return
     that revision for further tasks
--- a/hgext3rd/topic/__init__.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/topic/__init__.py	Thu Aug 02 01:58:44 2018 +0200
@@ -181,9 +181,9 @@
               'topic.active': 'green',
              }
 
-__version__ = '0.9.1.dev'
+__version__ = '0.10.0.dev'
 
-testedwith = '4.3.3 4.4.2 4.5.2 4.6'
+testedwith = '4.3.3 4.4.2 4.5.2 4.6.1'
 minimumhgversion = '4.3'
 buglink = 'https://bz.mercurial-scm.org/'
 
@@ -364,7 +364,7 @@
         def commit(self, *args, **kwargs):
             backup = self.ui.backupconfig('ui', 'allowemptycommit')
             try:
-                if repo.currenttopic != repo['.'].topic():
+                if self.currenttopic != self['.'].topic():
                     # bypass the core "nothing changed" logic
                     self.ui.setconfig('ui', 'allowemptycommit', True)
                 return super(topicrepo, self).commit(*args, **kwargs)
@@ -374,7 +374,7 @@
         def commitctx(self, ctx, error=None):
             topicfilter = topicmap.topicfilter(self.filtername)
             if topicfilter != self.filtername:
-                other = repo.filtered(topicmap.topicfilter(repo.filtername))
+                other = self.filtered(topicmap.topicfilter(self.filtername))
                 other.commitctx(ctx, error=error)
 
             if isinstance(ctx, context.workingcommitctx):
@@ -409,7 +409,7 @@
 
         def branchmap(self, topic=None):
             if topic is None:
-                topic = getattr(repo, '_autobranchmaptopic', False)
+                topic = getattr(self, '_autobranchmaptopic', False)
             topicfilter = topicmap.topicfilter(self.filtername)
             if not topic or topicfilter == self.filtername:
                 return super(topicrepo, self).branchmap()
@@ -437,7 +437,7 @@
                 return tr
 
             reporef = weakref.ref(self)
-            if repo.ui.configbool('experimental', 'enforce-single-head'):
+            if self.ui.configbool('experimental', 'enforce-single-head'):
                 origvalidator = tr.validator
 
                 def validator(tr2):
@@ -446,7 +446,7 @@
                     origvalidator(tr2)
                 tr.validator = validator
 
-            topicmodeserver = repo.ui.config('experimental',
+            topicmodeserver = self.ui.config('experimental',
                                              'topic-mode.server', 'ignore')
             ispush = (desc.startswith('push') or desc.startswith('serve'))
             if (topicmodeserver != 'ignore' and ispush):
@@ -458,7 +458,7 @@
                     return origvalidator(tr2)
                 tr.validator = validator
 
-            elif (repo.ui.configbool('experimental', 'topic.publish-bare-branch')
+            elif (self.ui.configbool('experimental', 'topic.publish-bare-branch')
                     and (desc.startswith('push')
                          or desc.startswith('serve'))
                     ):
@@ -487,13 +487,18 @@
                 empty = csetcount == 0
                 if empty and not ctwasempty:
                     ui.status('active topic %r is now empty\n' % ct)
+                    if ('phase' in getattr(tr, 'names', ())
+                            or any(n.startswith('push-response')
+                            for n in getattr(tr, 'names', ()))):
+                        ui.status(_("(use 'hg topic --clear' to clear it if needed)\n"))
+                hint = _("(see 'hg help topics' for more information)\n")
                 if ctwasempty and not empty:
                     if csetcount == 1:
-                        msg = _('active topic %r grew its first changeset\n')
-                        ui.status(msg % ct)
+                        msg = _('active topic %r grew its first changeset\n%s')
+                        ui.status(msg % (ct, hint))
                     else:
-                        msg = _('active topic %r grew its %s first changesets\n')
-                        ui.status(msg % (ct, csetcount))
+                        msg = _('active topic %r grew its %s first changesets\n%s')
+                        ui.status(msg % (ct, csetcount, hint))
 
             tr.addpostclose('signalcurrenttopicempty', currenttopicempty)
             return tr
--- a/hgext3rd/topic/discovery.py	Fri Jun 08 22:52:51 2018 +0530
+++ b/hgext3rd/topic/discovery.py	Thu Aug 02 01:58:44 2018 +0200
@@ -16,7 +16,7 @@
 try:
     from mercurial import wireproto
     wireproto.branchmap
-except ImportError: # <= hg-4.5
+except (AttributeError, ImportError): # <= hg-4.5
     from mercurial import wireprotov1server as wireproto
 
 def _headssummary(orig, pushop, *args, **kwargs):
--- a/tests/test-amend-patch.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-amend-patch.t	Thu Aug 02 01:58:44 2018 +0200
@@ -1156,3 +1156,46 @@
 
 Nothing happens in that case we dont care about the node ID. Look the above 3-4
 tests to realize I was testing that too.
+
+Aborting by passing an empty patch file (issue5925)
+---------------------------------------------------
+
+  $ cat > editor.sh <<EOF
+  > #!/bin/sh
+  > cat > \$1 <<ENDOF
+  > ENDOF
+  > EOF
+
+  $ HGEDITOR="sh ./editor.sh" hg amend --patch
+  abort: empty patch file, amend aborted
+  [255]
+
+  $ hg exp
+  # HG changeset patch
+  # User RandomUser
+  # Date 123456 1200
+  #      Fri Jan 02 09:57:36 1970 -0020
+  # Branch stable
+  # Node ID f14ecd7121e63915ac93edbad7f60f605e62dd52
+  # Parent  fc57c20be380f2878f4db139dad66d6cfb42ec62
+  I am a message which is testing change of message
+  
+  diff --git a/a b/a
+  new file mode 100755
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,3 @@
+  +Gello
+  +Kello
+  +betto
+
+  $ hg parents
+  changeset:   18:f14ecd7121e6
+  branch:      stable
+  bookmark:    foo
+  tag:         tip
+  parent:      3:fc57c20be380
+  user:        RandomUser
+  date:        Fri Jan 02 09:57:36 1970 -0020
+  summary:     I am a message which is testing change of message
+  
--- a/tests/test-discovery-obshashrange.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-discovery-obshashrange.t	Thu Aug 02 01:58:44 2018 +0200
@@ -176,6 +176,8 @@
   $ hg commit -m foo
   $ hg debugobsolete ffffffffffffffffffffffffffffffffffffffff `getid '.'`
   $ hg push -f --debug
+  could not import hgext.hgext3rd.evolve (No module named hgext3rd.evolve): trying hgext3rd.hgext3rd.evolve (?)
+  could not import hgext3rd.hgext3rd.evolve (No module named hgext3rd.evolve): trying hgext3rd.evolve (?)
   pushing to ssh://user@dummy/server
   running python "*/dummyssh" *user@dummy* *hg -R server serve --stdio* (glob)
   sending hello command
--- a/tests/test-divergent.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-divergent.t	Thu Aug 02 01:58:44 2018 +0200
@@ -32,107 +32,155 @@
 
   $ hg init test1
   $ cd test1
-  $ mkcommits _a _b
-  $ hg up "desc(_a)"
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ mkcommit bdivergent1
+  $ echo bdivergent > bdivergent1
+  $ hg ci -Am "divergent"
+  adding bdivergent1
   created new head
-  $ hg up "desc(_a)"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ mkcommit bdivergent2
+  $ echo bdivergent > bdivergent2
+  $ hg ci -Am "divergent"
+  adding bdivergent2
   created new head
-  $ hg prune -s "desc(bdivergent1)" "desc(_b)"
+
+  $ hg prune -s 8374d2ddc3a4 "desc('added b')"
   1 changesets pruned
-  $ hg prune -s "desc(bdivergent2)" "desc(_b)" --hidden
+  $ hg prune -s 593c57f2117e "desc('added b')" --hidden
   1 changesets pruned
   2 new content-divergent changesets
+
   $ hg log -G
-  @  3:e708fd28d5cf@default(draft) add bdivergent2 [content-divergent]
+  @  3:8374d2ddc3a4@default(draft) divergent [content-divergent]
   |
-  | *  2:c2f698071cba@default(draft) add bdivergent1 [content-divergent]
+  | *  2:593c57f2117e@default(draft) divergent [content-divergent]
   |/
-  o  0:135f39f4bd78@default(draft) add _a []
+  o  0:9092f1db7931@default(draft) added a []
   
+
   $ hg evolve --all --any --content-divergent
-  merge:[2] add bdivergent1
-  with: [3] add bdivergent2
-  base: [1] add _b
-  updating to "local" conflict
-  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  merge:[2] divergent
+  with: [3] divergent
+  base: [1] added b
+  updating to "local" side of the conflict: 593c57f2117e
+  merging "other" content-divergent changeset '8374d2ddc3a4'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at c26f1d3baed2
+  working directory is now at 45bf1312f454
   $ hg log -G
-  @  4:c26f1d3baed2@default(draft) add bdivergent1 []
+  @  4:45bf1312f454@default(draft) divergent []
   |
-  o  0:135f39f4bd78@default(draft) add _a []
+  o  0:9092f1db7931@default(draft) added a []
   
 Test divergence resolution when it yields to an empty commit (issue4950)
 cdivergent2 contains the same content than cdivergent1 and they are divergent
 versions of the revision _c
 
-  $ hg up "desc(_a)"
+  $ hg up .^
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ mkcommit _c
   created new head
-  $ hg up "desc(_a)"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ mkcommit cdivergent1
   created new head
-  $ hg up "desc(_a)"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo "cdivergent1" > cdivergent1
   $ hg add cdivergent1
-  $ hg ci -m "cdivergent2"
+  $ hg ci -m "add _c"
   created new head
-  $ hg prune -s "desc(cdivergent1)" "desc(_c)"
+
+  $ hg log -G
+  @  7:b2ae71172042@default(draft) add _c []
+  |
+  | o  6:e3ff64ce8d4c@default(draft) add cdivergent1 []
+  |/
+  | o  5:48819a835615@default(draft) add _c []
+  |/
+  | o  4:45bf1312f454@default(draft) divergent []
+  |/
+  o  0:9092f1db7931@default(draft) added a []
+  
+
+  $ hg prune -s b2ae71172042 48819a835615
   1 changesets pruned
-  $ hg prune -s "desc(cdivergent2)" "desc(_c)" --hidden
+  $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden
   1 changesets pruned
   2 new content-divergent changesets
+
   $ hg log -G
-  @  7:0a768ef678d9@default(draft) cdivergent2 [content-divergent]
+  @  7:b2ae71172042@default(draft) add _c [content-divergent]
   |
-  | *  6:26c7705fee96@default(draft) add cdivergent1 [content-divergent]
+  | *  6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
   |/
-  | o  4:c26f1d3baed2@default(draft) add bdivergent1 []
+  | o  4:45bf1312f454@default(draft) divergent []
   |/
-  o  0:135f39f4bd78@default(draft) add _a []
+  o  0:9092f1db7931@default(draft) added a []
   
   $ hg evolve --all --any --content-divergent
   merge:[6] add cdivergent1
-  with: [7] cdivergent2
+  with: [7] add _c
   base: [5] add _c
-  updating to "local" conflict
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updating to "local" side of the conflict: e3ff64ce8d4c
+  merging "other" content-divergent changeset 'b2ae71172042'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   nothing changed
-  working directory is now at 26c7705fee96
+  working directory is now at e3ff64ce8d4c
+
+  $ cd ..
 
 Test None docstring issue of evolve divergent, which caused hg crush
 
   $ hg init test2
   $ cd test2
   $ mkcommits _a _b
-  $ hg up "desc(_a)"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ mkcommit bdivergent1
+  $ echo bdivergent > bdivergent11
+  $ hg ci -Am "bdivergent"
+  adding bdivergent11
   created new head
-  $ hg up "desc(_a)"
+
+  $ hg up .^
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ mkcommit bdivergent2
+  $ echo bdivergent > bdivergent22
+  $ hg ci -Am "bdivergent"
+  adding bdivergent22
   created new head
-  $ hg prune -s "desc(bdivergent1)" "desc(_b)"
+
+  $ hg log -G
+  @  3:6b096fb45070@default(draft) bdivergent []
+  |
+  | o  2:05a6b6a9e633@default(draft) bdivergent []
+  |/
+  | o  1:37445b16603b@default(draft) add _b []
+  |/
+  o  0:135f39f4bd78@default(draft) add _a []
+  
+
+  $ hg prune -s 6b096fb45070 37445b16603b
   1 changesets pruned
-  $ hg prune -s "desc(bdivergent2)" "desc(_b)" --hidden
+  $ hg prune -s 05a6b6a9e633 37445b16603b --hidden
   1 changesets pruned
   2 new content-divergent changesets
   $ hg log -G
-  @  3:e708fd28d5cf@default(draft) add bdivergent2 [content-divergent]
+  @  3:6b096fb45070@default(draft) bdivergent [content-divergent]
   |
-  | *  2:c2f698071cba@default(draft) add bdivergent1 [content-divergent]
+  | *  2:05a6b6a9e633@default(draft) bdivergent [content-divergent]
   |/
   o  0:135f39f4bd78@default(draft) add _a []
   
+
   $ cat >$TESTTMP/test_extension.py  << EOF
   > from mercurial import merge
   > origupdate = merge.update
@@ -149,11 +197,11 @@
   (do you want to use --content-divergent)
   [2]
   $ hg evolve --content-divergent
-  merge:[3] add bdivergent2
-  with: [2] add bdivergent1
+  merge:[3] bdivergent
+  with: [2] bdivergent
   base: [1] add _b
+  merging "other" content-divergent changeset '05a6b6a9e633'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at aa26817f6fbe
-
+  working directory is now at 73ff357d3975
 
   $ cd ..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-abort-contentdiv.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,360 @@
+Tests for the --abort flag for `hg evolve` command while content-divergence resolution
+======================================================================================
+
+The `--abort` flag aborts the interuppted evolve by undoing all the work which
+was done during resolution i.e. stripping new changesets created, moving
+bookmarks back, moving working directory back.
+
+This test contains cases when `hg evolve` is doing content-divergence resolution.
+
+Setup
+=====
+
+  $ cat >> $HGRCPATH <<EOF
+  > [phases]
+  > publish = False
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init abortrepo
+  $ cd abortrepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+  $ echo bar > d
+  $ hg amend
+
+  $ hg up c41c793e0ef1 --hidden
+  updating to a hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: e49523854bc8)
+
+  $ echo foobar > d
+  $ hg amend
+  2 new content-divergent changesets
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset 'e49523854bc8'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg status -v
+  M d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     d
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at 9c1631e352d9
+
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating multiple content-divergence where resolution of last one results in
+conflicts and resolution of first one resulted in no new commit
+-----------------------------------------------------------------------------
+
+  $ echo watbar > d
+  $ hg amend
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bar > c
+  $ hg amend
+  2 new orphan changesets
+  $ hg up ca1b80f7960a --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (ca1b80f7960a)
+  (use 'hg evolve' to update to its successor: 2ba73e31f264)
+  $ echo foobar > c
+  $ hg amend
+  2 new content-divergent changesets
+  $ echo bar > c
+  $ hg amend
+
+  $ hg glog --hidden
+  @  10:491e10505bae added c
+  |   () draft
+  | x  9:7398f702a162 added c
+  |/    () draft
+  | *  8:2ba73e31f264 added c
+  |/    () draft
+  | *  7:f0f1694f123e added d
+  | |   () draft
+  | | x  6:9c1631e352d9 added d
+  | |/    () draft
+  | | *  5:e49523854bc8 added d
+  | |/    () draft
+  | | x  4:c41c793e0ef1 added d
+  | |/    () draft
+  | x  3:ca1b80f7960a added c
+  |/    () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --all --content-divergent
+  merge:[8] added c
+  with: [10] added c
+  base: [3] added c
+  updating to "local" side of the conflict: 2ba73e31f264
+  merging "other" content-divergent changeset '491e10505bae'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[5] added d
+  with: [7] added d
+  base: [4] added d
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset 'f0f1694f123e'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  2 new content-divergent changesets
+  evolve aborted
+  working directory is now at 491e10505bae
+
+  $ hg glog --hidden
+  @  10:491e10505bae added c
+  |   () draft
+  | x  9:7398f702a162 added c
+  |/    () draft
+  | *  8:2ba73e31f264 added c
+  |/    () draft
+  | *  7:f0f1694f123e added d
+  | |   () draft
+  | | x  6:9c1631e352d9 added d
+  | |/    () draft
+  | | *  5:e49523854bc8 added d
+  | |/    () draft
+  | | x  4:c41c793e0ef1 added d
+  | |/    () draft
+  | x  3:ca1b80f7960a added c
+  |/    () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg obslog -r . --all
+  *  2ba73e31f264 (8) added c
+  |
+  | @  491e10505bae (10) added c
+  | |
+  | x  7398f702a162 (9) added c
+  |/     rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  ca1b80f7960a (3) added c
+       rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  $ cd ..
+
+Creating content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and relocating leads to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg init multiparent
+  $ cd multiparent
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg rebase -r . -d .^^^ --config extensions.rebase=
+  rebasing 4:c41c793e0ef1 "added d" (tip)
+  $ echo bar > c
+  $ hg add c
+  $ hg amend
+
+  $ hg up --hidden c41c793e0ef1
+  updating to a hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
+  $ echo bar > d
+  $ hg amend
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  7:e49523854bc8 added d
+  |   () draft
+  | *  6:69bdd23a9b0d added d
+  | |   () draft
+  o |  3:ca1b80f7960a added c
+  | |   () draft
+  o |  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[7] added d
+  with: [6] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 69bdd23a9b0d on ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at e49523854bc8
+
+  $ hg glog
+  @  7:e49523854bc8 added d
+  |   () draft
+  | *  6:69bdd23a9b0d added d
+  | |   () draft
+  o |  3:ca1b80f7960a added c
+  | |   () draft
+  o |  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and merging divergent leads to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg up 69bdd23a9b0d
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rm c
+  $ echo wat > d
+  $ hg amend
+
+  $ hg glog
+  @  8:33e4442acf98 added d
+  |   () draft
+  | *  7:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[7] added d
+  with: [8] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset 'a663d1567f0b'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at 33e4442acf98
+
+  $ hg glog
+  @  8:33e4442acf98 added d
+  |   () draft
+  | *  7:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-abort-orphan.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,527 @@
+Tests for the --abort flag for `hg evolve` command while orphan resolution
+==========================================================================
+
+The `--abort` flag aborts the interrupted evolve by undoing all the work which
+was done during resolution i.e. stripping new changesets created, moving
+bookmarks back, moving working directory back.
+
+This test contains cases when `hg evolve` is doing orphan resolution.
+
+Setup
+=====
+
+  $ cat >> $HGRCPATH <<EOF
+  > [phases]
+  > publish = False
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init abortrepo
+  $ cd abortrepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Testing --abort when no evolve is interrupted
+=============================================
+
+  $ hg evolve --abort
+  abort: no interrupted evolve to stop
+  [255]
+
+Testing with wrong combination of flags
+=======================================
+
+  $ hg evolve --abort --continue
+  abort: cannot specify both "--abort" and "--continue"
+  [255]
+
+  $ hg evolve --abort --stop
+  abort: cannot specify both "--abort" and "--stop"
+  [255]
+
+  $ hg evolve --abort --rev 3
+  abort: cannot specify both "--rev" and "--abort"
+  [255]
+
+  $ hg evolve --abort --any
+  abort: cannot specify both "--any" and "--abort"
+  [255]
+
+  $ hg evolve --abort --all
+  abort: cannot specify both "--all" and "--abort"
+  [255]
+
+Normal testingw when no rev was evolved
+========================================
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [3] added c
+
+  $ echo babar > d
+  $ hg add d
+  $ hg amend
+  1 new orphan changesets
+
+  $ hg evolve --all
+  move:[4] added d
+  atop:[5] added c
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at e93a9161a274
+
+  $ hg glog
+  @  5:e93a9161a274 added c
+  |   () draft
+  | *  4:c41c793e0ef1 added d
+  | |   () draft
+  | x  3:ca1b80f7960a added c
+  |/    () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg diff
+
+  $ hg status
+
+cleaning up things for next testing
+
+  $ hg evolve --all
+  move:[4] added d
+  atop:[5] added c
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+  $ echo foo > d
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  evolving 4:c41c793e0ef1 "added d"
+  working directory is now at e83de241f751
+
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+When there are evolved revisions but on a single branch
+=======================================================
+
+  $ echo bar > c
+  $ hg add c
+  $ hg amend
+  3 new orphan changesets
+
+  $ hg evolve --all
+  move:[2] added b
+  atop:[7] added a
+  move:[5] added c
+  atop:[8] added b
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+testing that interrupted evolve shows up in morestatus
+  $ hg status -v
+  M c
+  A d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     c
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
+  $ hg glog
+  @  8:0c41ec482070 added b
+  |   () draft
+  o  7:125af0ed8cae added a
+  |   () draft
+  | *  6:e83de241f751 added d
+  | |   () draft
+  | *  5:e93a9161a274 added c
+  | |   () draft
+  | x  2:b1661037fa25 added b
+  | |   () draft
+  | x  1:c7586e2a9264 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --abort
+  1 new orphan changesets
+  evolve aborted
+  working directory is now at 125af0ed8cae
+
+  $ hg glog
+  @  7:125af0ed8cae added a
+  |   () draft
+  | *  6:e83de241f751 added d
+  | |   () draft
+  | *  5:e93a9161a274 added c
+  | |   () draft
+  | *  2:b1661037fa25 added b
+  | |   () draft
+  | x  1:c7586e2a9264 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ cd ..
+
+Testing when evolved revs are on multiple branches
+==================================================
+
+  $ hg init repotwo
+  $ cd repotwo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ for ch in b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ for ch in c d; do echo $ ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
+  created new head
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo foo > a
+  $ hg ci -m "foo to a"
+  created new head
+
+  $ hg glog
+  @  6:8f20d4390c21 foo to a
+  |   () draft
+  | o  5:bcb1c47f8520 added d
+  | |   () draft
+  | o  4:86d2603075a3 added c
+  |/    () draft
+  | o  3:17509928e5bf added c
+  | |   () draft
+  | o  2:9f0c80a55ddc added b
+  |/    () draft
+  o  1:2f913b0c9220 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg prev
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [1] added a
+  $ echo aa > a
+  $ hg amend
+  5 new orphan changesets
+
+  $ hg evolve --all
+  move:[2] added b
+  atop:[7] added a
+  move:[4] added c
+  atop:[7] added a
+  move:[6] foo to a
+  atop:[7] added a
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg glog
+  o  9:7f8e8bd9f0b6 added c
+  |   () draft
+  | o  8:db3b42ef4da7 added b
+  |/    () draft
+  @  7:807e8e2ca559 added a
+  |   () draft
+  | *  6:8f20d4390c21 foo to a
+  | |   () draft
+  | | *  5:bcb1c47f8520 added d
+  | | |   () draft
+  | | x  4:86d2603075a3 added c
+  | |/    () draft
+  | | *  3:17509928e5bf added c
+  | | |   () draft
+  | | x  2:9f0c80a55ddc added b
+  | |/    () draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --abort
+  2 new orphan changesets
+  evolve aborted
+  working directory is now at 807e8e2ca559
+
+  $ hg glog
+  @  7:807e8e2ca559 added a
+  |   () draft
+  | *  6:8f20d4390c21 foo to a
+  | |   () draft
+  | | *  5:bcb1c47f8520 added d
+  | | |   () draft
+  | | *  4:86d2603075a3 added c
+  | |/    () draft
+  | | *  3:17509928e5bf added c
+  | | |   () draft
+  | | *  2:9f0c80a55ddc added b
+  | |/    () draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg status
+
+  $ hg diff
+
+Testing when user created a new changesets on top of evolved revisions
+======================================================================
+
+  $ hg evolve --all
+  move:[2] added b
+  atop:[7] added a
+  move:[4] added c
+  atop:[7] added a
+  move:[6] foo to a
+  atop:[7] added a
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+  $ hg glog
+  o  9:7f8e8bd9f0b6 added c
+  |   () draft
+  | o  8:db3b42ef4da7 added b
+  |/    () draft
+  @  7:807e8e2ca559 added a
+  |   () draft
+  | *  6:8f20d4390c21 foo to a
+  | |   () draft
+  | | *  5:bcb1c47f8520 added d
+  | | |   () draft
+  | | x  4:86d2603075a3 added c
+  | |/    () draft
+  | | *  3:17509928e5bf added c
+  | | |   () draft
+  | | x  2:9f0c80a55ddc added b
+  | |/    () draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ echo foo > a
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ cd ..
+  $ hg init clonerepo
+  $ cd repotwo
+  $ hg push ../clonerepo --force
+  pushing to ../clonerepo
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 10 changesets with 8 changes to 5 files (+4 heads)
+  3 new obsolescence markers
+  3 new orphan changesets
+  $ cd ../clonerepo
+  $ hg up 7f8e8bd9f0b6
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar > bar
+  $ hg add bar
+  $ hg ci -m "made an new commit on evolved rev"
+
+  $ hg push ../repotwo --force
+  pushing to ../repotwo
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ cd ../repotwo
+  $ hg evolve --abort
+  warning: new changesets detected on destination branch
+  abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
+  [255]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 807e8e2ca559
+
+Testing when the evolved revision turned public due to some other user actions
+==============================================================================
+
+  $ hg evolve --all
+  move:[3] added c
+  atop:[8] added b
+  move:[5] added d
+  atop:[9] added c
+  move:[6] foo to a
+  atop:[7] added a
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg glog
+  o  12:1c476940790a added d
+  |   () draft
+  | o  11:c10a55eb0cc6 added c
+  | |   () draft
+  +---o  10:48eca1ed5478 made an new commit on evolved rev
+  | |     () draft
+  o |  9:7f8e8bd9f0b6 added c
+  | |   () draft
+  | o  8:db3b42ef4da7 added b
+  |/    () draft
+  @  7:807e8e2ca559 added a
+  |   () draft
+  | *  6:8f20d4390c21 foo to a
+  | |   () draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg phase -r 1c476940790a --public
+
+  $ hg evolve --abort
+  cannot clean up public changesets: 1c476940790a
+  abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
+  [255]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 807e8e2ca559
+
+  $ cd ..
+
+Testing that bookmark should be moved back when doing `hg evolve --abort`
+=========================================================================
+
+  $ hg init repothree
+  $ cd repothree
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg bookmark bm1
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark bm1)
+  $ echo foo > c
+  $ hg add c
+  $ hg amend
+  2 new orphan changesets
+
+  $ hg glog
+  @  4:a0086c17bfc7 added a
+  |   () draft
+  | *  3:17509928e5bf added c
+  | |   () draft
+  | *  2:9f0c80a55ddc added b
+  | |   (bm1) draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --all
+  move:[2] added b
+  atop:[4] added a
+  move:[3] added c
+  atop:[5] added b
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg glog
+  @  5:c1f4718020e3 added b
+  |   (bm1) draft
+  o  4:a0086c17bfc7 added a
+  |   () draft
+  | *  3:17509928e5bf added c
+  | |   () draft
+  | x  2:9f0c80a55ddc added b
+  | |   () draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --abort
+  1 new orphan changesets
+  evolve aborted
+  working directory is now at a0086c17bfc7
+
+  $ hg glog
+  @  4:a0086c17bfc7 added a
+  |   () draft
+  | *  3:17509928e5bf added c
+  | |   () draft
+  | *  2:9f0c80a55ddc added b
+  | |   (bm1) draft
+  | x  1:2f913b0c9220 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Testing `--abort` when conflicts are caused due to `hg next --evolve`
+=====================================================================
+
+  $ hg next --evolve
+  move:[2] added b
+  atop:[4] added a
+  working directory now at c1f4718020e3
+  $ hg next --evolve
+  move:[3] added c
+  atop:[5] added b
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at c1f4718020e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-abort-phasediv.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,317 @@
+Tests for the --abort flag for `hg evolve` command while phase-divergence resolution
+====================================================================================
+
+The `--abort` flag aborts the interuppted evolve by undoing all the work which
+was done during resolution i.e. stripping new changesets created, moving
+bookmarks back, moving working directory back.
+
+This test contains cases when `hg evolve` is doing phase-divergence resolution.
+
+Setup
+=====
+
+  $ cat >> $HGRCPATH <<EOF
+  > [phases]
+  > publish = False
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init abortrepo
+  $ cd abortrepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating phase divergence, resolution of which will lead to conflicts
+----------------------------------------------------------------------
+
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ hg grab -r .~-3
+  grabbing 4:c41c793e0ef1 "added d"
+  $ echo foobar > c
+  $ hg add c
+  $ hg amend
+
+  $ hg glog --hidden
+  @  6:ddba58020bc0 added d
+  |   () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg phase -r c41c793e0ef1 --public --hidden
+  1 new phase-divergent changesets
+
+  $ hg glog
+  @  6:ddba58020bc0 added d
+  |   () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
+  $ hg evolve --phase-divergent
+  recreate:[6] added d
+  atop:[4] added d
+  rebasing to destination parent: ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+testing that interrupted evolve shows up in morestatus
+  $ hg status -v
+  M c
+  A d
+  # The repository is in an unfinished *evolve* state.
+  
+  # Unresolved merge conflicts:
+  # 
+  #     c
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
+  # To continue:    hg evolve --continue
+  # To abort:       hg evolve --abort
+  # To stop:        hg evolve --stop
+  # (also see `hg help evolve.interrupted`)
+  
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at ddba58020bc0
+
+  $ hg glog
+  @  6:ddba58020bc0 added d
+  |   () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
+
+When there are multiple phase-divergent changes, resolution of last one resulted
+in conflicts
+---------------------------------------------------------------------------------
+
+  $ echo foo > c
+  $ hg amend
+  $ hg phase -r ca1b80f --draft --force
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [1] added a
+  $ hg grab -r ca1b80f
+  grabbing 3:ca1b80f7960a "added c"
+  $ echo foobar > b
+  $ hg add b
+  $ hg amend
+  $ hg phase -r c41c793e0ef1 --public --hidden
+  2 new phase-divergent changesets
+
+  $ hg evolve --list
+  e44ebefe4f54: added d
+    phase-divergent: c41c793e0ef1 (immutable precursor)
+  
+  28cd06b3f801: added c
+    phase-divergent: ca1b80f7960a (immutable precursor)
+  
+
+  $ hg evolve --dry-run --all --phase-divergent
+  recreate:[7] added d
+  atop:[4] added d
+  hg rebase --rev e44ebefe4f54 --dest ca1b80f7960a;
+  hg update c41c793e0ef1;
+  hg revert --all --rev e44ebefe4f54;
+  hg commit --msg "phase-divergent update to e44ebefe4f54"
+  recreate:[9] added c
+  atop:[3] added c
+  hg rebase --rev 28cd06b3f801 --dest b1661037fa25;
+  hg update ca1b80f7960a;
+  hg revert --all --rev 28cd06b3f801;
+  hg commit --msg "phase-divergent update to 28cd06b3f801"
+
+  $ hg glog --hidden
+  @  9:28cd06b3f801 added c
+  |   () draft
+  | x  8:9ff8adbe8a24 added c
+  |/    () draft
+  | *  7:e44ebefe4f54 added d
+  |/    () draft
+  | x  6:ddba58020bc0 added d
+  |/    () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
+
+  $ hg evolve --phase-divergent --all
+  recreate:[7] added d
+  atop:[4] added d
+  rebasing to destination parent: ca1b80f7960a
+  computing new diff
+  committed as c41c793e0ef1
+  recreate:[9] added c
+  atop:[3] added c
+  rebasing to destination parent: b1661037fa25
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  1 new phase-divergent changesets
+  evolve aborted
+  working directory is now at 28cd06b3f801
+
+  $ hg glog --hidden
+  @  9:28cd06b3f801 added c
+  |   () draft
+  | x  8:9ff8adbe8a24 added c
+  |/    () draft
+  | *  7:e44ebefe4f54 added d
+  |/    () draft
+  | x  6:ddba58020bc0 added d
+  |/    () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
+
+When there are multiple conflicted phase-divergence resolution and we abort
+after resolving one of them
+----------------------------------------------------------------------------
+
+  $ hg up e44ebefe4f54
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo foobar > c
+  $ hg amend
+
+  $ hg glog --hidden
+  @  10:ef9b72b9b42c added d
+  |   () draft
+  | *  9:28cd06b3f801 added c
+  |/    () draft
+  | x  8:9ff8adbe8a24 added c
+  |/    () draft
+  | x  7:e44ebefe4f54 added d
+  |/    () draft
+  | x  6:ddba58020bc0 added d
+  |/    () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
+
+  $ hg evolve --phase-divergent --all
+  recreate:[9] added c
+  atop:[3] added c
+  rebasing to destination parent: b1661037fa25
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo watwat > c
+  $ hg resolve -m
+  (no more unresolved files)
+  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
+  rebasing to destination parent: ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --abort
+  1 new phase-divergent changesets
+  evolve aborted
+  working directory is now at ef9b72b9b42c
+
+  $ hg glog --hidden
+  @  10:ef9b72b9b42c added d
+  |   () draft
+  | *  9:28cd06b3f801 added c
+  |/    () draft
+  | x  8:9ff8adbe8a24 added c
+  |/    () draft
+  | x  7:e44ebefe4f54 added d
+  |/    () draft
+  | x  6:ddba58020bc0 added d
+  |/    () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | o  4:c41c793e0ef1 added d
+  | |   () public
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
+  |/    () public
+  o  1:c7586e2a9264 added a
+  |   () public
+  o  0:8fa14d15e168 added hgignore
+      () public
--- a/tests/test-evolve-abort.t	Fri Jun 08 22:52:51 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,519 +0,0 @@
-Tests for the --abort flag for `hg evolve` command
-==================================================
-
-Setup
-=====
-
-  $ cat >> $HGRCPATH <<EOF
-  > [phases]
-  > publish = False
-  > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
-  > [extensions]
-  > EOF
-  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-  $ hg init abortrepo
-  $ cd abortrepo
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
-
-  $ hg glog
-  @  4:c41c793e0ef1 added d
-  |   () draft
-  o  3:ca1b80f7960a added c
-  |   () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Testing --abort when no evolve is interrupted
-=============================================
-
-  $ hg evolve --abort
-  abort: no interrupted evolve to stop
-  [255]
-
-Testing with wrong combination of flags
-=======================================
-
-  $ hg evolve --abort --continue
-  abort: cannot specify both "--abort" and "--continue"
-  [255]
-
-  $ hg evolve --abort --stop
-  abort: cannot specify both "--abort" and "--stop"
-  [255]
-
-  $ hg evolve --abort --rev 3
-  abort: cannot specify both "--rev" and "--abort"
-  [255]
-
-  $ hg evolve --abort --any
-  abort: cannot specify both "--any" and "--abort"
-  [255]
-
-  $ hg evolve --abort --all
-  abort: cannot specify both "--all" and "--abort"
-  [255]
-
-Normal testingw when no rev was evolved
-========================================
-
-  $ hg prev
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [3] added c
-
-  $ echo babar > d
-  $ hg add d
-  $ hg amend
-  1 new orphan changesets
-
-  $ hg evolve --all
-  move:[4] added d
-  atop:[5] added c
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg evolve --abort
-  evolve aborted
-  working directory is now at e93a9161a274
-
-  $ hg glog
-  @  5:e93a9161a274 added c
-  |   () draft
-  | *  4:c41c793e0ef1 added d
-  | |   () draft
-  | x  3:ca1b80f7960a added c
-  |/    () draft
-  o  2:b1661037fa25 added b
-  |   () draft
-  o  1:c7586e2a9264 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg diff
-
-  $ hg status
-
-cleaning up things for next testing
-
-  $ hg evolve --all
-  move:[4] added d
-  atop:[5] added c
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-  $ echo foo > d
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-  $ hg evolve --continue
-  evolving 4:c41c793e0ef1 "added d"
-  working directory is now at e83de241f751
-
-  $ hg up .^^^
-  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-
-When there are evolved revisions but on a single branch
-=======================================================
-
-  $ echo bar > c
-  $ hg add c
-  $ hg amend
-  3 new orphan changesets
-
-  $ hg evolve --all
-  move:[2] added b
-  atop:[7] added a
-  move:[5] added c
-  atop:[8] added b
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg glog
-  @  8:0c41ec482070 added b
-  |   () draft
-  o  7:125af0ed8cae added a
-  |   () draft
-  | *  6:e83de241f751 added d
-  | |   () draft
-  | *  5:e93a9161a274 added c
-  | |   () draft
-  | x  2:b1661037fa25 added b
-  | |   () draft
-  | x  1:c7586e2a9264 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --abort
-  1 new orphan changesets
-  evolve aborted
-  working directory is now at 125af0ed8cae
-
-  $ hg glog
-  @  7:125af0ed8cae added a
-  |   () draft
-  | *  6:e83de241f751 added d
-  | |   () draft
-  | *  5:e93a9161a274 added c
-  | |   () draft
-  | *  2:b1661037fa25 added b
-  | |   () draft
-  | x  1:c7586e2a9264 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ cd ..
-
-Testing when evolved revs are on multiple branches
-==================================================
-
-  $ hg init repotwo
-  $ cd repotwo
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ echo a > a
-  $ hg ci -Aqm "added a"
-  $ for ch in b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
-  $ hg up .^^
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ for ch in c d; do echo $ ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
-  created new head
-  $ hg up .^^
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ echo foo > a
-  $ hg ci -m "foo to a"
-  created new head
-
-  $ hg glog
-  @  6:8f20d4390c21 foo to a
-  |   () draft
-  | o  5:bcb1c47f8520 added d
-  | |   () draft
-  | o  4:86d2603075a3 added c
-  |/    () draft
-  | o  3:17509928e5bf added c
-  | |   () draft
-  | o  2:9f0c80a55ddc added b
-  |/    () draft
-  o  1:2f913b0c9220 added a
-  |   () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg prev
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  [1] added a
-  $ echo aa > a
-  $ hg amend
-  5 new orphan changesets
-
-  $ hg evolve --all
-  move:[2] added b
-  atop:[7] added a
-  move:[4] added c
-  atop:[7] added a
-  move:[6] foo to a
-  atop:[7] added a
-  merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg glog
-  o  9:7f8e8bd9f0b6 added c
-  |   () draft
-  | o  8:db3b42ef4da7 added b
-  |/    () draft
-  @  7:807e8e2ca559 added a
-  |   () draft
-  | *  6:8f20d4390c21 foo to a
-  | |   () draft
-  | | *  5:bcb1c47f8520 added d
-  | | |   () draft
-  | | x  4:86d2603075a3 added c
-  | |/    () draft
-  | | *  3:17509928e5bf added c
-  | | |   () draft
-  | | x  2:9f0c80a55ddc added b
-  | |/    () draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --abort
-  2 new orphan changesets
-  evolve aborted
-  working directory is now at 807e8e2ca559
-
-  $ hg glog
-  @  7:807e8e2ca559 added a
-  |   () draft
-  | *  6:8f20d4390c21 foo to a
-  | |   () draft
-  | | *  5:bcb1c47f8520 added d
-  | | |   () draft
-  | | *  4:86d2603075a3 added c
-  | |/    () draft
-  | | *  3:17509928e5bf added c
-  | | |   () draft
-  | | *  2:9f0c80a55ddc added b
-  | |/    () draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg status
-
-  $ hg diff
-
-Testing when user created a new changesets on top of evolved revisions
-======================================================================
-
-  $ hg evolve --all
-  move:[2] added b
-  atop:[7] added a
-  move:[4] added c
-  atop:[7] added a
-  move:[6] foo to a
-  atop:[7] added a
-  merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-  $ hg glog
-  o  9:7f8e8bd9f0b6 added c
-  |   () draft
-  | o  8:db3b42ef4da7 added b
-  |/    () draft
-  @  7:807e8e2ca559 added a
-  |   () draft
-  | *  6:8f20d4390c21 foo to a
-  | |   () draft
-  | | *  5:bcb1c47f8520 added d
-  | | |   () draft
-  | | x  4:86d2603075a3 added c
-  | |/    () draft
-  | | *  3:17509928e5bf added c
-  | | |   () draft
-  | | x  2:9f0c80a55ddc added b
-  | |/    () draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ echo foo > a
-  $ hg resolve -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-
-  $ cd ..
-  $ hg init clonerepo
-  $ cd repotwo
-  $ hg push ../clonerepo --force
-  pushing to ../clonerepo
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 10 changesets with 8 changes to 5 files (+4 heads)
-  3 new obsolescence markers
-  3 new orphan changesets
-  $ cd ../clonerepo
-  $ hg up 7f8e8bd9f0b6
-  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ echo bar > bar
-  $ hg add bar
-  $ hg ci -m "made an new commit on evolved rev"
-
-  $ hg push ../repotwo --force
-  pushing to ../repotwo
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 1 changesets with 1 changes to 1 files
-  $ cd ../repotwo
-  $ hg evolve --abort
-  warning: new changesets detected on destination branch
-  abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
-  [255]
-
-  $ hg evolve --stop
-  stopped the interrupted evolve
-  working directory is now at 807e8e2ca559
-
-Testing when the evolved revision turned public due to some other user actions
-==============================================================================
-
-  $ hg evolve --all
-  move:[3] added c
-  atop:[8] added b
-  move:[5] added d
-  atop:[9] added c
-  move:[6] foo to a
-  atop:[7] added a
-  merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg glog
-  o  12:1c476940790a added d
-  |   () draft
-  | o  11:c10a55eb0cc6 added c
-  | |   () draft
-  +---o  10:48eca1ed5478 made an new commit on evolved rev
-  | |     () draft
-  o |  9:7f8e8bd9f0b6 added c
-  | |   () draft
-  | o  8:db3b42ef4da7 added b
-  |/    () draft
-  @  7:807e8e2ca559 added a
-  |   () draft
-  | *  6:8f20d4390c21 foo to a
-  | |   () draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg phase -r 1c476940790a --public
-
-  $ hg evolve --abort
-  cannot clean up public changesets: 1c476940790a
-  abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
-  [255]
-
-  $ hg evolve --stop
-  stopped the interrupted evolve
-  working directory is now at 807e8e2ca559
-
-  $ cd ..
-
-Testing that bookmark should be moved back when doing `hg evolve --abort`
-=========================================================================
-
-  $ hg init repothree
-  $ cd repothree
-  $ echo ".*\.orig" > .hgignore
-  $ hg add .hgignore
-  $ hg ci -m "added hgignore"
-  $ for ch in a b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
-
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg bookmark bm1
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  (leaving bookmark bm1)
-  $ echo foo > c
-  $ hg add c
-  $ hg amend
-  2 new orphan changesets
-
-  $ hg glog
-  @  4:a0086c17bfc7 added a
-  |   () draft
-  | *  3:17509928e5bf added c
-  | |   () draft
-  | *  2:9f0c80a55ddc added b
-  | |   (bm1) draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --all
-  move:[2] added b
-  atop:[4] added a
-  move:[3] added c
-  atop:[5] added b
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg glog
-  @  5:c1f4718020e3 added b
-  |   (bm1) draft
-  o  4:a0086c17bfc7 added a
-  |   () draft
-  | *  3:17509928e5bf added c
-  | |   () draft
-  | x  2:9f0c80a55ddc added b
-  | |   () draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-  $ hg evolve --abort
-  1 new orphan changesets
-  evolve aborted
-  working directory is now at a0086c17bfc7
-
-  $ hg glog
-  @  4:a0086c17bfc7 added a
-  |   () draft
-  | *  3:17509928e5bf added c
-  | |   () draft
-  | *  2:9f0c80a55ddc added b
-  | |   (bm1) draft
-  | x  1:2f913b0c9220 added a
-  |/    () draft
-  o  0:8fa14d15e168 added hgignore
-      () draft
-
-Testing `--abort` when conflicts are caused due to `hg next --evolve`
-=====================================================================
-
-  $ hg next --evolve
-  move:[2] added b
-  atop:[4] added a
-  working directory now at c1f4718020e3
-  $ hg next --evolve
-  move:[3] added c
-  atop:[5] added b
-  merging c
-  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
-
-  $ hg evolve --abort
-  evolve aborted
-  working directory is now at c1f4718020e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergence.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,934 @@
+** Test for handling of content divergent changesets by `hg evolve` **
+====================================================================
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [phases]
+  > publish = False
+  > [extensions]
+  > rebase =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init cdiv
+  $ cd cdiv
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Creating content-divergence with branch change where base, divergent and other
+have different branches
+-------------------------------------------------------------------------------
+
+  $ hg branch -r . foobar
+  changed branch on 1 changesets
+
+  $ hg up c41c793e0ef1 --hidden
+  updating to a hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: 9e5dffcb3d48)
+  $ echo bar > d
+  $ hg branch watwat
+  marked working directory as branch watwat
+  $ hg amend
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  6:264b04f771fb added d
+  |   () [watwat] draft
+  | *  5:9e5dffcb3d48 added d
+  |/    () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent --config ui.interactive=True<<EOF
+  > c
+  > EOF
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset '9e5dffcb3d48'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  content divergent changesets on different branches.
+  choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar?  c
+  working directory is now at 0ac42f1bc15c
+
+  $ hg glog
+  @  7:0ac42f1bc15c added d
+  |   () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Testing merging of commit messages
+-----------------------------------
+
+When base and one of the divergent has same commit messages and other divergent
+has different one
+
+  $ echo wat > d
+  $ hg amend
+
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ echo bar > d
+  $ hg ci -Aqm "added a d with bar in it, expect some beers"
+
+  $ hg prune -r 0ac42f1bc15c -s . --hidden
+  1 changesets pruned
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  9:59081c9c425a added a d with bar in it, expect some beers
+  |   () [default] draft
+  | *  8:f621d00f5f0e added d
+  |/    () [foobar] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[9] added a d with bar in it, expect some beers
+  with: [8] added d
+  base: [7] added d
+  merging "other" content-divergent changeset 'f621d00f5f0e'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at a9d6fd6b5e40
+
+  $ hg glog
+  @  10:a9d6fd6b5e40 added a d with bar in it, expect some beers
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+When base has different message and both divergents has same one
+
+  $ echo foo > d
+  $ hg amend -m "foo to d"
+
+  $ hg up a9d6fd6b5e40 --hidden
+  updating to a hidden changeset a9d6fd6b5e40
+  (hidden revision 'a9d6fd6b5e40' was rewritten as: b10b07a394f1)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (a9d6fd6b5e40)
+  (use 'hg evolve' to update to its successor: b10b07a394f1)
+  $ echo babar > d
+  $ hg amend -m "foo to d"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  12:0bb497fed24a foo to d
+  |   () [default] draft
+  | *  11:b10b07a394f1 foo to d
+  |/    () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[12] foo to d
+  with: [11] foo to d
+  base: [10] added a d with bar in it, expect some beers
+  merging "other" content-divergent changeset 'b10b07a394f1'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo foobar > d
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 11175423b5dc
+
+  $ hg glog
+  @  13:11175423b5dc foo to d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+When all three base, divergent and other has different commit messages creating
+conflicts
+
+  $ echo bar > d
+  $ hg amend -m "bar to d, expect beers"
+
+  $ hg up 11175423b5dc --hidden
+  updating to a hidden changeset 11175423b5dc
+  (hidden revision '11175423b5dc' was rewritten as: 27f0463f169a)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (11175423b5dc)
+  (use 'hg evolve' to update to its successor: 27f0463f169a)
+  $ echo wat > d
+  $ hg amend -m "wat to d, wat?"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  15:f542037ddf31 wat to d, wat?
+  |   () [default] draft
+  | *  14:27f0463f169a bar to d, expect beers
+  |/    () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[15] wat to d, wat?
+  with: [14] bar to d, expect beers
+  base: [13] foo to d
+  merging "other" content-divergent changeset '27f0463f169a'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo watbar > d
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ cat > editor.sh <<EOF
+  > #!/bin/sh
+  > printf "**showing editors text**\n\n"
+  > cat \$1
+  > printf "\n**done showing editors text**\n\n"
+  > cat > \$1 <<ENDOF
+  > watbar to d
+  > ENDOF
+  > EOF
+
+  $ HGEDITOR='sh ./editor.sh' hg evolve --continue
+  **showing editors text**
+  
+  HG: Conflicts while merging changeset description of content-divergent changesets.
+  HG: Resolve conflicts in commit messages to continue.
+  
+  <<<<<<< divergent
+  wat to d, wat?||||||| base
+  foo to d=======
+  bar to d, expect beers>>>>>>> other
+  
+  **done showing editors text**
+  
+  working directory is now at 89ea3eee2d69
+
+  $ hg glog
+  @  16:89ea3eee2d69 watbar to d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+
+Testing resolution of content-divergent changesets when they are on different
+parents and resolution and relocation wont result in conflicts
+------------------------------------------------------------------------------
+
+  $ hg init multiparents
+  $ cd multiparents
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bar > b
+  $ hg amend
+  2 new orphan changesets
+
+  $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True
+  rebasing 2:b1661037fa25 "added b"
+  2 new content-divergent changesets
+
+  $ hg glog
+  *  6:da4b96f4a8d6 added b
+  |   () [default] draft
+  | @  5:7ed0642d644b added b
+  | |   () [default] draft
+  | | *  4:c41c793e0ef1 added d
+  | | |   () [default] draft
+  | | *  3:ca1b80f7960a added c
+  | | |   () [default] draft
+  | | x  2:b1661037fa25 added b
+  | |/    () [default] draft
+  | o  1:c7586e2a9264 added a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added b
+  with: [6] added b
+  base: [2] added b
+  rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264
+  updating to "local" side of the conflict: 7ed0642d644b
+  merging "other" content-divergent changeset '11f849d7159f'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 171614c9a791
+
+  $ hg glog
+  @  8:171614c9a791 added b
+  |   () [default] draft
+  | *  4:c41c793e0ef1 added d
+  | |   () [default] draft
+  | *  3:ca1b80f7960a added c
+  | |   () [default] draft
+  | x  2:b1661037fa25 added b
+  |/    () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 171614c9a7914c53f531373b95632323fdbbac8d
+  # Parent  c7586e2a92645e473645847a7b69a6dc52be4276
+  added b
+  
+  diff -r c7586e2a9264 -r 171614c9a791 b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar
+
+Resolving orphans to get back to a normal graph
+
+  $ hg evolve --all
+  move:[3] added c
+  atop:[8] added b
+  move:[4] added d
+  atop:[9] added c
+  working directory is now at 4ae4427ee9f8
+  $ hg glog
+  @  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+More testing!
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo x > x
+  $ hg ci -Aqm "added x"
+  $ hg glog -r .
+  @  11:71a392c714b5 added x
+  |   () [default] draft
+  ~
+
+  $ echo foo > x
+  $ hg branch bar
+  marked working directory as branch bar
+  (branches are permanent and global, did you want a bookmark?)
+  $ hg amend -m "added foo to x"
+
+  $ hg up 71a392c714b5 --hidden
+  updating to a hidden changeset 71a392c714b5
+  (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (71a392c714b5)
+  (use 'hg evolve' to update to its successor: 1e1a50385a7d)
+  $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True
+  rebasing 11:71a392c714b5 "added x"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  13:1e4f6b3bb39b added x
+  |   () [default] draft
+  | *  12:1e1a50385a7d added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[13] added x
+  with: [12] added foo to x
+  base: [11] added x
+  rebasing "other" content-divergent changeset 1e1a50385a7d on 4ae4427ee9f8
+  updating to "local" side of the conflict: 1e4f6b3bb39b
+  merging "other" content-divergent changeset '80cc9b1ec650'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at b006cf317e0e
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Branch bar
+  # Node ID b006cf317e0ed16dbe786c439577475580f645f1
+  # Parent  4ae4427ee9f8f0935211fd66360948b77ab5aee9
+  added foo to x
+  
+  diff -r 4ae4427ee9f8 -r b006cf317e0e x
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +foo
+
+The above `hg exp` and the following log call demonstrates that message, content
+and branch change is preserved in case of relocation
+  $ hg glog
+  @  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Testing when both the content-divergence are on different parents and resolution
+will lead to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ echo y > y
+  $ hg ci -Aqm "added y"
+  $ hg glog -r .
+  @  16:fc6ad2bac162 added y
+  |   () [default] draft
+  ~
+
+  $ echo bar > y
+  $ hg amend
+
+  $ hg up fc6ad2bac162 --hidden
+  updating to a hidden changeset fc6ad2bac162
+  (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (fc6ad2bac162)
+  (use 'hg evolve' to update to its successor: 2a9f6ccbdeba)
+  $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True
+  rebasing 16:fc6ad2bac162 "added y"
+  2 new content-divergent changesets
+  $ echo wat > y
+  $ hg amend
+
+  $ hg glog
+  @  19:b4575ed6fcfc added y
+  |   () [bar] draft
+  | *  17:2a9f6ccbdeba added y
+  | |   () [default] draft
+  o |  15:b006cf317e0e added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[19] added y
+  with: [17] added y
+  base: [16] added y
+  rebasing "other" content-divergent changeset 2a9f6ccbdeba on b006cf317e0e
+  updating to "local" side of the conflict: b4575ed6fcfc
+  merging "other" content-divergent changeset '48f745db3f53'
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo watbar > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 7bbcf24ddecf
+
+  $ hg glog
+  @  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg obslog -r . --all
+  @    7bbcf24ddecf (21) added y
+  |\
+  x |  48f745db3f53 (20) added y
+  | |    rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  b4575ed6fcfc (19) added y
+  | |    rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  x |  2a9f6ccbdeba (17) added y
+  | |    rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  96b677f01b81 (18) added y
+  |/     rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  fc6ad2bac162 (16) added y
+       rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+checking that relocated commit is there
+  $ hg exp 48f745db3f53 --hidden
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3
+  # Parent  b006cf317e0ed16dbe786c439577475580f645f1
+  added y
+  
+  diff -r b006cf317e0e -r 48f745db3f53 y
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar
+
+Testing when the relocation will result in conflicts and merging wont
+----------------------------------------------------------------------
+
+  $ hg glog
+  @  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up .^^^^
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+
+  $ echo z > z
+  $ hg ci -Aqm "added z"
+  $ hg glog -r .
+  @  22:daf1de08f3b0 added z
+  |   () [default] draft
+  ~
+
+  $ echo foo > y
+  $ hg add y
+  $ hg amend
+
+  $ hg up daf1de08f3b0 --hidden
+  updating to a hidden changeset daf1de08f3b0
+  (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080)
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (daf1de08f3b0)
+  (use 'hg evolve' to update to its successor: 3f7a1f693080)
+  $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True
+  rebasing 22:daf1de08f3b0 "added z"
+  2 new content-divergent changesets
+  $ echo bar > z
+  $ hg amend
+
+  $ hg glog
+  @  25:53242575ffa9 added z
+  |   () [bar] draft
+  | *  23:3f7a1f693080 added z
+  | |   () [default] draft
+  o |  21:7bbcf24ddecf added y
+  | |   () [bar] draft
+  o |  15:b006cf317e0e added foo to x
+  | |   () [bar] draft
+  o |  10:4ae4427ee9f8 added d
+  | |   () [default] draft
+  o |  9:917281f93fcb added c
+  |/    () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[25] added z
+  with: [23] added z
+  base: [22] added z
+  rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 7bbcf24ddecf y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: 7bbcf24ddecf bar - test: added y
+   watbar
+  +=======
+  +foo
+  +>>>>>>> evolving:    3f7a1f693080 - test: added z
+  diff -r 7bbcf24ddecf z
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +z
+
+  $ echo foo > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  evolving 23:3f7a1f693080 "added z"
+  updating to "local" side of the conflict: 53242575ffa9
+  merging "other" content-divergent changeset 'cdb0643c69fc'
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r 53242575ffa9 y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< local: 53242575ffa9 bar - test: added z
+   watbar
+  +=======
+  +foo
+  +>>>>>>> other: cdb0643c69fc - test: added z
+
+  $ echo foo > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at 6fc7d9682de6
+
+  $ hg glog
+  @  27:6fc7d9682de6 added z
+  |   () [bar] draft
+  o  21:7bbcf24ddecf added y
+  |   () [bar] draft
+  o  15:b006cf317e0e added foo to x
+  |   () [bar] draft
+  o  10:4ae4427ee9f8 added d
+  |   () [default] draft
+  o  9:917281f93fcb added c
+  |   () [default] draft
+  o  8:171614c9a791 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Branch bar
+  # Node ID 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4
+  # Parent  7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b
+  added z
+  
+  diff -r 7bbcf24ddecf -r 6fc7d9682de6 y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -watbar
+  +foo
+  diff -r 7bbcf24ddecf -r 6fc7d9682de6 z
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar
+
+  $ cd ..
+
+Resolving content-divergence of a stack with same parents
+---------------------------------------------------------
+
+  $ hg init stacktest
+  $ cd stacktest
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+  $ hg init stack2
+  $ cd stack2
+  $ hg pull ../stacktest
+  pulling from ../stacktest
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 5 files
+  new changesets 8fa14d15e168:c41c793e0ef1
+  (run 'hg update' to get a working copy)
+  $ hg glog
+  o  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up c7586e2a9264
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  $ hg evolve --all
+  move:[2] added b
+  atop:[6] watbar to a
+  move:[3] added c
+  atop:[7] added b
+  move:[4] added d
+  atop:[8] added c
+  working directory is now at 15c781f93cac
+  $ hg glog
+  @  9:15c781f93cac added d
+  |   () [default] draft
+  o  8:9e5fb1d5b955 added c
+  |   () [default] draft
+  o  7:88516dccf68a added b
+  |   () [default] draft
+  o  6:82b74d5dc678 watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ../stacktest
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ hg evolve --all
+  move:[2] added b
+  atop:[5] watbar to a
+  move:[3] added c
+  atop:[6] added b
+  move:[4] added d
+  atop:[7] added c
+  working directory is now at c72d2885eb51
+  $ hg glog
+  @  8:c72d2885eb51 added d
+  |   () [default] draft
+  o  7:3ce4be6d8e5e added c
+  |   () [default] draft
+  o  6:d5f148423c16 added b
+  |   () [default] draft
+  o  5:8e222f257bbf watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg pull ../stack2
+  pulling from ../stack2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 0 changes to 4 files (+1 heads)
+  5 new obsolescence markers
+  8 new content-divergent changesets
+  new changesets 82b74d5dc678:15c781f93cac
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg glog
+  *  12:15c781f93cac added d
+  |   () [default] draft
+  *  11:9e5fb1d5b955 added c
+  |   () [default] draft
+  *  10:88516dccf68a added b
+  |   () [default] draft
+  *  9:82b74d5dc678 watbar to a
+  |   () [default] draft
+  | @  8:c72d2885eb51 added d
+  | |   () [default] draft
+  | *  7:3ce4be6d8e5e added c
+  | |   () [default] draft
+  | *  6:d5f148423c16 added b
+  | |   () [default] draft
+  | *  5:8e222f257bbf watbar to a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --all --content-divergent
+  merge:[5] watbar to a
+  with: [9] watbar to a
+  base: [1] added a
+  updating to "local" side of the conflict: 8e222f257bbf
+  merging "other" content-divergent changeset '82b74d5dc678'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  6 new orphan changesets
+  merge:[6] added b
+  with: [10] added b
+  base: [2] added b
+  updating to "local" side of the conflict: d5f148423c16
+  merging "other" content-divergent changeset '88516dccf68a'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[7] added c
+  with: [11] added c
+  base: [3] added c
+  updating to "local" side of the conflict: 3ce4be6d8e5e
+  merging "other" content-divergent changeset '9e5fb1d5b955'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[8] added d
+  with: [12] added d
+  base: [4] added d
+  updating to "local" side of the conflict: c72d2885eb51
+  merging "other" content-divergent changeset '15c781f93cac'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 038fe7db3d88
+
+  $ hg glog
+  @  16:038fe7db3d88 added d
+  |   () [default] draft
+  o  15:b2cac10f3836 added c
+  |   () [default] draft
+  o  14:eadfd9d70680 added b
+  |   () [default] draft
+  o  13:f66f262fff6c watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
--- a/tests/test-evolve-continue.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-continue.t	Thu Aug 02 01:58:44 2018 +0200
@@ -58,10 +58,8 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foo > d
   $ hg resolve -m
@@ -117,10 +115,8 @@
   atop:[8] added d
   merging e
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo bar > e
   $ hg resolve -m
@@ -158,10 +154,8 @@
   atop:[9] added a
   merging b
   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foo > b
   $ hg resolve -m
@@ -246,10 +240,8 @@
   atop:[17] added d
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foo > f
   $ hg resolve -m
@@ -263,10 +255,8 @@
   atop:[19] added g
   merging h
   warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foo > h
   $ hg resolve -m
@@ -311,10 +301,8 @@
   perform evolve? [Ny] y
   merging g
   warning: conflicts while merging g! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foo > g
   $ hg resolve -m
@@ -363,10 +351,8 @@
   atop:[24] added f
   merging g
   warning: conflicts while merging g! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
   $ echo foo > g
   $ hg resolve -m
   (no more unresolved files)
--- a/tests/test-evolve-issue5832.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-issue5832.t	Thu Aug 02 01:58:44 2018 +0200
@@ -180,7 +180,13 @@
   |/    () draft
   o  0:bde1d2b6b5e5 added base
       () draft
- 
+  $ hg log -r 'p1(.)'
+  changeset:   3:9402371b436e
+  parent:      0:bde1d2b6b5e5
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c and d
+  
   $ hg up bde1d2b6b5e5
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ echo l > l
@@ -279,3 +285,149 @@
   |/    () draft
   o  0:bde1d2b6b5e5 added base
       () draft
+
+Test for issue5946 present at https://bz.mercurial-scm.org/show_bug.cgi?id=5946
+===============================================================================
+issue with computing dependency with split and merge
+
+  $ hg init issue5946
+  $ cd issue5946
+  $ echo base > base
+  $ hg ci -Aqm "added base"
+
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo c > c
+  $ echo d > d
+  $ hg ci -Aqm "added c and d"
+The next line is the only difference from issue5833 above, i.e. the order of
+the parents is reversed
+  $ hg co 2
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+  $ hg merge
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "merge commit"
+
+  $ hg glog
+  @    4:b9b387427a53 merge commit
+  |\    () draft
+  | o  3:9402371b436e added c and d
+  | |   () draft
+  o |  2:a1da0651488c added b
+  | |   () draft
+  o |  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+  $ hg log -r 'p1(.)'
+  changeset:   2:a1da0651488c
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added b
+  
+  $ hg up bde1d2b6b5e5
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ echo l > l
+  $ hg ci -Aqm "added l"
+  $ hg grab -r 1b24879c5c3c
+  grabbing 1:1b24879c5c3c "added a"
+  2 new orphan changesets
+
+  $ hg up bde1d2b6b5e5
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo c > c
+  $ hg ci -Aqm "added c"
+  $ hg up .^
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg ci -Aqm "added d"
+
+  $ hg glog
+  @  8:5841d7cf9893 added d
+  |   () draft
+  | o  7:62fb70414f99 added c
+  |/    () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  | *    4:b9b387427a53 merge commit
+  | |\    () draft
+  +---o  3:9402371b436e added c and d
+  | |     () draft
+  | *  2:a1da0651488c added b
+  | |   () draft
+  | x  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+
+  $ hg prune -r 9402371b436e --succ 5841d7cf9893 --succ 62fb70414f99 --split
+  1 changesets pruned
+
+  $ hg glog
+  @  8:5841d7cf9893 added d
+  |   () draft
+  | o  7:62fb70414f99 added c
+  |/    () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  | *    4:b9b387427a53 merge commit
+  | |\    () draft
+  +---x  3:9402371b436e added c and d
+  | |     () draft
+  | *  2:a1da0651488c added b
+  | |   () draft
+  | x  1:1b24879c5c3c added a
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
+
+  $ hg evolve --any --all --dry-run
+  move:[2] added b
+  atop:[6] added a
+  hg rebase -r a1da0651488c -d 5568b87b1491
+  could not solve instability, ambiguous destination: parent split across two branches
+
+  $ hg evolve --any --all --config ui.interactive=True <<EOF
+  > 1
+  > 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
+  q: quit the prompt
+  enter the index of the revision you want to select: 1
+  move:[4] merge commit
+  atop:[8] added d
+  move:[10] merge commit
+  atop:[9] added b
+  working directory is now at 578c938ebd2e
+
+  $ hg glog
+  @    11:578c938ebd2e merge commit
+  |\    () draft
+  | o  9:da76bb7cd904 added b
+  | |   () draft
+  o |  8:5841d7cf9893 added d
+  | |   () draft
+  +---o  7:62fb70414f99 added c
+  | |     () draft
+  | o  6:5568b87b1491 added a
+  | |   () draft
+  | o  5:0a6281e212fe added l
+  |/    () draft
+  o  0:bde1d2b6b5e5 added base
+      () draft
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-noupdate.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,126 @@
+Testing the `--no-update` flag to `hg evolve` command
+=====================================================
+
+There is an `--update` flag to `hg evolve` command which defaults to True. The
+`--update` flag updates to the head of the evolved revisions. If you dont want
+to change your working directory or update your working directory to its
+sucessor after hg evolve, `hg evolve --no-update` is the thing for you.
+
+This patch tests that flag.
+
+Setup
+-----
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init stoprepo
+  $ cd stoprepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Making sure we stay where we were is current wdir parent is not obsoleted
+--------------------------------------------------------------------------
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bar > b
+  $ hg amend
+  2 new orphan changesets
+  $ hg glog
+  @  5:7ed0642d644b added b
+  |   () draft
+  | *  4:c41c793e0ef1 added d
+  | |   () draft
+  | *  3:ca1b80f7960a added c
+  | |   () draft
+  | x  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+There is 'working directory is now at' message because it didnt changed
+  $ hg evolve --all --no-update
+  move:[3] added c
+  atop:[5] added b
+  move:[4] added d
+  atop:[6] added c
+
+  $ hg glog
+  o  7:b6b20b8eefdc added d
+  |   () draft
+  o  6:7c46f743e62f added c
+  |   () draft
+  @  5:7ed0642d644b added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Updating to successor when working directory parent is obsoleted by evolution
+-----------------------------------------------------------------------------
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added a
+  $ echo bar > a
+  $ hg amend
+  3 new orphan changesets
+  $ hg up 7ed0642d644b
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg glog
+  o  8:3d41537b44ca added a
+  |   () draft
+  | *  7:b6b20b8eefdc added d
+  | |   () draft
+  | *  6:7c46f743e62f added c
+  | |   () draft
+  | @  5:7ed0642d644b added b
+  | |   () draft
+  | x  1:c7586e2a9264 added a
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --all --any --no-update
+  move:[5] added b
+  atop:[8] added a
+  move:[6] added c
+  atop:[9] added b
+  move:[7] added d
+  atop:[10] added c
+  working directory is now at 12c720cb3782
+
+  $ hg glog
+  o  11:a74d9f22ba3f added d
+  |   () draft
+  o  10:958f5155e8cd added c
+  |   () draft
+  @  9:12c720cb3782 added b
+  |   () draft
+  o  8:3d41537b44ca added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-amend-then-fold.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,248 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with amended + folded commit
+========================================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-amend-fold
+  $ cd $TESTTMP/local-amend-fold
+  $ mkcommit ROOT
+  $ mkcommit A0
+  $ mkcommit B0
+  $ hg amend -m "B1"
+  $ hg log --hidden -G
+  @  changeset:   3:b7ea6d14e664
+  |  tag:         tip
+  |  parent:      1:471f378eab4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     B1
+  |
+  | x  changeset:   2:0dec01379d3b
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 3:b7ea6d14e664
+  |    summary:     B0
+  |
+  o  changeset:   1:471f378eab4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg fold --exact -r 'desc(A0) + desc(B1)' --date "0 0" -m "C0"
+  2 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --hidden -G
+  @  changeset:   4:eb5a0daa2192
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     C0
+  |
+  | x  changeset:   3:b7ea6d14e664
+  | |  parent:      1:471f378eab4c
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  obsolete:    rewritten using fold as 4:eb5a0daa2192
+  | |  summary:     B1
+  | |
+  | | x  changeset:   2:0dec01379d3b
+  | |/   user:        test
+  | |    date:        Thu Jan 01 00:00:00 1970 +0000
+  | |    obsolete:    reworded using amend as 3:b7ea6d14e664
+  | |    summary:     B0
+  | |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using fold as 4:eb5a0daa2192
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+ Actual test
+ -----------
+
+Check that debugobshistory on head show a coherent graph
+  $ hg obslog eb5a0daa2192 --patch
+  @    eb5a0daa2192 (4) C0
+  |\
+  x |  471f378eab4c (1) A0
+   /     rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+  |        --- a/changeset-description
+  |        +++ b/changeset-description
+  |        @@ -1,1 +1,1 @@
+  |        -A0
+  |        +C0
+  |
+  |        diff -r 471f378eab4c -r eb5a0daa2192 B0
+  |        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |        +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+  |        @@ -0,0 +1,1 @@
+  |        +B0
+  |
+  |
+  x  b7ea6d14e664 (3) B1
+  |    rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, changesets rebased)
+  |
+  x  0dec01379d3b (2) B0
+       rewritten(description) as b7ea6d14e664 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -B0
+         +B1
+  
+  
+Check that obslog on ROOT with all option show everything
+  $ hg obslog 1 --hidden --all --patch
+  @    eb5a0daa2192 (4) C0
+  |\
+  x |  471f378eab4c (1) A0
+   /     rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+  |        --- a/changeset-description
+  |        +++ b/changeset-description
+  |        @@ -1,1 +1,1 @@
+  |        -A0
+  |        +C0
+  |
+  |        diff -r 471f378eab4c -r eb5a0daa2192 B0
+  |        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |        +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+  |        @@ -0,0 +1,1 @@
+  |        +B0
+  |
+  |
+  x  b7ea6d14e664 (3) B1
+  |    rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, changesets rebased)
+  |
+  x  0dec01379d3b (2) B0
+       rewritten(description) as b7ea6d14e664 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -B0
+         +B1
+  
+  
+  $ hg obslog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "eb5a0daa2192",
+          "rev": 4,
+          "shortdescription": "C0"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      *, (glob)
+                      *, (glob)
+                      "content"
+                  ],
+                  "operation": "fold",
+                  "succnodes": [
+                      "eb5a0daa2192"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "b7ea6d14e664",
+          "rev": 3,
+          "shortdescription": "B1"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "b7ea6d14e664"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "0dec01379d3b",
+          "rev": 2,
+          "shortdescription": "B0"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description",
+                      "content"
+                  ],
+                  "operation": "fold",
+                  "succnodes": [
+                      "eb5a0daa2192"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg update 471f378eab4c
+  abort: hidden revision '471f378eab4c'!
+  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
+  [255]
+  $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192)
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (use 'hg evolve' to update to its successor: eb5a0daa2192)
+  $ hg update --hidden 0dec01379d3b
+  updating to a hidden changeset 0dec01379d3b
+  (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (0dec01379d3b)
+  (use 'hg evolve' to update to its successor: eb5a0daa2192)
+  $ hg update 0dec01379d3b
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg update --hidden 'desc(B0)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-amend.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,406 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+
+Test output on amended commit
+=============================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-amend
+  $ hg init $TESTTMP/server
+  $ cd $TESTTMP/local-amend
+  $ mkcommit ROOT
+  $ sync
+  $ mkcommit A0 .
+  $ echo 42 >> A0
+  $ hg amend -m "A1
+  > 
+  > Better commit message"
+  $ sync
+  $ hg log --hidden -G
+  @  changeset:   2:4ae3a4151de9
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A1
+  |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using amend as 2:4ae3a4151de9
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Check output on the client side
+-------------------------------
+  $ hg obslog --patch 4ae3a4151de9
+  @  4ae3a4151de9 (2) A1
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (*) (glob)
+         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,3 @@
+         -A0
+         +A1
+         +
+         +Better commit message
+  
+         diff -r 471f378eab4c -r 4ae3a4151de9 A0
+         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,1 +1,2 @@
+          A0
+         +42
+  
+  
+  $ hg obslog --patch --color debug
+  @  [evolve.node|4ae3a4151de9] [evolve.rev|(2)] [evolve.short_description|A1]
+  |
+  x  [evolve.node|471f378eab4c] [evolve.rev|(1)] [evolve.short_description|A0]
+       [evolve.verb|rewritten](description, content) as [evolve.node|4ae3a4151de9] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)]
+         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
+         [diff.file_a|--- a/changeset-description]
+         [diff.file_b|+++ b/changeset-description]
+         [diff.hunk|@@ -1,1 +1,3 @@]
+         [diff.deleted|-A0]
+         [diff.inserted|+A1]
+         [diff.inserted|+]
+         [diff.inserted|+Better commit message]
+  
+         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 A0]
+         [diff.file_a|--- a/A0	Thu Jan 01 00:00:00 1970 +0000]
+         [diff.file_b|+++ b/A0	Thu Jan 01 00:00:00 1970 +0000]
+         [diff.hunk|@@ -1,1 +1,2 @@]
+          A0
+         [diff.inserted|+42]
+  
+  
+
+  $ hg obslog --no-graph --patch 4ae3a4151de9
+  4ae3a4151de9 (2) A1
+  471f378eab4c (1) A0
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
+      --- a/changeset-description
+      +++ b/changeset-description
+      @@ -1,1 +1,3 @@
+      -A0
+      +A1
+      +
+      +Better commit message
+  
+      diff -r 471f378eab4c -r 4ae3a4151de9 A0
+      --- a/A0	Thu Jan 01 00:00:00 1970 +0000
+      +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
+      @@ -1,1 +1,2 @@
+       A0
+      +42
+  
+
+  $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", shortdescription)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}'
+  @  A1
+  |
+  x  A0 at 0 0 by test
+  
+  $ hg obslog 4ae3a4151de9 --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "4ae3a4151de9",
+          "rev": 2,
+          "shortdescription": "A1"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description",
+                      "content"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "4ae3a4151de9"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg obslog --hidden --patch 471f378eab4c
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,3 @@
+         -A0
+         +A1
+         +
+         +Better commit message
+  
+         diff -r 471f378eab4c -r 4ae3a4151de9 A0
+         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,1 +1,2 @@
+          A0
+         +42
+  
+  
+  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      *, (glob)
+                      "content"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "4ae3a4151de9"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg update 471f378eab4c
+  abort: hidden revision '471f378eab4c'!
+  (use --hidden to access hidden revisions; successor: 4ae3a4151de9)
+  [255]
+  $ hg update --hidden "desc(A0)"
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' was rewritten as: 4ae3a4151de9)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (use 'hg evolve' to update to its successor: 4ae3a4151de9)
+
+Check output on the server side
+-------------------------------
+
+  $ hg obslog -R $TESTTMP/server --patch 4ae3a4151de9
+  o  4ae3a4151de9 (1) A1
+  |
+  x  471f378eab4c
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, context is not local)
+  
+  $ hg obslog -R $TESTTMP/server -f --patch 4ae3a4151de9
+  o  4ae3a4151de9 (1) A1
+  
+  $ hg obslog -R $TESTTMP/server --no-graph --patch 4ae3a4151de9
+  4ae3a4151de9 (1) A1
+  471f378eab4c
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
+
+  $ hg obslog -R $TESTTMP/server --no-graph -f --patch 4ae3a4151de9
+  4ae3a4151de9 (1) A1
+  471f378eab4c
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
+
+Amend two more times
+====================
+
+Amend again
+-----------
+  $ hg log --hidden -G
+  o  changeset:   2:4ae3a4151de9
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A1
+  |
+  | @  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using amend as 2:4ae3a4151de9
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg up tip
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg amend -m "A2
+  > 
+  > Better better commit message"
+  $ hg amend -m "A3
+  > 
+  > Better better better commit message"
+  $ sync
+  $ hg log --hidden -G
+  @  changeset:   4:92210308515b
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A3
+  |
+  | x  changeset:   3:4f1685185907
+  |/   parent:      0:ea207398892e
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 4:92210308515b
+  |    summary:     A2
+  |
+  | x  changeset:   2:4ae3a4151de9
+  |/   parent:      0:ea207398892e
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 3:4f1685185907
+  |    summary:     A1
+  |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using amend as 2:4ae3a4151de9
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Check the output on the client
+------------------------------
+
+  $ hg obslog --patch 92210308515b
+  @  92210308515b (4) A3
+  |
+  x  4f1685185907 (3) A2
+  |    rewritten(description) as 92210308515b using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      diff -r 4f1685185907 -r 92210308515b changeset-description
+  |      --- a/changeset-description
+  |      +++ b/changeset-description
+  |      @@ -1,3 +1,3 @@
+  |      -A2
+  |      +A3
+  |
+  |      -Better better commit message
+  |      +Better better better commit message
+  |
+  |
+  x  4ae3a4151de9 (2) A1
+  |    rewritten(description) as 4f1685185907 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      diff -r 4ae3a4151de9 -r 4f1685185907 changeset-description
+  |      --- a/changeset-description
+  |      +++ b/changeset-description
+  |      @@ -1,3 +1,3 @@
+  |      -A1
+  |      +A2
+  |
+  |      -Better commit message
+  |      +Better better commit message
+  |
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,3 @@
+         -A0
+         +A1
+         +
+         +Better commit message
+  
+         diff -r 471f378eab4c -r 4ae3a4151de9 A0
+         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,1 +1,2 @@
+          A0
+         +42
+  
+  
+Check the output on the server
+------------------------------
+
+  $ hg obslog -R $TESTTMP/server --patch 92210308515b
+  o  92210308515b (2) A3
+  |
+  x  4f1685185907
+  |    rewritten(description) as 92210308515b using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, context is not local)
+  |
+  x  4ae3a4151de9 (1) A1
+  |    rewritten(description) as 4f1685185907 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, successor is unknown locally)
+  |
+  x  471f378eab4c
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, context is not local)
+  
+  $ hg obslog -R $TESTTMP/server -f --patch 92210308515b
+  o  92210308515b (2) A3
+  |
+  x  4ae3a4151de9 (1) A1
+       reworded(description) as 92210308515b using amend by test (at Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 4ae3a4151de9 -r 92210308515b changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,3 +1,3 @@
+         -A1
+         +A3
+  
+         -Better commit message
+         +Better better better commit message
+  
+  
+  $ hg obslog -R $TESTTMP/server --no-graph --patch 92210308515b
+  92210308515b (2) A3
+  4f1685185907
+    rewritten(description) as 92210308515b using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
+  4ae3a4151de9 (1) A1
+    rewritten(description) as 4f1685185907 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, successor is unknown locally)
+  471f378eab4c
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
+
+  $ hg obslog -R $TESTTMP/server --no-graph -f --patch 92210308515b
+  92210308515b (2) A3
+  4f1685185907
+    rewritten(description) as 92210308515b using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
+  4ae3a4151de9 (1) A1
+    rewritten(description) as 4f1685185907 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, successor is unknown locally)
+  471f378eab4c
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+      (No patch available, context is not local)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-content-divergent.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,344 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with content-divergence
+===================================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-divergence
+  $ cd $TESTTMP/local-divergence
+  $ mkcommit ROOT
+  $ mkcommit A0
+  $ hg amend -m "A1"
+  $ hg log --hidden -G
+  @  changeset:   2:fdf9bde5129a
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A1
+  |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 2:fdf9bde5129a
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' was rewritten as: fdf9bde5129a)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (use 'hg evolve' to update to its successor: fdf9bde5129a)
+  $ hg amend -m "A2"
+  2 new content-divergent changesets
+  $ hg log --hidden -G
+  @  changeset:   3:65b757b745b9
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  summary:     A2
+  |
+  | *  changeset:   2:fdf9bde5129a
+  |/   parent:      0:ea207398892e
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    summary:     A1
+  |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 2:fdf9bde5129a
+  |    obsolete:    reworded using amend as 3:65b757b745b9
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Actual test
+-----------
+
+Check that debugobshistory on the divergent revision show both destinations
+  $ hg obslog --hidden 471f378eab4c --patch
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+
+Check that with all option, every changeset is shown
+  $ hg obslog --hidden --all 471f378eab4c --patch
+  @  65b757b745b9 (3) A2
+  |
+  | *  fdf9bde5129a (2) A1
+  |/
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "65b757b745b9"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              },
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "fdf9bde5129a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+Check that debugobshistory on the first diverged revision show the revision
+and the diverent one
+  $ hg obslog fdf9bde5129a --patch
+  *  fdf9bde5129a (2) A1
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+
+Check that all option show all of them
+  $ hg obslog fdf9bde5129a -a --patch
+  @  65b757b745b9 (3) A2
+  |
+  | *  fdf9bde5129a (2) A1
+  |/
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that debugobshistory on the second diverged revision show the revision
+and the diverent one
+  $ hg obslog 65b757b745b9 --patch
+  @  65b757b745b9 (3) A2
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that all option show all of them
+  $ hg obslog 65b757b745b9 -a --patch
+  @  65b757b745b9 (3) A2
+  |
+  | *  fdf9bde5129a (2) A1
+  |/
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that debugobshistory on the both diverged revision show a coherent
+graph
+  $ hg obslog '65b757b745b9+fdf9bde5129a' --patch
+  @  65b757b745b9 (3) A2
+  |
+  | *  fdf9bde5129a (2) A1
+  |/
+  x  471f378eab4c (1) A0
+       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+  $ hg obslog '65b757b745b9+fdf9bde5129a' --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "65b757b745b9",
+          "rev": 3,
+          "shortdescription": "A2"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "65b757b745b9"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              },
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "fdf9bde5129a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      },
+      {
+          "markers": [],
+          "node": "fdf9bde5129a",
+          "rev": 2,
+          "shortdescription": "A1"
+      }
+  ]
+  $ hg update 471f378eab4c
+  abort: hidden revision '471f378eab4c'!
+  (use --hidden to access hidden revisions; diverged)
+  [255]
+  $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' has diverged)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (471f378eab4c has diverged, use 'hg evolve --list --content-divergent' to resolve the issue)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-fold.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,335 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with folded commit
+==============================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-fold
+  $ hg init $TESTTMP/server
+  $ cd $TESTTMP/local-fold
+  $ mkcommit ROOT
+  $ mkcommit A0
+  $ sync
+  $ mkcommit B0
+  $ hg log --hidden -G
+  @  changeset:   2:0dec01379d3b
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     B0
+  |
+  o  changeset:   1:471f378eab4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg fold --exact -r 'desc(A0) + desc(B0)' --date "0 0" -m "C0"
+  2 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --hidden -G
+  @  changeset:   3:eb5a0daa2192
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     C0
+  |
+  | x  changeset:   2:0dec01379d3b
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  obsolete:    rewritten using fold as 3:eb5a0daa2192
+  | |  summary:     B0
+  | |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using fold as 3:eb5a0daa2192
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+
+  $ sync
+Check output of the client
+--------------------------
+
+Check that debugobshistory on the first folded revision show only
+the revision with the target
+  $ hg obslog --hidden 471f378eab4c --patch
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+Check that with all option, all changesets are shown
+  $ hg obslog --hidden --all 471f378eab4c --patch
+  @    eb5a0daa2192 (3) C0
+  |\
+  x |  0dec01379d3b (2) B0
+   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        (No patch available, changesets rebased)
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+Check that debugobshistory on the second folded revision show only
+the revision with the target
+  $ hg obslog --hidden 0dec01379d3b --patch
+  x  0dec01379d3b (2) B0
+       rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, changesets rebased)
+  
+Check that with all option, all changesets are shown
+  $ hg obslog --hidden --all 0dec01379d3b --patch
+  @    eb5a0daa2192 (3) C0
+  |\
+  x |  0dec01379d3b (2) B0
+   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        (No patch available, changesets rebased)
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+Check that debugobshistory on the successor revision show a coherent
+graph
+  $ hg obslog eb5a0daa2192 --patch
+  @    eb5a0daa2192 (3) C0
+  |\
+  x |  0dec01379d3b (2) B0
+   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        (No patch available, changesets rebased)
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+  $ hg obslog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "eb5a0daa2192",
+          "rev": 3,
+          "shortdescription": "C0"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description",
+                      "content"
+                  ],
+                  "operation": "fold",
+                  "succnodes": [
+                      "eb5a0daa2192"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description",
+                      "parent",
+                      "content"
+                  ],
+                  "operation": "fold",
+                  "succnodes": [
+                      "eb5a0daa2192"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "0dec01379d3b",
+          "rev": 2,
+          "shortdescription": "B0"
+      }
+  ]
+  $ hg update 471f378eab4c
+  abort: hidden revision '471f378eab4c'!
+  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
+  [255]
+  $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192)
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (use 'hg evolve' to update to its successor: eb5a0daa2192)
+  $ hg update 0dec01379d3b
+  abort: hidden revision '0dec01379d3b'!
+  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
+  [255]
+  $ hg update --hidden 'desc(B0)'
+  updating to a hidden changeset 0dec01379d3b
+  (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (0dec01379d3b)
+  (use 'hg evolve' to update to its successor: eb5a0daa2192)
+
+Check output of the server
+--------------------------
+
+  $ hg obslog -R $TESTTMP/server --patch tip --all
+  o    eb5a0daa2192 (2) C0
+  |\
+  x |  0dec01379d3b
+   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        (No patch available, context is not local)
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+  $ hg obslog -R $TESTTMP/server -f --all --patch tip
+  o  eb5a0daa2192 (2) C0
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+
+  $ hg obslog -R $TESTTMP/server --all --patch 471f378eab4c --hidden
+  o    eb5a0daa2192 (2) C0
+  |\
+  x |  0dec01379d3b
+   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |        (No patch available, context is not local)
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
+  $ hg obslog -R $TESTTMP/server -f --all --patch 471f378eab4c --hidden
+  o  eb5a0daa2192 (2) C0
+  |
+  x  471f378eab4c (1) A0
+       rewritten(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +C0
+  
+         diff -r 471f378eab4c -r eb5a0daa2192 B0
+         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
+         @@ -0,0 +1,1 @@
+         +B0
+  
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,288 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with lots of splitted commit
+========================================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-lots-split
+  $ cd $TESTTMP/local-lots-split
+  $ mkcommit ROOT
+  $ echo 42 >> a
+  $ echo 43 >> b
+  $ echo 44 >> c
+  $ echo 45 >> d
+  $ hg commit -A -m "A0"
+  adding a
+  adding b
+  adding c
+  adding d
+  $ hg log --hidden -G
+  @  changeset:   1:de7290d8b885
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+
+  $ hg split -r 'desc(A0)' -d "0 0" << EOF
+  > y
+  > y
+  > n
+  > n
+  > n
+  > n
+  > y
+  > y
+  > n
+  > n
+  > n
+  > y
+  > y
+  > n
+  > n
+  > y
+  > y
+  > EOF
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  adding a
+  adding b
+  adding c
+  adding d
+  diff --git a/a b/a
+  new file mode 100644
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +42
+  record change 1/4 to 'a'? [Ynesfdaq?] y
+  
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] n
+  
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] n
+  
+  diff --git a/d b/d
+  new file mode 100644
+  examine changes to 'd'? [Ynesfdaq?] n
+  
+  created new head
+  Done splitting? [yN] n
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +43
+  record change 1/3 to 'b'? [Ynesfdaq?] y
+  
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] n
+  
+  diff --git a/d b/d
+  new file mode 100644
+  examine changes to 'd'? [Ynesfdaq?] n
+  
+  Done splitting? [yN] n
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +44
+  record change 1/2 to 'c'? [Ynesfdaq?] y
+  
+  diff --git a/d b/d
+  new file mode 100644
+  examine changes to 'd'? [Ynesfdaq?] n
+  
+  Done splitting? [yN] n
+  diff --git a/d b/d
+  new file mode 100644
+  examine changes to 'd'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +45
+  record this change to 'd'? [Ynesfdaq?] y
+  
+  no more change to split
+
+  $ hg log --hidden -G
+  @  changeset:   5:c7f044602e9b
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   4:1ae8bc733a14
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   3:f257fde29c7a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   2:337fec4d2edc
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  | x  changeset:   1:de7290d8b885
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    split using split as 2:337fec4d2edc, 3:f257fde29c7a, 4:1ae8bc733a14, 5:c7f044602e9b
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Actual test
+-----------
+
+  $ hg obslog de7290d8b885 --hidden --patch
+  x  de7290d8b885 (1) A0
+       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, too many successors (4))
+  
+  $ hg obslog de7290d8b885 --hidden --all --patch
+  o  1ae8bc733a14 (4) A0
+  |
+  | o  337fec4d2edc (2) A0
+  |/
+  | @  c7f044602e9b (5) A0
+  |/
+  | o  f257fde29c7a (3) A0
+  |/
+  x  de7290d8b885 (1) A0
+       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, too many successors (4))
+  
+  $ hg obslog de7290d8b885 --hidden --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "parent",
+                      "content"
+                  ],
+                  "operation": "split",
+                  "succnodes": [
+                      "1ae8bc733a14",
+                      "337fec4d2edc",
+                      "c7f044602e9b",
+                      "f257fde29c7a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "de7290d8b885",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg obslog c7f044602e9b --patch
+  @  c7f044602e9b (5) A0
+  |
+  x  de7290d8b885 (1) A0
+       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, too many successors (4))
+  
+  $ hg obslog c7f044602e9b --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "c7f044602e9b",
+          "rev": 5,
+          "shortdescription": "A0"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "parent",
+                      "content"
+                  ],
+                  "operation": "split",
+                  "succnodes": [
+                      "1ae8bc733a14",
+                      "337fec4d2edc",
+                      "c7f044602e9b",
+                      "f257fde29c7a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "de7290d8b885",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+Check that debugobshistory on all heads show a coherent graph
+  $ hg obslog 2::5 --patch
+  o  1ae8bc733a14 (4) A0
+  |
+  | o  337fec4d2edc (2) A0
+  |/
+  | @  c7f044602e9b (5) A0
+  |/
+  | o  f257fde29c7a (3) A0
+  |/
+  x  de7290d8b885 (1) A0
+       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, too many successors (4))
+  
+  $ hg obslog 5 --all --patch
+  o  1ae8bc733a14 (4) A0
+  |
+  | o  337fec4d2edc (2) A0
+  |/
+  | @  c7f044602e9b (5) A0
+  |/
+  | o  f257fde29c7a (3) A0
+  |/
+  x  de7290d8b885 (1) A0
+       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, too many successors (4))
+  
+  $ hg update de7290d8b885
+  abort: hidden revision 'de7290d8b885'!
+  (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a and 2 more)
+  [255]
+  $ hg update --hidden 'min(desc(A0))'
+  updating to a hidden changeset de7290d8b885
+  (hidden revision 'de7290d8b885' was split as: 337fec4d2edc, f257fde29c7a and 2 more)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (de7290d8b885)
+  (use 'hg evolve' to update to its tipmost successor: 337fec4d2edc, f257fde29c7a and 2 more)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-phase-divergent.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,229 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with phase-divergence
+===================================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/phase-divergence
+  $ cd $TESTTMP/phase-divergence
+  $ mkcommit ROOT
+  $ mkcommit A0
+  $ hg amend -m "A1"
+  $ hg log --hidden -G
+  @  changeset:   2:fdf9bde5129a
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A1
+  |
+  | x  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    reworded using amend as 2:fdf9bde5129a
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
+  (hidden revision '471f378eab4c' was rewritten as: fdf9bde5129a)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (471f378eab4c)
+  (use 'hg evolve' to update to its successor: fdf9bde5129a)
+  $ hg phase -p .
+  1 new phase-divergent changesets
+  $ hg log --hidden -G
+  *  changeset:   2:fdf9bde5129a
+  |  tag:         tip
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: phase-divergent
+  |  summary:     A1
+  |
+  | @  changeset:   1:471f378eab4c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Actual test
+-----------
+
+Check that debugobshistory on the divergent revision show both destinations
+  $ hg obslog --hidden 471f378eab4c --patch
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+
+Check that with all option, every changeset is shown
+  $ hg obslog --hidden --all 471f378eab4c --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "fdf9bde5129a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+Check that debugobshistory on the first diverged revision show the revision
+and the diverent one
+  $ hg obslog fdf9bde5129a --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+
+Check that all option show all of them
+  $ hg obslog fdf9bde5129a -a --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that debugobshistory on the second diverged revision show the revision
+and the diverent one
+  $ hg obslog fdf9bde5129a --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that all option show all of them
+  $ hg obslog fdf9bde5129a -a --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+Check that debugobshistory on the both diverged revision show a coherent
+graph
+  $ hg obslog 'fdf9bde5129a+fdf9bde5129a' --patch
+  *  fdf9bde5129a (2) A1
+  |
+  @  471f378eab4c (1) A0
+       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A1
+  
+  
+  $ hg obslog 'fdf9bde5129a+fdf9bde5129a' --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "fdf9bde5129a",
+          "rev": 2,
+          "shortdescription": "A1"
+      },
+      {
+          "markers": [
+              {
+                  "date": [
+                      0.0,
+                      0
+                  ],
+                  "effect": [
+                      "description"
+                  ],
+                  "operation": "amend",
+                  "succnodes": [
+                      "fdf9bde5129a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg update 471f378eab4c
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg update --hidden 'desc(A0)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-prune.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,123 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with pruned commit
+==============================
+
+Check output on the client side
+-------------------------------
+
+  $ hg init $TESTTMP/local-prune
+  $ hg init $TESTTMP/server
+  $ cd $TESTTMP/local-prune
+  $ mkcommit ROOT
+  $ mkcommit A0 # 0
+  $ mkcommit B0 # 1
+  $ sync
+  $ hg log --hidden -G
+  @  changeset:   2:0dec01379d3b
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     B0
+  |
+  o  changeset:   1:471f378eab4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg prune -r 'desc(B0)'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory now at 471f378eab4c
+  1 changesets pruned
+  $ sync
+  $ hg log --hidden -G
+  x  changeset:   2:0dec01379d3b
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  obsolete:    pruned using prune
+  |  summary:     B0
+  |
+  @  changeset:   1:471f378eab4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+
+Actual test
+-----------
+
+  $ hg obslog 'desc(B0)' --hidden --patch
+  x  0dec01379d3b (2) B0
+       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, no successors)
+  
+  $ hg obslog 'desc(B0)' --hidden --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "operation": "prune",
+                  "user": "test",
+                  "verb": "pruned"
+              }
+          ],
+          "node": "0dec01379d3b",
+          "rev": 2,
+          "shortdescription": "B0"
+      }
+  ]
+  $ hg obslog 'desc(A0)' --patch
+  @  471f378eab4c (1) A0
+  
+  $ hg obslog 'desc(A0)' --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [],
+          "node": "471f378eab4c",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+  $ hg up 1
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg up 0dec01379d3b
+  abort: hidden revision '0dec01379d3b'!
+  (use --hidden to access hidden revisions; pruned)
+  [255]
+  $ hg up --hidden -r 'desc(B0)'
+  updating to a hidden changeset 0dec01379d3b
+  (hidden revision '0dec01379d3b' is pruned)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (0dec01379d3b)
+  (use 'hg evolve' to update to its parent successor)
+
+Check output on the server side
+-------------------------------
+
+  $ hg obslog -f -R $TESTTMP/server --patch 0dec01379d3b --hidden
+  x  0dec01379d3b (2) B0
+       pruned using prune by test (at Thu Jan 01 00:00:00 1970 +0000)
+         (No patch available, no successors)
+  
+# TODO ADD amend + prune
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-obshistory-split.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,253 @@
+This test file test the various messages when accessing obsolete
+revisions.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/obshistory_setup.sh
+
+Test output with splitted commit
+================================
+
+Test setup
+----------
+
+  $ hg init $TESTTMP/local-split
+  $ hg init $TESTTMP/server
+  $ cd $TESTTMP/local-split
+  $ mkcommit ROOT
+  $ sync
+  $ echo 42 >> a
+  $ echo 43 >> b
+  $ hg commit -A -m "A0"
+  adding a
+  adding b
+  $ hg log --hidden -G
+  @  changeset:   1:471597cad322
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+  $ hg split -r 'desc(A0)' -n "testing split" -d "0 0" << EOF
+  > y
+  > y
+  > n
+  > n
+  > y
+  > y
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding a
+  adding b
+  diff --git a/a b/a
+  new file mode 100644
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +42
+  record change 1/2 to 'a'? [Ynesfdaq?] y
+  
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] n
+  
+  created new head
+  Done splitting? [yN] n
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +43
+  record this change to 'b'? [Ynesfdaq?] y
+  
+  no more change to split
+
+  $ sync
+
+  $ hg log --hidden -G
+  @  changeset:   3:f257fde29c7a
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  o  changeset:   2:337fec4d2edc
+  |  parent:      0:ea207398892e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     A0
+  |
+  | x  changeset:   1:471597cad322
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    split using split as 2:337fec4d2edc, 3:f257fde29c7a
+  |    summary:     A0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+Check output on the client side
+-------------------------------
+
+Check that debugobshistory on splitted 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)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+  $ hg obslog 471597cad322 --hidden --no-graph -Tjson | python -m json.tool
+  [
+      {
+          "markers": [
+              {
+                  "date": [
+                      *, (glob)
+                      0 (glob)
+                  ],
+                  "effect": [
+                      "parent",
+                      "content"
+                  ],
+                  "note": "testing split",
+                  "operation": "split",
+                  "succnodes": [
+                      "337fec4d2edc",
+                      "f257fde29c7a"
+                  ],
+                  "user": "test",
+                  "verb": "rewritten"
+              }
+          ],
+          "node": "471597cad322",
+          "rev": 1,
+          "shortdescription": "A0"
+      }
+  ]
+Check that debugobshistory on the first successor after split show
+the revision plus the splitted one
+  $ hg obslog 337fec4d2edc --patch
+  o  337fec4d2edc (2) A0
+  |
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+With the all option, it should show the three changesets
+  $ hg obslog --all 337fec4d2edc --patch
+  o  337fec4d2edc (2) A0
+  |
+  | @  f257fde29c7a (3) A0
+  |/
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+Check that debugobshistory on the second successor after split show
+the revision plus the splitted one
+  $ hg obslog f257fde29c7a --patch
+  @  f257fde29c7a (3) A0
+  |
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+With the all option, it should show the three changesets
+  $ hg obslog f257fde29c7a --all --patch
+  o  337fec4d2edc (2) A0
+  |
+  | @  f257fde29c7a (3) A0
+  |/
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+Obslog with all option all should also works on the splitted commit
+  $ hg obslog -a 471597cad322 --hidden --patch
+  o  337fec4d2edc (2) A0
+  |
+  | @  f257fde29c7a (3) A0
+  |/
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+Check that debugobshistory on both successors after split show
+a coherent graph
+  $ hg obslog 'f257fde29c7a+337fec4d2edc' --patch
+  o  337fec4d2edc (2) A0
+  |
+  | @  f257fde29c7a (3) A0
+  |/
+  x  471597cad322 (1) A0
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, too many successors (2))
+  
+  $ hg update 471597cad322
+  abort: hidden revision '471597cad322'!
+  (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a)
+  [255]
+  $ hg update --hidden 'min(desc(A0))'
+  updating to a hidden changeset 471597cad322
+  (hidden revision '471597cad322' was split as: 337fec4d2edc, f257fde29c7a)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (471597cad322)
+  (use 'hg evolve' to update to its tipmost successor: 337fec4d2edc, f257fde29c7a)
+
+Check output on the server side
+-------------------------------
+
+  $ hg obslog -R $TESTTMP/server --patch tip
+  o  f257fde29c7a (2) A0
+  |
+  x  471597cad322
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, context is not local)
+  
+  $ hg obslog -R $TESTTMP/server -f --patch tip
+  o  f257fde29c7a (2) A0
+  
+  $ hg obslog -R $TESTTMP/server --all --patch tip
+  o  337fec4d2edc (1) A0
+  |
+  | o  f257fde29c7a (2) A0
+  |/
+  x  471597cad322
+       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: testing split
+         (No patch available, context is not local)
+  
+  $ hg obslog -R $TESTTMP/server --all -f --patch tip
+  o  337fec4d2edc (1) A0
+  
+  o  f257fde29c7a (2) A0
+  
+  $ hg obslog -R $TESTTMP/server --no-graph -f --all --patch tip
+  f257fde29c7a (2) A0
+  471597cad322
+    rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+      note: testing split
+      (No patch available, context is not local)
+
+  $ hg obslog -R $TESTTMP/server --no-graph -f --all --patch tip
+  f257fde29c7a (2) A0
+  471597cad322
+    rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
+      note: testing split
+      (No patch available, context is not local)
--- a/tests/test-evolve-obshistory.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-obshistory.t	Thu Aug 02 01:58:44 2018 +0200
@@ -4,17 +4,7 @@
 Global setup
 ============
 
-  $ . $TESTDIR/testlib/common.sh
-  $ cat >> $HGRCPATH <<EOF
-  > [ui]
-  > interactive = true
-  > [phases]
-  > publish=False
-  > [extensions]
-  > evolve =
-  > [experimental]
-  > evolution.effect-flags = yes
-  > EOF
+  $ . $TESTDIR/testlib/obshistory_setup.sh
 
 Test simple common cases
 ========================
@@ -33,1597 +23,6 @@
   abort: working directory revision cannot be specified
   [255]
 
-Test output on amended commit
-=============================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-amend
-  $ cd $TESTTMP/local-amend
-  $ mkcommit ROOT
-  $ mkcommit A0
-  $ echo 42 >> A0
-  $ hg amend -m "A1
-  > 
-  > Better commit message"
-  $ hg log --hidden -G
-  @  changeset:   2:4ae3a4151de9
-  |  tag:         tip
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A1
-  |
-  | x  changeset:   1:471f378eab4c
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    rewritten using amend as 2:4ae3a4151de9
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-Actual test
------------
-  $ hg obslog --patch 4ae3a4151de9
-  @  4ae3a4151de9 (2) A1
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as 4ae3a4151de9 using amend by test (*) (glob)
-         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,3 @@
-         -A0
-         +A1
-         +
-         +Better commit message
-  
-         diff -r 471f378eab4c -r 4ae3a4151de9 A0
-         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -1,1 +1,2 @@
-          A0
-         +42
-  
-  
-  $ hg obslog --patch --color debug
-  @  [evolve.node|4ae3a4151de9] [evolve.rev|(2)] [evolve.short_description|A1]
-  |
-  x  [evolve.node|471f378eab4c] [evolve.rev|(1)] [evolve.short_description|A0]
-       [evolve.verb|rewritten](description, content) as [evolve.node|4ae3a4151de9] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)]
-         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
-         [diff.file_a|--- a/changeset-description]
-         [diff.file_b|+++ b/changeset-description]
-         [diff.hunk|@@ -1,1 +1,3 @@]
-         [diff.deleted|-A0]
-         [diff.inserted|+A1]
-         [diff.inserted|+]
-         [diff.inserted|+Better commit message]
-  
-         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 A0]
-         [diff.file_a|--- a/A0	Thu Jan 01 00:00:00 1970 +0000]
-         [diff.file_b|+++ b/A0	Thu Jan 01 00:00:00 1970 +0000]
-         [diff.hunk|@@ -1,1 +1,2 @@]
-          A0
-         [diff.inserted|+42]
-  
-  
-
-  $ hg obslog --no-graph --patch 4ae3a4151de9
-  4ae3a4151de9 (2) A1
-  471f378eab4c (1) A0
-    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-      diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
-      --- a/changeset-description
-      +++ b/changeset-description
-      @@ -1,1 +1,3 @@
-      -A0
-      +A1
-      +
-      +Better commit message
-  
-      diff -r 471f378eab4c -r 4ae3a4151de9 A0
-      --- a/A0	Thu Jan 01 00:00:00 1970 +0000
-      +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
-      @@ -1,1 +1,2 @@
-       A0
-      +42
-  
-
-  $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", shortdescription)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}'
-  @  A1
-  |
-  x  A0 at 0 0 by test
-  
-  $ hg obslog 4ae3a4151de9 --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "4ae3a4151de9",
-          "rev": 2,
-          "shortdescription": "A1"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description",
-                      "content"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "4ae3a4151de9"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-  $ hg obslog --hidden --patch 471f378eab4c
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,3 @@
-         -A0
-         +A1
-         +
-         +Better commit message
-  
-         diff -r 471f378eab4c -r 4ae3a4151de9 A0
-         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -1,1 +1,2 @@
-          A0
-         +42
-  
-  
-  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      *, (glob)
-                      "content"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "4ae3a4151de9"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-  $ hg update 471f378eab4c
-  abort: hidden revision '471f378eab4c'!
-  (use --hidden to access hidden revisions; successor: 4ae3a4151de9)
-  [255]
-  $ hg update --hidden "desc(A0)"
-  updating to a hidden changeset 471f378eab4c
-  (hidden revision '471f378eab4c' was rewritten as: 4ae3a4151de9)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (471f378eab4c)
-  (use 'hg evolve' to update to its successor: 4ae3a4151de9)
-
-Test output with pruned commit
-==============================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-prune
-  $ cd $TESTTMP/local-prune
-  $ mkcommit ROOT
-  $ mkcommit A0 # 0
-  $ mkcommit B0 # 1
-  $ hg log --hidden -G
-  @  changeset:   2:0dec01379d3b
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     B0
-  |
-  o  changeset:   1:471f378eab4c
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-  $ hg prune -r 'desc(B0)'
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  working directory now at 471f378eab4c
-  1 changesets pruned
-  $ hg log --hidden -G
-  x  changeset:   2:0dec01379d3b
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  obsolete:    pruned using prune
-  |  summary:     B0
-  |
-  @  changeset:   1:471f378eab4c
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-
-Actual test
------------
-
-  $ hg obslog 'desc(B0)' --hidden --patch
-  x  0dec01379d3b (2) B0
-       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, no successors)
-  
-  $ hg obslog 'desc(B0)' --hidden --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "operation": "prune",
-                  "user": "test",
-                  "verb": "pruned"
-              }
-          ],
-          "node": "0dec01379d3b",
-          "rev": 2,
-          "shortdescription": "B0"
-      }
-  ]
-  $ hg obslog 'desc(A0)' --patch
-  @  471f378eab4c (1) A0
-  
-  $ hg obslog 'desc(A0)' --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-  $ hg up 1
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg up 0dec01379d3b
-  abort: hidden revision '0dec01379d3b'!
-  (use --hidden to access hidden revisions; pruned)
-  [255]
-  $ hg up --hidden -r 'desc(B0)'
-  updating to a hidden changeset 0dec01379d3b
-  (hidden revision '0dec01379d3b' is pruned)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (0dec01379d3b)
-  (use 'hg evolve' to update to its parent successor)
-
-Test output with splitted commit
-================================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-split
-  $ cd $TESTTMP/local-split
-  $ mkcommit ROOT
-  $ echo 42 >> a
-  $ echo 43 >> b
-  $ hg commit -A -m "A0"
-  adding a
-  adding b
-  $ hg log --hidden -G
-  @  changeset:   1:471597cad322
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-  $ hg split -r 'desc(A0)' -n "testing split" -d "0 0" << EOF
-  > y
-  > y
-  > n
-  > n
-  > y
-  > y
-  > EOF
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  adding a
-  adding b
-  diff --git a/a b/a
-  new file mode 100644
-  examine changes to 'a'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +42
-  record change 1/2 to 'a'? [Ynesfdaq?] y
-  
-  diff --git a/b b/b
-  new file mode 100644
-  examine changes to 'b'? [Ynesfdaq?] n
-  
-  created new head
-  Done splitting? [yN] n
-  diff --git a/b b/b
-  new file mode 100644
-  examine changes to 'b'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +43
-  record this change to 'b'? [Ynesfdaq?] y
-  
-  no more change to split
-
-  $ hg log --hidden -G
-  @  changeset:   3:f257fde29c7a
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   2:337fec4d2edc
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  | x  changeset:   1:471597cad322
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    split using split as 2:337fec4d2edc, 3:f257fde29c7a
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-Actual test
------------
-
-Check that debugobshistory on splitted 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)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-  $ hg obslog 471597cad322 --hidden --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "parent",
-                      "content"
-                  ],
-                  "note": "testing split",
-                  "operation": "split",
-                  "succnodes": [
-                      "337fec4d2edc",
-                      "f257fde29c7a"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471597cad322",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-Check that debugobshistory on the first successor after split show
-the revision plus the splitted one
-  $ hg obslog 337fec4d2edc --patch
-  o  337fec4d2edc (2) A0
-  |
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-With the all option, it should show the three changesets
-  $ hg obslog --all 337fec4d2edc --patch
-  o  337fec4d2edc (2) A0
-  |
-  | @  f257fde29c7a (3) A0
-  |/
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-Check that debugobshistory on the second successor after split show
-the revision plus the splitted one
-  $ hg obslog f257fde29c7a --patch
-  @  f257fde29c7a (3) A0
-  |
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-With the all option, it should show the three changesets
-  $ hg obslog f257fde29c7a --all --patch
-  o  337fec4d2edc (2) A0
-  |
-  | @  f257fde29c7a (3) A0
-  |/
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-Obslog with all option all should also works on the splitted commit
-  $ hg obslog -a 471597cad322 --hidden --patch
-  o  337fec4d2edc (2) A0
-  |
-  | @  f257fde29c7a (3) A0
-  |/
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-Check that debugobshistory on both successors after split show
-a coherent graph
-  $ hg obslog 'f257fde29c7a+337fec4d2edc' --patch
-  o  337fec4d2edc (2) A0
-  |
-  | @  f257fde29c7a (3) A0
-  |/
-  x  471597cad322 (1) A0
-       rewritten(parent, content) as 337fec4d2edc, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         note: testing split
-         (No patch available, too many successors (2))
-  
-  $ hg update 471597cad322
-  abort: hidden revision '471597cad322'!
-  (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a)
-  [255]
-  $ hg update --hidden 'min(desc(A0))'
-  updating to a hidden changeset 471597cad322
-  (hidden revision '471597cad322' was split as: 337fec4d2edc, f257fde29c7a)
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (471597cad322)
-  (use 'hg evolve' to update to its tipmost successor: 337fec4d2edc, f257fde29c7a)
-
-Test output with lots of splitted commit
-========================================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-lots-split
-  $ cd $TESTTMP/local-lots-split
-  $ mkcommit ROOT
-  $ echo 42 >> a
-  $ echo 43 >> b
-  $ echo 44 >> c
-  $ echo 45 >> d
-  $ hg commit -A -m "A0"
-  adding a
-  adding b
-  adding c
-  adding d
-  $ hg log --hidden -G
-  @  changeset:   1:de7290d8b885
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-
-  $ hg split -r 'desc(A0)' -d "0 0" << EOF
-  > y
-  > y
-  > n
-  > n
-  > n
-  > n
-  > y
-  > y
-  > n
-  > n
-  > n
-  > y
-  > y
-  > n
-  > n
-  > y
-  > y
-  > EOF
-  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-  adding a
-  adding b
-  adding c
-  adding d
-  diff --git a/a b/a
-  new file mode 100644
-  examine changes to 'a'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +42
-  record change 1/4 to 'a'? [Ynesfdaq?] y
-  
-  diff --git a/b b/b
-  new file mode 100644
-  examine changes to 'b'? [Ynesfdaq?] n
-  
-  diff --git a/c b/c
-  new file mode 100644
-  examine changes to 'c'? [Ynesfdaq?] n
-  
-  diff --git a/d b/d
-  new file mode 100644
-  examine changes to 'd'? [Ynesfdaq?] n
-  
-  created new head
-  Done splitting? [yN] n
-  diff --git a/b b/b
-  new file mode 100644
-  examine changes to 'b'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +43
-  record change 1/3 to 'b'? [Ynesfdaq?] y
-  
-  diff --git a/c b/c
-  new file mode 100644
-  examine changes to 'c'? [Ynesfdaq?] n
-  
-  diff --git a/d b/d
-  new file mode 100644
-  examine changes to 'd'? [Ynesfdaq?] n
-  
-  Done splitting? [yN] n
-  diff --git a/c b/c
-  new file mode 100644
-  examine changes to 'c'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +44
-  record change 1/2 to 'c'? [Ynesfdaq?] y
-  
-  diff --git a/d b/d
-  new file mode 100644
-  examine changes to 'd'? [Ynesfdaq?] n
-  
-  Done splitting? [yN] n
-  diff --git a/d b/d
-  new file mode 100644
-  examine changes to 'd'? [Ynesfdaq?] y
-  
-  @@ -0,0 +1,1 @@
-  +45
-  record this change to 'd'? [Ynesfdaq?] y
-  
-  no more change to split
-
-  $ hg log --hidden -G
-  @  changeset:   5:c7f044602e9b
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   4:1ae8bc733a14
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   3:f257fde29c7a
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   2:337fec4d2edc
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  | x  changeset:   1:de7290d8b885
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    split using split as 2:337fec4d2edc, 3:f257fde29c7a, 4:1ae8bc733a14, 5:c7f044602e9b
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-Actual test
------------
-
-  $ hg obslog de7290d8b885 --hidden --patch
-  x  de7290d8b885 (1) A0
-       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, too many successors (4))
-  
-  $ hg obslog de7290d8b885 --hidden --all --patch
-  o  1ae8bc733a14 (4) A0
-  |
-  | o  337fec4d2edc (2) A0
-  |/
-  | @  c7f044602e9b (5) A0
-  |/
-  | o  f257fde29c7a (3) A0
-  |/
-  x  de7290d8b885 (1) A0
-       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, too many successors (4))
-  
-  $ hg obslog de7290d8b885 --hidden --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "parent",
-                      "content"
-                  ],
-                  "operation": "split",
-                  "succnodes": [
-                      "1ae8bc733a14",
-                      "337fec4d2edc",
-                      "c7f044602e9b",
-                      "f257fde29c7a"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "de7290d8b885",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-  $ hg obslog c7f044602e9b --patch
-  @  c7f044602e9b (5) A0
-  |
-  x  de7290d8b885 (1) A0
-       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, too many successors (4))
-  
-  $ hg obslog c7f044602e9b --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "c7f044602e9b",
-          "rev": 5,
-          "shortdescription": "A0"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "parent",
-                      "content"
-                  ],
-                  "operation": "split",
-                  "succnodes": [
-                      "1ae8bc733a14",
-                      "337fec4d2edc",
-                      "c7f044602e9b",
-                      "f257fde29c7a"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "de7290d8b885",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-Check that debugobshistory on all heads show a coherent graph
-  $ hg obslog 2::5 --patch
-  o  1ae8bc733a14 (4) A0
-  |
-  | o  337fec4d2edc (2) A0
-  |/
-  | @  c7f044602e9b (5) A0
-  |/
-  | o  f257fde29c7a (3) A0
-  |/
-  x  de7290d8b885 (1) A0
-       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, too many successors (4))
-  
-  $ hg obslog 5 --all --patch
-  o  1ae8bc733a14 (4) A0
-  |
-  | o  337fec4d2edc (2) A0
-  |/
-  | @  c7f044602e9b (5) A0
-  |/
-  | o  f257fde29c7a (3) A0
-  |/
-  x  de7290d8b885 (1) A0
-       rewritten(parent, content) as 1ae8bc733a14, 337fec4d2edc, c7f044602e9b, f257fde29c7a using split by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, too many successors (4))
-  
-  $ hg update de7290d8b885
-  abort: hidden revision 'de7290d8b885'!
-  (use --hidden to access hidden revisions; successors: 337fec4d2edc, f257fde29c7a and 2 more)
-  [255]
-  $ hg update --hidden 'min(desc(A0))'
-  updating to a hidden changeset de7290d8b885
-  (hidden revision 'de7290d8b885' was split as: 337fec4d2edc, f257fde29c7a and 2 more)
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (de7290d8b885)
-  (use 'hg evolve' to update to its tipmost successor: 337fec4d2edc, f257fde29c7a and 2 more)
-
-Test output with folded commit
-==============================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-fold
-  $ cd $TESTTMP/local-fold
-  $ mkcommit ROOT
-  $ mkcommit A0
-  $ mkcommit B0
-  $ hg log --hidden -G
-  @  changeset:   2:0dec01379d3b
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     B0
-  |
-  o  changeset:   1:471f378eab4c
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-  $ hg fold --exact -r 'desc(A0) + desc(B0)' --date "0 0" -m "C0"
-  2 changesets folded
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg log --hidden -G
-  @  changeset:   3:eb5a0daa2192
-  |  tag:         tip
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     C0
-  |
-  | x  changeset:   2:0dec01379d3b
-  | |  user:        test
-  | |  date:        Thu Jan 01 00:00:00 1970 +0000
-  | |  obsolete:    rewritten using fold as 3:eb5a0daa2192
-  | |  summary:     B0
-  | |
-  | x  changeset:   1:471f378eab4c
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    rewritten using fold as 3:eb5a0daa2192
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
- Actual test
- -----------
-
-Check that debugobshistory on the first folded revision show only
-the revision with the target
-  $ hg obslog --hidden 471f378eab4c --patch
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +C0
-  
-         diff -r 471f378eab4c -r eb5a0daa2192 B0
-         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -0,0 +1,1 @@
-         +B0
-  
-  
-Check that with all option, all changesets are shown
-  $ hg obslog --hidden --all 471f378eab4c --patch
-  @    eb5a0daa2192 (3) C0
-  |\
-  x |  0dec01379d3b (2) B0
-   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |        (No patch available, changesets rebased)
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +C0
-  
-         diff -r 471f378eab4c -r eb5a0daa2192 B0
-         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -0,0 +1,1 @@
-         +B0
-  
-  
-Check that debugobshistory on the second folded revision show only
-the revision with the target
-  $ hg obslog --hidden 0dec01379d3b --patch
-  x  0dec01379d3b (2) B0
-       rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-         (No patch available, changesets rebased)
-  
-Check that with all option, all changesets are shown
-  $ hg obslog --hidden --all 0dec01379d3b --patch
-  @    eb5a0daa2192 (3) C0
-  |\
-  x |  0dec01379d3b (2) B0
-   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |        (No patch available, changesets rebased)
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +C0
-  
-         diff -r 471f378eab4c -r eb5a0daa2192 B0
-         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -0,0 +1,1 @@
-         +B0
-  
-  
-Check that debugobshistory on the successor revision show a coherent
-graph
-  $ hg obslog eb5a0daa2192 --patch
-  @    eb5a0daa2192 (3) C0
-  |\
-  x |  0dec01379d3b (2) B0
-   /     rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |        (No patch available, changesets rebased)
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +C0
-  
-         diff -r 471f378eab4c -r eb5a0daa2192 B0
-         --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-         +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-         @@ -0,0 +1,1 @@
-         +B0
-  
-  
-  $ hg obslog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "eb5a0daa2192",
-          "rev": 3,
-          "shortdescription": "C0"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description",
-                      "content"
-                  ],
-                  "operation": "fold",
-                  "succnodes": [
-                      "eb5a0daa2192"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description",
-                      "parent",
-                      "content"
-                  ],
-                  "operation": "fold",
-                  "succnodes": [
-                      "eb5a0daa2192"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "0dec01379d3b",
-          "rev": 2,
-          "shortdescription": "B0"
-      }
-  ]
-  $ hg update 471f378eab4c
-  abort: hidden revision '471f378eab4c'!
-  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
-  [255]
-  $ hg update --hidden 'desc(A0)'
-  updating to a hidden changeset 471f378eab4c
-  (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192)
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  working directory parent is obsolete! (471f378eab4c)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
-  $ hg update 0dec01379d3b
-  abort: hidden revision '0dec01379d3b'!
-  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
-  [255]
-  $ hg update --hidden 'desc(B0)'
-  updating to a hidden changeset 0dec01379d3b
-  (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (0dec01379d3b)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
-
-Test output with divergence
-===========================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-divergence
-  $ cd $TESTTMP/local-divergence
-  $ mkcommit ROOT
-  $ mkcommit A0
-  $ hg amend -m "A1"
-  $ hg log --hidden -G
-  @  changeset:   2:fdf9bde5129a
-  |  tag:         tip
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A1
-  |
-  | x  changeset:   1:471f378eab4c
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    reworded using amend as 2:fdf9bde5129a
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-  $ hg update --hidden 'desc(A0)'
-  updating to a hidden changeset 471f378eab4c
-  (hidden revision '471f378eab4c' was rewritten as: fdf9bde5129a)
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (471f378eab4c)
-  (use 'hg evolve' to update to its successor: fdf9bde5129a)
-  $ hg amend -m "A2"
-  2 new content-divergent changesets
-  $ hg log --hidden -G
-  @  changeset:   3:65b757b745b9
-  |  tag:         tip
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  instability: content-divergent
-  |  summary:     A2
-  |
-  | *  changeset:   2:fdf9bde5129a
-  |/   parent:      0:ea207398892e
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    instability: content-divergent
-  |    summary:     A1
-  |
-  | x  changeset:   1:471f378eab4c
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    reworded using amend as 2:fdf9bde5129a
-  |    obsolete:    reworded using amend as 3:65b757b745b9
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-Actual test
------------
-
-Check that debugobshistory on the divergent revision show both destinations
-  $ hg obslog --hidden 471f378eab4c --patch
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-
-Check that with all option, every changeset is shown
-  $ hg obslog --hidden --all 471f378eab4c --patch
-  @  65b757b745b9 (3) A2
-  |
-  | *  fdf9bde5129a (2) A1
-  |/
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "65b757b745b9"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              },
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "fdf9bde5129a"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-Check that debugobshistory on the first diverged revision show the revision
-and the diverent one
-  $ hg obslog fdf9bde5129a --patch
-  *  fdf9bde5129a (2) A1
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-
-Check that all option show all of them
-  $ hg obslog fdf9bde5129a -a --patch
-  @  65b757b745b9 (3) A2
-  |
-  | *  fdf9bde5129a (2) A1
-  |/
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-Check that debugobshistory on the second diverged revision show the revision
-and the diverent one
-  $ hg obslog 65b757b745b9 --patch
-  @  65b757b745b9 (3) A2
-  |
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-Check that all option show all of them
-  $ hg obslog 65b757b745b9 -a --patch
-  @  65b757b745b9 (3) A2
-  |
-  | *  fdf9bde5129a (2) A1
-  |/
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-Check that debugobshistory on the both diverged revision show a coherent
-graph
-  $ hg obslog '65b757b745b9+fdf9bde5129a' --patch
-  @  65b757b745b9 (3) A2
-  |
-  | *  fdf9bde5129a (2) A1
-  |/
-  x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r 65b757b745b9 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A2
-  
-       rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 471f378eab4c -r fdf9bde5129a changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -A0
-         +A1
-  
-  
-  $ hg obslog '65b757b745b9+fdf9bde5129a' --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "65b757b745b9",
-          "rev": 3,
-          "shortdescription": "A2"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "65b757b745b9"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              },
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "fdf9bde5129a"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      },
-      {
-          "markers": [],
-          "node": "fdf9bde5129a",
-          "rev": 2,
-          "shortdescription": "A1"
-      }
-  ]
-  $ hg update 471f378eab4c
-  abort: hidden revision '471f378eab4c'!
-  (use --hidden to access hidden revisions; diverged)
-  [255]
-  $ hg update --hidden 'desc(A0)'
-  updating to a hidden changeset 471f378eab4c
-  (hidden revision '471f378eab4c' has diverged)
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (471f378eab4c)
-  (471f378eab4c has diverged, use 'hg evolve --list --content-divergent' to resolve the issue)
-
-Test output with amended + folded commit
-========================================
-
-Test setup
-----------
-
-  $ hg init $TESTTMP/local-amend-fold
-  $ cd $TESTTMP/local-amend-fold
-  $ mkcommit ROOT
-  $ mkcommit A0
-  $ mkcommit B0
-  $ hg amend -m "B1"
-  $ hg log --hidden -G
-  @  changeset:   3:b7ea6d14e664
-  |  tag:         tip
-  |  parent:      1:471f378eab4c
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     B1
-  |
-  | x  changeset:   2:0dec01379d3b
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    reworded using amend as 3:b7ea6d14e664
-  |    summary:     B0
-  |
-  o  changeset:   1:471f378eab4c
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
-  $ hg fold --exact -r 'desc(A0) + desc(B1)' --date "0 0" -m "C0"
-  2 changesets folded
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg log --hidden -G
-  @  changeset:   4:eb5a0daa2192
-  |  tag:         tip
-  |  parent:      0:ea207398892e
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     C0
-  |
-  | x  changeset:   3:b7ea6d14e664
-  | |  parent:      1:471f378eab4c
-  | |  user:        test
-  | |  date:        Thu Jan 01 00:00:00 1970 +0000
-  | |  obsolete:    rewritten using fold as 4:eb5a0daa2192
-  | |  summary:     B1
-  | |
-  | | x  changeset:   2:0dec01379d3b
-  | |/   user:        test
-  | |    date:        Thu Jan 01 00:00:00 1970 +0000
-  | |    obsolete:    reworded using amend as 3:b7ea6d14e664
-  | |    summary:     B0
-  | |
-  | x  changeset:   1:471f378eab4c
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    obsolete:    rewritten using fold as 4:eb5a0daa2192
-  |    summary:     A0
-  |
-  o  changeset:   0:ea207398892e
-     user:        test
-     date:        Thu Jan 01 00:00:00 1970 +0000
-     summary:     ROOT
-  
- Actual test
- -----------
-
-Check that debugobshistory on head show a coherent graph
-  $ hg obslog eb5a0daa2192 --patch
-  @    eb5a0daa2192 (4) C0
-  |\
-  x |  471f378eab4c (1) A0
-   /     rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |        diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-  |        --- a/changeset-description
-  |        +++ b/changeset-description
-  |        @@ -1,1 +1,1 @@
-  |        -A0
-  |        +C0
-  |
-  |        diff -r 471f378eab4c -r eb5a0daa2192 B0
-  |        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  |        +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-  |        @@ -0,0 +1,1 @@
-  |        +B0
-  |
-  |
-  x  b7ea6d14e664 (3) B1
-  |    rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |      (No patch available, changesets rebased)
-  |
-  x  0dec01379d3b (2) B0
-       rewritten(description) as b7ea6d14e664 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -B0
-         +B1
-  
-  
-Check that obslog on ROOT with all option show everything
-  $ hg obslog 1 --hidden --all --patch
-  @    eb5a0daa2192 (4) C0
-  |\
-  x |  471f378eab4c (1) A0
-   /     rewritten(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |        diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
-  |        --- a/changeset-description
-  |        +++ b/changeset-description
-  |        @@ -1,1 +1,1 @@
-  |        -A0
-  |        +C0
-  |
-  |        diff -r 471f378eab4c -r eb5a0daa2192 B0
-  |        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  |        +++ b/B0	Thu Jan 01 00:00:00 1970 +0000
-  |        @@ -0,0 +1,1 @@
-  |        +B0
-  |
-  |
-  x  b7ea6d14e664 (3) B1
-  |    rewritten(description, parent, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  |      (No patch available, changesets rebased)
-  |
-  x  0dec01379d3b (2) B0
-       rewritten(description) as b7ea6d14e664 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-         diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
-         --- a/changeset-description
-         +++ b/changeset-description
-         @@ -1,1 +1,1 @@
-         -B0
-         +B1
-  
-  
-  $ hg obslog eb5a0daa2192 --no-graph -Tjson | python -m json.tool
-  [
-      {
-          "markers": [],
-          "node": "eb5a0daa2192",
-          "rev": 4,
-          "shortdescription": "C0"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      *, (glob)
-                      *, (glob)
-                      "content"
-                  ],
-                  "operation": "fold",
-                  "succnodes": [
-                      "eb5a0daa2192"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "b7ea6d14e664",
-          "rev": 3,
-          "shortdescription": "B1"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description"
-                  ],
-                  "operation": "amend",
-                  "succnodes": [
-                      "b7ea6d14e664"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "0dec01379d3b",
-          "rev": 2,
-          "shortdescription": "B0"
-      },
-      {
-          "markers": [
-              {
-                  "date": [
-                      *, (glob)
-                      0 (glob)
-                  ],
-                  "effect": [
-                      "description",
-                      "content"
-                  ],
-                  "operation": "fold",
-                  "succnodes": [
-                      "eb5a0daa2192"
-                  ],
-                  "user": "test",
-                  "verb": "rewritten"
-              }
-          ],
-          "node": "471f378eab4c",
-          "rev": 1,
-          "shortdescription": "A0"
-      }
-  ]
-  $ hg update 471f378eab4c
-  abort: hidden revision '471f378eab4c'!
-  (use --hidden to access hidden revisions; successor: eb5a0daa2192)
-  [255]
-  $ hg update --hidden 'desc(A0)'
-  updating to a hidden changeset 471f378eab4c
-  (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192)
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  working directory parent is obsolete! (471f378eab4c)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
-  $ hg update --hidden 0dec01379d3b
-  updating to a hidden changeset 0dec01379d3b
-  (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (0dec01379d3b)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
-  $ hg update 0dec01379d3b
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg update --hidden 'desc(B0)'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-
 Test output with pushed and pulled obs markers
 ==============================================
 
@@ -1744,6 +143,20 @@
        rewritten(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
          (No patch available, successor is unknown locally)
   
+
+  $ hg obslog 7a230b46bf61 --patch -f
+  o  7a230b46bf61 (2) A2
+  |
+  @  471f378eab4c (1) A0
+       reworded(description) as 7a230b46bf61 using amend by test (at Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 471f378eab4c -r 7a230b46bf61 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -A0
+         +A2
+  
+  
   $ hg obslog 7a230b46bf61 --color=debug --patch
   o  [evolve.node|7a230b46bf61] [evolve.rev|(2)] [evolve.short_description|A2]
   |
--- a/tests/test-evolve-orphan-merge.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-orphan-merge.t	Thu Aug 02 01:58:44 2018 +0200
@@ -219,10 +219,8 @@
   atop:[11] foo to c
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo FOObar > c
   $ hg resolve -m
@@ -276,10 +274,8 @@
   atop:[13] foo to c
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foobar > c
   $ hg resolve -m
--- a/tests/test-evolve-phase-divergence.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Thu Aug 02 01:58:44 2018 +0200
@@ -787,10 +787,8 @@
   rebasing to destination parent: 8c2bb6fb44e9
   merging x
   warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg diff
   diff -r 8c2bb6fb44e9 l
--- a/tests/test-evolve-phase.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-phase.t	Thu Aug 02 01:58:44 2018 +0200
@@ -86,10 +86,8 @@
   atop:[3] b
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg diff
   diff -r 87495ea7c9ec a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-stop-contentdiv.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,217 @@
+Tests for the --stop flag for `hg evolve` command while resolving content-divergence
+==================================================================================
+
+The `--stop` flag stops the interrupted evolution and delete the state file so
+user can do other things and comeback and do evolution later on
+
+This is testing cases when `hg evolve` command is doing content-divergence resolution.
+
+Setup
+=====
+
+  $ cat >> $HGRCPATH <<EOF
+  > [alias]
+  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init stoprepo
+  $ cd stoprepo
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Creating content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+  $ echo bar > d
+  $ hg amend
+
+  $ hg up c41c793e0ef1 --hidden
+  updating to a hidden changeset c41c793e0ef1
+  (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (c41c793e0ef1)
+  (use 'hg evolve' to update to its successor: e49523854bc8)
+
+  $ echo foobar > d
+  $ hg amend
+  2 new content-divergent changesets
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[6] added d
+  with: [5] added d
+  base: [4] added d
+  merging "other" content-divergent changeset 'e49523854bc8'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 9c1631e352d9
+
+  $ hg glog --hidden
+  @  6:9c1631e352d9 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  |/    () draft
+  | x  4:c41c793e0ef1 added d
+  |/    () draft
+  o  3:ca1b80f7960a added c
+  |   () draft
+  o  2:b1661037fa25 added b
+  |   () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Content divergence with parent change which will result in conflicts while
+merging
+---------------------------------------------------------------------------
+
+  $ hg rebase -r . -d .^^^ --config extensions.rebase=
+  rebasing 6:9c1631e352d9 "added d" (tip)
+
+  $ hg glog
+  @  7:517d4375cb72 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added d
+  with: [7] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
+  updating to "local" side of the conflict: e49523854bc8
+  merging "other" content-divergent changeset '606ad96040fc'
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at 517d4375cb72
+
+  $ hg glog
+  @  7:517d4375cb72 added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+Content-divergence with parent-change which will result in conflicts while
+relocation
+---------------------------------------------------------------------------
+
+  $ echo babar > c
+  $ hg add c
+  $ hg amend
+  $ hg glog
+  @  8:8fd1c4bd144c added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | o  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg evolve --content-divergent
+  merge:[5] added d
+  with: [8] added d
+  base: [4] added d
+  rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ hg diff
+  diff -r ca1b80f7960a c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< destination: ca1b80f7960a - test: added c
+   foo
+  +=======
+  +babar
+  +>>>>>>> evolving:    8fd1c4bd144c - test: added d
+  diff -r ca1b80f7960a d
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +foobar
+
+  $ hg evolve --stop
+  stopped the interrupted evolve
+  working directory is now at ca1b80f7960a
+
+XXX: we should have preserved the wdir to be at rev 8
+  $ hg glog
+  *  8:8fd1c4bd144c added d
+  |   () draft
+  | *  5:e49523854bc8 added d
+  | |   () draft
+  | @  3:ca1b80f7960a added c
+  | |   () draft
+  | o  2:b1661037fa25 added b
+  |/    () draft
+  o  1:c7586e2a9264 added a
+  |   () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
--- a/tests/test-evolve-stop-orphan.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-stop-orphan.t	Thu Aug 02 01:58:44 2018 +0200
@@ -90,10 +90,8 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg evolve --stop
   stopped the interrupted evolve
@@ -138,10 +136,8 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg diff
   diff -r cb6a2ab625bb d
@@ -187,10 +183,8 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
   $ echo foo > d
   $ hg resolve -m
   (no more unresolved files)
@@ -240,10 +234,8 @@
   atop:[9] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg status
   M c
@@ -279,10 +271,8 @@
   atop:[9] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ echo foobar > c
   $ hg resolve -m
@@ -357,10 +347,8 @@
   atop:[13] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg evolve --stop
   stopped the interrupted evolve
--- a/tests/test-evolve-stop-phasediv.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-stop-phasediv.t	Thu Aug 02 01:58:44 2018 +0200
@@ -84,10 +84,8 @@
   rebasing to destination parent: ca1b80f7960a
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ hg evolve --stop
   stopped the interrupted evolve
--- a/tests/test-evolve-topic.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve-topic.t	Thu Aug 02 01:58:44 2018 +0200
@@ -34,12 +34,14 @@
   marked working directory as topic: foo
   $ mkcommit ccc
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit ddd
   $ mkcommit eee
   $ mkcommit fff
   $ hg topic bar
   $ mkcommit ggg
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit hhh
   $ mkcommit iii
   $ mkcommit jjj
--- a/tests/test-evolve.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-evolve.t	Thu Aug 02 01:58:44 2018 +0200
@@ -1535,10 +1535,8 @@
   atop:[38] will be evolved safely
   merging newfile
   warning: conflicts while merging newfile! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
   $ glog -r "be23044af550::" --hidden
   @  38:61abd81de026@default(draft) will be evolved safely
@@ -1557,3 +1555,41 @@
 
   $ hg status newlyadded
   A newlyadded
+
+  $ cd ..
+
+Testing bookmark movement when `hg evolve` updates to successor (issue5923)
+
+  $ hg init issue5923
+  $ cd issue5923
+  $ echo foo > a
+  $ hg ci -Aqm "added a"
+
+  $ hg log -GT "{rev}:{node|short} {desc} {bookmarks}\n"
+  @  0:f7ad41964313 added a
+  
+  $ echo bar >> a
+  $ hg amend
+
+  $ hg log -GT "{rev}:{node|short} {desc} {bookmarks}\n"
+  @  1:ab832e43dd5a added a
+  
+  $ hg up f7ad41964313 --hidden
+  updating to a hidden changeset f7ad41964313
+  (hidden revision 'f7ad41964313' was rewritten as: ab832e43dd5a)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (f7ad41964313)
+  (use 'hg evolve' to update to its successor: ab832e43dd5a)
+
+  $ hg bookmark book
+
+  $ hg evolve
+  update:[1] added a
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at ab832e43dd5a
+
+  $ hg log -GT "{rev}:{node|short} {desc} ({bookmarks})\n" --hidden
+  @  1:ab832e43dd5a added a (book)
+  
+  x  0:f7ad41964313 added a ()
+  
--- a/tests/test-issue-5720.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-issue-5720.t	Thu Aug 02 01:58:44 2018 +0200
@@ -61,10 +61,8 @@
   atop:[3] b
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
 
 Fix the conflict
   $ echo c2 > a
--- a/tests/test-minitopic.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-minitopic.t	Thu Aug 02 01:58:44 2018 +0200
@@ -147,6 +147,7 @@
   marked working directory as topic: topic_A
   $ mkcommit c_E0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push disabled
   pushing to http://localhost:$HGPORT2/
   searching for changes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-rewind.t	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,937 @@
+This test file test the rewind command in several situations.
+
+Global setup
+============
+
+  $ . $TESTDIR/testlib/common.sh
+  $ cat >> $HGRCPATH <<EOF
+  > [ui]
+  > interactive = true
+  > [phases]
+  > publish=False
+  > [extensions]
+  > evolve =
+  > EOF
+
+  $ hg init rewind-testing-base
+  $ cd rewind-testing-base
+  $ echo a > root
+  $ hg add root
+  $ hg ci -m 'c_ROOT'
+  $ echo a > A
+  $ hg add A
+  $ hg ci -m 'c_A0'
+  $ echo a > B
+  $ hg add B
+  $ hg ci -m 'c_B0'
+  $ hg log -G
+  @  changeset:   2:7e594302a05d
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+  $ cd ..
+
+Test rewinding to single changesets
+====================================
+
+  $ hg clone rewind-testing-base rewind-testing-simple-prune
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-simple-prune
+
+Prune changeset unrelated to the working copy
+---------------------------------------------
+
+Setup
+`````
+
+Update to an unrelated changeset
+
+  $ hg up 'desc("c_ROOT")'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+Prune the head
+
+  $ hg prune -r 'desc("c_B0")'
+  1 changesets pruned
+  $ hg log -G
+  o  changeset:   1:579f120ba918
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  @  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'desc("c_B0")'
+  rewinded to 1 changesets
+  $ hg debugobsolete
+  7e594302a05d3769b27be88fc3cdfd39d7498498 0 {579f120ba91885449adc92eedf48ef3569742cee} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 073989a581cf430a844192364fa37606357cbbc2 4 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog -r 'desc("c_B0")'
+  o  073989a581cf (3) c_B0
+  |
+  x  7e594302a05d (2) c_B0
+       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(meta) as 073989a581cf using rewind by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  $ hg log -G
+  o  changeset:   3:073989a581cf
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  @  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+XXX-TODO: fix the obsfate from "meta-changed as 3" to "identical" or something.
+
+  $ hg log -G --hidden
+  o  changeset:   3:073989a581cf
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  | x  changeset:   2:7e594302a05d
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    meta-changed using rewind as 3:073989a581cf
+  |    summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  @  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Other independant rewind create a different revision
+----------------------------------------------------------
+
+setup
+`````
+
+note: we use "default-date" to make it a "different rewind"
+
+  $ echo '[devel]' >> $HGRCPATH
+  $ echo 'default-date = 1 0' >> $HGRCPATH
+
+Actual rewind
+`````````````
+
+  $ hg prune 'desc("c_B0")'
+  1 changesets pruned
+  $ hg rewind --hidden --to 'min(desc("c_B0"))'
+  rewinded to 1 changesets
+  $ hg debugobsolete
+  7e594302a05d3769b27be88fc3cdfd39d7498498 0 {579f120ba91885449adc92eedf48ef3569742cee} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 073989a581cf430a844192364fa37606357cbbc2 4 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
+  073989a581cf430a844192364fa37606357cbbc2 0 {579f120ba91885449adc92eedf48ef3569742cee} (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 48acf2c0d9c8961859ce9a913671eb2adc9b057b 4 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog -r 'desc("c_B0")' --all
+  x  073989a581cf (3) c_B0
+  |    pruned using prune by test (Thu Jan 01 00:00:01 1970 +0000)
+  |
+  | o  48acf2c0d9c8 (4) c_B0
+  |/
+  x  7e594302a05d (2) c_B0
+       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(meta) as 073989a581cf using rewind by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(meta, date) as 48acf2c0d9c8 using rewind by test (Thu Jan 01 00:00:01 1970 +0000)
+  
+  $ hg log -G
+  o  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  @  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg log -G --hidden
+  o  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  summary:     c_B0
+  |
+  | x  changeset:   3:073989a581cf
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    pruned using prune
+  |    summary:     c_B0
+  |
+  | x  changeset:   2:7e594302a05d
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using rewind as 4:48acf2c0d9c8
+  |    obsolete:    meta-changed using rewind as 3:073989a581cf
+  |    summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  @  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ cd ..
+
+rewind a simple amend - creating content-divergence
+---------------------------------------------------
+
+Setup
+`````
+
+  $ hg clone rewind-testing-base rewind-testing-single-rewrite
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-single-rewrite
+  $ echo BB > B
+  $ hg amend -m 'c_B1'
+  $ hg log -G
+  @  changeset:   3:25c8f5ab0c3b
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B1
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'desc("c_B0")' --as-divergence
+  2 new content-divergent changesets
+  rewinded to 1 changesets
+  $ hg debugobsolete
+  7e594302a05d3769b27be88fc3cdfd39d7498498 25c8f5ab0c3bb569ec672570f1a901be4c6f032b 0 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 48acf2c0d9c8961859ce9a913671eb2adc9b057b 4 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog --rev 'desc("c_B0")'
+  *  48acf2c0d9c8 (4) c_B0
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(description, content) as 25c8f5ab0c3b using amend by test (Thu Jan 01 00:00:01 1970 +0000)
+       rewritten(meta, date) as 48acf2c0d9c8 using rewind by test (Thu Jan 01 00:00:01 1970 +0000)
+  
+  $ hg log -G
+  *  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_B0
+  |
+  | @  changeset:   3:25c8f5ab0c3b
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    summary:     c_B1
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg log -G --hidden
+  *  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_B0
+  |
+  | @  changeset:   3:25c8f5ab0c3b
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    summary:     c_B1
+  |
+  | x  changeset:   2:7e594302a05d
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using rewind as 4:48acf2c0d9c8
+  |    obsolete:    rewritten using amend as 3:25c8f5ab0c3b
+  |    summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Cleanup
+```````
+  $ hg prune 'max(desc("c_B0"))'
+  1 changesets pruned
+  $ hg log -G
+  @  changeset:   3:25c8f5ab0c3b
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B1
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ echo 'default-date = 2 0' >> $HGRCPATH
+
+rewind a simple amend - obsoleting the current latest successors
+----------------------------------------------------------------
+
+  $ hg rewind --hidden --to 'min(desc("c_B0"))'
+  rewinded to 1 changesets
+  (1 changesets obsoleted)
+  working directory is now at d8b4471cfb3c
+  $ hg debugobsolete
+  7e594302a05d3769b27be88fc3cdfd39d7498498 25c8f5ab0c3bb569ec672570f1a901be4c6f032b 0 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 48acf2c0d9c8961859ce9a913671eb2adc9b057b 4 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  48acf2c0d9c8961859ce9a913671eb2adc9b057b 0 {579f120ba91885449adc92eedf48ef3569742cee} (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 d8b4471cfb3caa290e0a78ae6bc57d78656c9075 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  25c8f5ab0c3bb569ec672570f1a901be4c6f032b d8b4471cfb3caa290e0a78ae6bc57d78656c9075 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '43', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog --rev 'desc("c_B0")'
+  @    d8b4471cfb3c (5) c_B0
+  |\
+  x |  25c8f5ab0c3b (3) c_B1
+  |/     rewritten(description, meta, date, content) as d8b4471cfb3c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(description, content) as 25c8f5ab0c3b using amend by test (Thu Jan 01 00:00:01 1970 +0000)
+       rewritten(meta, date) as 48acf2c0d9c8 using rewind by test (Thu Jan 01 00:00:01 1970 +0000)
+       rewritten(meta, date) as d8b4471cfb3c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   5:d8b4471cfb3c
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg log -G --hidden
+  @  changeset:   5:d8b4471cfb3c
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_B0
+  |
+  | x  changeset:   4:48acf2c0d9c8
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:01 1970 +0000
+  |    obsolete:    pruned using prune
+  |    summary:     c_B0
+  |
+  | x  changeset:   3:25c8f5ab0c3b
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using rewind as 5:d8b4471cfb3c
+  |    summary:     c_B1
+  |
+  | x  changeset:   2:7e594302a05d
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using rewind as 5:d8b4471cfb3c
+  |    obsolete:    rewritten using rewind as 4:48acf2c0d9c8
+  |    obsolete:    rewritten using amend as 3:25c8f5ab0c3b
+  |    summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ cd ..
+
+rewind a simple split
+---------------------
+
+Setup
+`````
+
+  $ hg clone rewind-testing-base rewind-testing-split-fold
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-split-fold
+
+  $ echo C > C
+  $ echo D > D
+  $ hg add C D
+  $ hg ci -m 'c_CD0'
+  $ hg split << EOF
+  > y
+  > f
+  > d
+  > y
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding C
+  adding D
+  diff --git a/C b/C
+  new file mode 100644
+  examine changes to 'C'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +C
+  record change 1/2 to 'C'? [Ynesfdaq?] f
+  
+  diff --git a/D b/D
+  new file mode 100644
+  examine changes to 'D'? [Ynesfdaq?] d
+  
+  created new head
+  Done splitting? [yN] y
+  $ hg log -G
+  @  changeset:   5:9576e80d6851
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   4:a0316c4c5417
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg debugobsolete
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
+  $ hg obslog --all
+  @  9576e80d6851 (5) c_CD0
+  |
+  | o  a0316c4c5417 (4) c_CD0
+  |/
+  x  49fb7d900906 (3) c_CD0
+       rewritten(parent, content) as 9576e80d6851, a0316c4c5417 using split by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'min(desc("c_CD0"))'
+  rewinded to 1 changesets
+  (2 changesets obsoleted)
+  working directory is now at 4535d0af405c
+  $ hg debugobsolete
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
+  9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
+  a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    4535d0af405c (6) c_CD0
+  |\
+  | \
+  | |\
+  | x |  9576e80d6851 (5) c_CD0
+  |/ /     rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  | |
+  | x  a0316c4c5417 (4) c_CD0
+  |/     rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  |
+  x  49fb7d900906 (3) c_CD0
+       rewritten(meta) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+       rewritten(parent, content) as 9576e80d6851, a0316c4c5417 using split by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   6:4535d0af405c
+  |  tag:         tip
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+rewind a fold
+-------------
+
+setup
+`````
+
+  $ echo 'default-date = 3 0' >> $HGRCPATH
+
+Actual Rewind
+`````````````
+
+  $ hg rewind --to '9576e80d6851+a0316c4c5417' --hidden
+  rewinded to 2 changesets
+  (1 changesets obsoleted)
+  working directory is now at 85be7b94f69e
+  $ hg debugobsolete
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
+  9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
+  a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'operation': 'rewind', 'user': 'test'}
+  a0316c4c54179357e71d068fb8884678ebc7c351 73a1ac2e570de1f33bbea7d8260b00d5af1d30a7 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  9576e80d6851ce79cd535e2dc5fa01b444d89a39 85be7b94f69e936d6f0fc52118211da82fe4e838 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 73a1ac2e570de1f33bbea7d8260b00d5af1d30a7 85be7b94f69e936d6f0fc52118211da82fe4e838 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '46', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog -r -2:
+  o    73a1ac2e570d (7) c_CD0
+  |\
+  +---@  85be7b94f69e (8) c_CD0
+  | | |
+  x---+  4535d0af405c (6) c_CD0
+  |\| |    rewritten(meta, date, parent, content) as 73a1ac2e570d, 85be7b94f69e using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  | | |
+  +---x  9576e80d6851 (5) c_CD0
+  | |      rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  | |      rewritten(meta, date, parent) as 85be7b94f69e using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  | |
+  | x  a0316c4c5417 (4) c_CD0
+  |/     rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  |      rewritten(meta, date) as 73a1ac2e570d using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  49fb7d900906 (3) c_CD0
+       rewritten(meta) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+       rewritten(parent, content) as 9576e80d6851, a0316c4c5417 using split by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   8:85be7b94f69e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:03 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   7:73a1ac2e570d
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:03 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ cd ..
+
+Test rewinding stack
+====================
+
+  $ hg clone rewind-testing-base rewind-testing-stack
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-stack
+
+Rewinding the top of the stack only
+-----------------------------------
+
+setup
+`````
+
+  $ hg up 'desc("c_A0")'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo AA >> A
+  $ hg amend -m 'c_A1'
+  1 new orphan changesets
+  $ hg evolve --all
+  move:[2] c_B0
+  atop:[3] c_A1
+  working directory is now at a65fceb2324a
+  $ hg debugobsolete
+  579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
+  $ hg obslog -r 'desc("c_A1")::'
+  @  a65fceb2324a (4) c_B0
+  |
+  | o  d952d1794ff6 (3) c_A1
+  | |
+  | x  579f120ba918 (1) c_A0
+  |      rewritten(description, content) as d952d1794ff6 using amend by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   4:a65fceb2324a
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   3:d952d1794ff6
+  |  parent:      0:eba9c2249fe7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A1
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'min(desc(c_B0))' --exact
+  1 new orphan changesets
+  rewinded to 1 changesets
+  (1 changesets obsoleted)
+  working directory is now at 96622b0702dd
+  $ hg debugobsolete
+  579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    96622b0702dd (5) c_B0
+  |\
+  | x  a65fceb2324a (4) c_B0
+  |/     rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+       rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   5:96622b0702dd
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:03 1970 +0000
+  |  instability: orphan
+  |  summary:     c_B0
+  |
+  | o  changeset:   3:d952d1794ff6
+  | |  parent:      0:eba9c2249fe7
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_A1
+  | |
+  x |  changeset:   1:579f120ba918
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using amend as 3:d952d1794ff6
+  |    summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Testing default argument (and cleanup)
+``````````````````````````````````````
+
+rewind with no argument should be equivalent to `--from .`
+
+  $ echo 'default-date = 4 0' >> $HGRCPATH
+  $ hg rewind --from '.'
+  rewinded to 1 changesets
+  (1 changesets obsoleted)
+  working directory is now at 7b1440274cc3
+  $ echo 'default-date = 5 0' >> $HGRCPATH
+  $ hg log -G
+  @  changeset:   6:7b1440274cc3
+  |  tag:         tip
+  |  parent:      3:d952d1794ff6
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:04 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   3:d952d1794ff6
+  |  parent:      0:eba9c2249fe7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A1
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg debugobsolete
+  579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 4 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  96622b0702dd86e3a702b0235b420da41f072efe 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 0 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    7b1440274cc3 (6) c_B0
+  |\
+  x |  96622b0702dd (5) c_B0
+  |\|    rewritten(meta, date, parent) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  | |
+  | x  a65fceb2324a (4) c_B0
+  |/     rewritten(meta, date) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  |      rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+       rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
+  
+Automatically rewinding the full stack (with --to)
+--------------------------------------------------
+
+  $ hg rewind --hidden --to 'precursors(.)'
+  rewinded to 2 changesets
+  (2 changesets obsoleted)
+  working directory is now at 70892f498f29
+  $ hg debugobsolete
+  579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 4 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  96622b0702dd86e3a702b0235b420da41f072efe 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 0 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  579f120ba91885449adc92eedf48ef3569742cee c0d232501dd8e52b8ca8a266f25db89f5120c17f 4 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  96622b0702dd86e3a702b0235b420da41f072efe 70892f498f2993d626848bb312ff856168d0b9c4 4 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 70892f498f2993d626848bb312ff856168d0b9c4 0 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  d952d1794ff657f5c2a82225d2e6307ed930b32f c0d232501dd8e52b8ca8a266f25db89f5120c17f 0 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '43', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    70892f498f29 (8) c_B0
+  |\
+  x |  7b1440274cc3 (6) c_B0
+  |\|    rewritten(meta, date, parent) as 70892f498f29 using rewind by test (Thu Jan 01 00:00:05 1970 +0000)
+  | |
+  | x  96622b0702dd (5) c_B0
+  |/|    rewritten(meta, date, parent) as 70892f498f29 using rewind by test (Thu Jan 01 00:00:05 1970 +0000)
+  | |    rewritten(meta, date, parent) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  | |
+  x |  a65fceb2324a (4) c_B0
+  |/     rewritten(meta, date) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  |      rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+       rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   8:70892f498f29
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:05 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   7:c0d232501dd8
+  |  parent:      0:eba9c2249fe7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:05 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+
+Automatically rewinding the full stack (with --from)
+----------------------------------------------------
+
+  $ echo 'default-date = 6 0' >> $HGRCPATH
+  $ hg rewind --hidden --from '.'
+  rewinded to 2 changesets
+  (2 changesets obsoleted)
+  working directory is now at 141aedbbde8f
+  $ hg debugobsolete
+  579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  a65fceb2324ae1eb1231610193d24a5fa02c7c0e 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 4 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  96622b0702dd86e3a702b0235b420da41f072efe 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 0 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  579f120ba91885449adc92eedf48ef3569742cee c0d232501dd8e52b8ca8a266f25db89f5120c17f 4 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  96622b0702dd86e3a702b0235b420da41f072efe 70892f498f2993d626848bb312ff856168d0b9c4 4 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 70892f498f2993d626848bb312ff856168d0b9c4 0 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  d952d1794ff657f5c2a82225d2e6307ed930b32f c0d232501dd8e52b8ca8a266f25db89f5120c17f 0 (Thu Jan 01 00:00:05 1970 +0000) {'ef1': '43', 'operation': 'rewind', 'user': 'test'}
+  d952d1794ff657f5c2a82225d2e6307ed930b32f 7b4aed5e99d2734da6cc25f0095876c5cb6e8084 4 (Thu Jan 01 00:00:06 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 141aedbbde8f407fc8a8a7355221733b0fc01ca5 4 (Thu Jan 01 00:00:06 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  70892f498f2993d626848bb312ff856168d0b9c4 141aedbbde8f407fc8a8a7355221733b0fc01ca5 0 (Thu Jan 01 00:00:06 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
+  c0d232501dd8e52b8ca8a266f25db89f5120c17f 7b4aed5e99d2734da6cc25f0095876c5cb6e8084 0 (Thu Jan 01 00:00:06 1970 +0000) {'ef1': '43', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    141aedbbde8f (10) c_B0
+  |\
+  x |  70892f498f29 (8) c_B0
+  |\|    rewritten(meta, date, parent) as 141aedbbde8f using rewind by test (Thu Jan 01 00:00:06 1970 +0000)
+  | |
+  | x  7b1440274cc3 (6) c_B0
+  |/|    rewritten(meta, date, parent) as 141aedbbde8f using rewind by test (Thu Jan 01 00:00:06 1970 +0000)
+  | |    rewritten(meta, date, parent) as 70892f498f29 using rewind by test (Thu Jan 01 00:00:05 1970 +0000)
+  | |
+  x |  96622b0702dd (5) c_B0
+  |\|    rewritten(meta, date, parent) as 70892f498f29 using rewind by test (Thu Jan 01 00:00:05 1970 +0000)
+  | |    rewritten(meta, date, parent) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  | |
+  | x  a65fceb2324a (4) c_B0
+  |/     rewritten(meta, date) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
+  |      rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+       rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   10:141aedbbde8f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:06 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   9:7b4aed5e99d2
+  |  parent:      0:eba9c2249fe7
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:06 1970 +0000
+  |  summary:     c_A1
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ cd ..
+
+Check error cases
+=================
+
+  $ hg clone rewind-testing-base rewind-testing-error
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-error
+
+Uncommited changes
+------------------
+
+  $ echo C > C
+  $ hg add C
+  $ hg rewind
+  abort: uncommitted changes
+  [255]
--- a/tests/test-sharing.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-sharing.t	Thu Aug 02 01:58:44 2018 +0200
@@ -505,17 +505,25 @@
   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
 
 Use evolve to fix the divergence.
-  $ HGMERGE=internal:other hg evolve --content-divergent
+  $ cat > editor.sh <<EOF
+  > #!/bin/sh
+  > cat > \$1 <<ENDOF
+  > fix bug 24 (v2 by bob)
+  > ENDOF
+  > EOF
+
+  $ HGEDITOR='sh ./editor.sh' HGMERGE=internal:other hg evolve --content-divergent
   merge:[5] fix bug 24 (v2 by bob)
   with: [6] fix bug 24 (v2 by alice)
   base: [4] fix bug 24 (v1)
+  merging "other" content-divergent changeset 'e3f99ce9d9cd'
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 5ad6037c046c
+  working directory is now at 711ede2d7a26
   $ hg log -q -r 'contentdivergent()'
 
 Figure SG10: Bob's repository after fixing divergence.
   $ hg --hidden shortlog -G -r 3::
-  @  7:5ad6037c046c  draft  fix bug 24 (v2 by bob)
+  @  7:711ede2d7a26  draft  fix bug 24 (v2 by bob)
   |
   | x  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   |/
@@ -526,7 +534,7 @@
   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   |
   ~
-  $ hg --hidden shortlog -r 'precursors(5ad6037c046c)'
+  $ hg --hidden shortlog -r 'precursors(711ede2d7a26)'
   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   $ cat file1
--- a/tests/test-split.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-split.t	Thu Aug 02 01:58:44 2018 +0200
@@ -412,6 +412,7 @@
   $ hg add babar celeste
   $ hg commit -m "Works on mytopic" babar celeste --user victor
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -r . 
   changeset:   18:26f72cfaf036
   branch:      new-branch
--- a/tests/test-stabilize-conflict.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-stabilize-conflict.t	Thu Aug 02 01:58:44 2018 +0200
@@ -128,10 +128,8 @@
   atop:[5] babar count up to ten
   merging babar
   warning: conflicts while merging babar! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
   $ hg resolve -l
   U babar
   $ hg log -G
@@ -222,10 +220,8 @@
    output file babar appears unchanged
   was merge successful (yn)? n
   merging babar failed!
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
   $ hg resolve -l
   U babar
   $ hg log -G
--- a/tests/test-stabilize-result.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-stabilize-result.t	Thu Aug 02 01:58:44 2018 +0200
@@ -81,10 +81,8 @@
   atop:[5] changea
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
-  abort: unresolved merge conflicts (see hg help resolve)
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
   $ hg revert -r "orphan()" a
   $ hg diff
   diff -r 66719795a494 a
@@ -290,20 +288,18 @@
   merge:[14] More addition
   with: [13] More addition
   base: [12] More addition
-  merging content-divergent changeset
+  merging "other" content-divergent changeset 'd2f173e25686'
   resolving manifests
   merging a
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  amending changeset eacc9c8240fe
   committing files:
   a
   committing manifest
   committing changelog
-  committed changeset 15:f344982e63c4
-  working directory is now at f344982e63c4
+  working directory is now at 4d6ed26797bc
   $ hg st
   $ glog
-  @  15:f344982e63c4@default(draft) bk:[] More addition
+  @  15:4d6ed26797bc@default(draft) bk:[] More addition
   |
   | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
@@ -316,7 +312,7 @@
   o  0:07f494440405@default(public) bk:[] adda
   
   $ hg summary
-  parent: 15:f344982e63c4 tip
+  parent: 15:4d6ed26797bc tip
    More addition
   branch: default
   commit: (clean)
@@ -327,11 +323,11 @@
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID f344982e63c462b1e44c0371c804685389e673a9
+  # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
   # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
   More addition
   
-  diff -r 7bc2f5967f5e -r f344982e63c4 a
+  diff -r 7bc2f5967f5e -r 4d6ed26797bc a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +1,9 @@
@@ -350,10 +346,10 @@
 
   $ hg up --hidden 3932c176bbaa
   updating to a hidden changeset 3932c176bbaa
-  (hidden revision '3932c176bbaa' was rewritten as: f344982e63c4)
+  (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete! (3932c176bbaa)
-  (use 'hg evolve' to update to its successor: f344982e63c4)
+  (use 'hg evolve' to update to its successor: 4d6ed26797bc)
   $ echo 'gotta break' >> a
   $ hg amend
   2 new content-divergent changesets
@@ -362,10 +358,27 @@
   $ hg phase 'contentdivergent()'
   15: draft
   17: draft
+
+  $ glog
+  @  17:0b336205a5d0@default(draft) bk:[] More addition (2)
+  |
+  | *  15:4d6ed26797bc@default(draft) bk:[] More addition
+  |/
+  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  | |
+  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
+  | |
+  | o  6:1cf0aacfd363@default(public) bk:[] newer a
+  |/
+  o  5:66719795a494@default(public) bk:[changea] changea
+  |
+  o  0:07f494440405@default(public) bk:[] adda
+  
+
   $ hg evolve -qn --content-divergent
   hg update -c 0b336205a5d0 &&
-  hg merge f344982e63c4 &&
-  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and f344982e63c4"&&
+  hg merge 4d6ed26797bc &&
+  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
   hg up -C 3932c176bbaa &&
   hg revert --all --rev tip &&
   hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
@@ -373,16 +386,62 @@
   merge:[17] More addition (2)
   with: [15] More addition
   base: [12] More addition
+  merging "other" content-divergent changeset '4d6ed26797bc'
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abort
-  abort: merge conflict between several amendments (this is not automated yet)
-  (/!\ You can try:
-  /!\ * manual merge + resolve => new cset X
-  /!\ * hg up to the parent of the amended changeset (which are named W and Z)
-  /!\ * hg revert --all -r X
-  /!\ * hg ci -m "same message as the amended changeset" => new cset Y
-  /!\ * hg prune -n Y W Z
-  )
-  [255]
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ cat > a <<EOF
+  > jungle
+  > a
+  > flore
+  > arthur
+  > zephir
+  > some
+  > less
+  > conflict
+  > babar
+  > EOF
+
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at e8746835a2a1
+  $ glog
+  @  18:e8746835a2a1@default(draft) bk:[] More addition (2)
+  |
+  | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
+  | |
+  o |  7:7bc2f5967f5e@default(draft) bk:[] add c
+  | |
+  | o  6:1cf0aacfd363@default(public) bk:[] newer a
+  |/
+  o  5:66719795a494@default(public) bk:[changea] changea
+  |
+  o  0:07f494440405@default(public) bk:[] adda
+  
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
+  # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
+  More addition (2)
+  
+  diff -r 7bc2f5967f5e -r e8746835a2a1 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,9 @@
+  +jungle
+   a
+  +flore
+  +arthur
+  +zephir
+  +some
+  +less
+  +conflict
+  +babar
--- a/tests/test-stablesort.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-stablesort.t	Thu Aug 02 01:58:44 2018 +0200
@@ -538,7 +538,7 @@
   94e0ea8cdade135dabde4ec5e9954329  D.non-heads.order
   $ python "$RUNTESTDIR/md5sum.py" *.non-heads.orderhead
   1e5ce05b507a058c5dac3d7de9ae8feb  A.non-heads.orderhead
-  1e5ce05b507a058c5dac3d7de9ae8feb  B.non-heads.orderhead
+  4b07febabfee9528aedcea156a7d7071  B.non-heads.orderhead
   1e5ce05b507a058c5dac3d7de9ae8feb  C.non-heads.orderhead
   1e5ce05b507a058c5dac3d7de9ae8feb  D.non-heads.orderhead
 
--- a/tests/test-topic-change.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-change.t	Thu Aug 02 01:58:44 2018 +0200
@@ -138,6 +138,7 @@
   $ hg topic foobar
   $ hg topic -r . --current
   active topic 'foobar' grew its first changeset
+  (see 'hg help topics' for more information)
   changed topic on 1 changes
   $ hg glog -r .
   @  20:c2d6b7df5dcf {foobar}
@@ -223,6 +224,7 @@
   $ hg topic wat
   $ hg ci --amend
   active topic 'wat' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg glog -r .
   @  28:61470c956807 {wat}
   |  Added h  ()
@@ -243,6 +245,7 @@
   marked working directory as topic: watwat
   $ hg ci --amend
   active topic 'watwat' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg glog -r .
   @  30:a24c31c35013 {watwat}
   |  Added h  ()
--- a/tests/test-topic-dest.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-dest.t	Thu Aug 02 01:58:44 2018 +0200
@@ -29,6 +29,7 @@
   $ hg add jungle
   $ hg ci -t elephant -m babar
   active topic 'elephant' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log -G
   @  4 (elephant) babar
@@ -55,6 +56,7 @@
   $ hg add jungle
   $ hg ci -t monkey -m zephir
   active topic 'monkey' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G
   @  5 (monkey) zephir
   |
--- a/tests/test-topic-flow-publish-bare.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-flow-publish-bare.t	Thu Aug 02 01:58:44 2018 +0200
@@ -116,6 +116,7 @@
   marked working directory as topic: foo
   $ mkcommit c_dF0
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -149,6 +150,7 @@
   marked working directory as topic: bar
   $ mkcommit c_dH0
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/bare-branch-server
   searching for changes
--- a/tests/test-topic-flow-publish-flag.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-flow-publish-flag.t	Thu Aug 02 01:58:44 2018 +0200
@@ -291,6 +291,7 @@
   marked working directory as topic: topic_A
   $ mkcommit c_dK0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dK0")' --publish
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -331,6 +332,7 @@
   $ hg topic topic_A
   $ mkcommit c_dL0
   active topic 'topic_A' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dL0")'
   pushing to $TESTTMP/bare-branch-server
   searching for changes
@@ -387,6 +389,7 @@
   marked working directory as topic: topic_B
   $ mkcommit c_dN0
   active topic 'topic_B' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push -r 'desc("c_dN0")' --publish
   pushing to $TESTTMP/bare-branch-server
   searching for changes
--- a/tests/test-topic-flow-single-head.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-flow-single-head.t	Thu Aug 02 01:58:44 2018 +0200
@@ -100,6 +100,7 @@
   marked working directory as topic: foo
   $ mkcommit c_dF0
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/single-head-server
   searching for changes
@@ -116,6 +117,7 @@
   marked working directory as topic: bar
   $ mkcommit c_dG0
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg push
   pushing to $TESTTMP/single-head-server
   searching for changes
--- a/tests/test-topic-fold.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-fold.t	Thu Aug 02 01:58:44 2018 +0200
@@ -40,6 +40,7 @@
   marked working directory as topic: myfeature
   $ mkcommit feature1
   active topic 'myfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit feature2
   $ logtopic
   @  2:d76a6166b18c835be9a487c5e21c7d260f0a1676
@@ -83,6 +84,7 @@
   marked working directory as topic: myotherfeature
   $ mkcommit feature4
   active topic 'myotherfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ logtopic
   @  5:5ded4d6d578c37f339b0716de2e46e12ece7cbde
   |  topics: myotherfeature
--- a/tests/test-topic-mode.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-mode.t	Thu Aug 02 01:58:44 2018 +0200
@@ -108,6 +108,7 @@
   marked working directory as topic: mytopic
   $ hg ci -m "Added a"
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc('ROOT')"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -171,6 +172,7 @@
   marked working directory as topic: mytopic
   $ hg ci -m "Added a"
   active topic 'mytopic' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc('ROOT')"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -227,6 +229,7 @@
   $ hg add A
   $ hg commit -m "Add A" --config devel.randomseed=42
   active topic 'panoramic-antelope' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc(ROOT)"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -235,6 +238,7 @@
   $ hg add B
   $ hg commit -m "Add B" --config devel.randomseed=128
   active topic 'various-dove' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Test a merge too
 
@@ -288,6 +292,7 @@
   $ hg add A
   $ hg commit -m "Add A" --config devel.randomseed=42
   active topic 'panoramic-antelope' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg up -r "desc(ROOT)"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -296,6 +301,7 @@
   $ hg add B
   $ hg commit -m "Add B" --config devel.randomseed=128
   active topic 'various-dove' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Test a merge too
 
@@ -328,3 +334,4 @@
   (branch merge, don't forget to commit)
   $ hg ci -m 'merge'  --config devel.randomseed=1337
   active topic 'omniscient-locust' grew its first changeset
+  (see 'hg help topics' for more information)
--- a/tests/test-topic-push-concurrent-on.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-push-concurrent-on.t	Thu Aug 02 01:58:44 2018 +0200
@@ -136,6 +136,7 @@
   $ hg add ddd
   $ hg commit -m 'CD'
   active topic 'babar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  4 default babar draft CD
   |
@@ -194,6 +195,7 @@
   $ hg add eee
   $ hg commit -m 'CE'
   active topic 'celeste' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  5 default celeste draft CE
   |
@@ -389,6 +391,7 @@
   marked working directory as topic: topicA
   $ hg commit -m 'CA'
   active topic 'topicA' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc(CBASE)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo aaa > bbb
@@ -397,6 +400,7 @@
   marked working directory as topic: topicB
   $ hg commit -m 'CB'
   active topic 'topicB' grew its first changeset
+  (see 'hg help topics' for more information)
   $ cd ..
   $ hg push -R repoA repoB
   pushing to repoB
--- a/tests/test-topic-push.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-push.t	Thu Aug 02 01:58:44 2018 +0200
@@ -132,6 +132,7 @@
   $ hg add ddd
   $ hg commit -m 'CD'
   active topic 'babar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  4 default babar draft CD
   |
@@ -245,6 +246,7 @@
   $ hg add eee
   $ hg commit -m 'CE'
   active topic 'celeste' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -G # keep track of phase because I saw some strange bug during developement
   @  5 default celeste draft CE
   |
@@ -440,6 +442,7 @@
   marked working directory as topic: topicA
   $ hg commit -m 'CA'
   active topic 'topicA' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc(CBASE)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo aaa > bbb
@@ -448,6 +451,7 @@
   marked working directory as topic: topicB
   $ hg commit -m 'CB'
   active topic 'topicB' grew its first changeset
+  (see 'hg help topics' for more information)
   $ cd ..
   $ hg push -R repoA repoB
   pushing to repoB
--- a/tests/test-topic-rebase.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-rebase.t	Thu Aug 02 01:58:44 2018 +0200
@@ -43,6 +43,7 @@
   marked working directory as topic: myfeature
   $ mkcommit feature1
   active topic 'myfeature' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg stack
   ### topic: myfeature
   ### target: default (branch)
@@ -109,6 +110,7 @@
   $ echo "B" >> file
   $ hg commit -m "myotherfeature1"
   active topic 'myotherfeature' grew its first changeset
+  (see 'hg help topics' for more information)
 
 Update the common file in default
   $ hg update --rev default
--- a/tests/test-topic-shelve.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-shelve.t	Thu Aug 02 01:58:44 2018 +0200
@@ -19,6 +19,7 @@
   $ hg ci -m "First commit" -A
   adding a
   active topic 'testing-shelve' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg topic
    * testing-shelve (1 changesets)
   $ echo " World" >> a
--- a/tests/test-topic-stack-data.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-stack-data.t	Thu Aug 02 01:58:44 2018 +0200
@@ -58,6 +58,7 @@
   marked working directory as topic: baz
   $ mkcommit baz_a
   active topic 'baz' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit baz_b
 
 A simple topic with unstability
@@ -68,6 +69,7 @@
   marked working directory as topic: fuz
   $ mkcommit fuz_a
   active topic 'fuz' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit fuz_b
   $ mkcommit fuz_c
   $ hg up 'desc(fuz_a)'
@@ -83,6 +85,7 @@
   marked working directory as topic: bar
   $ mkcommit bar_a
   active topic 'bar' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit bar_b
   $ mkcommit bar_c
   $ hg up 'desc(bar_b)'
@@ -102,6 +105,7 @@
   marked working directory as topic: foo
   $ mkcommit foo_a
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ mkcommit foo_b
 
 Summary
--- a/tests/test-topic-stack.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-stack.t	Thu Aug 02 01:58:44 2018 +0200
@@ -18,6 +18,7 @@
   $ hg add aaa
   $ hg commit -m c_a
   active topic 'other' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo aaa > bbb
   $ hg add bbb
   $ hg commit -m c_b
@@ -26,6 +27,7 @@
   $ hg add ccc
   $ hg commit -m c_c
   active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo aaa > ddd
   $ hg add ddd
   $ hg commit -m c_d
@@ -582,6 +584,7 @@
   $ hg commit -Am 'c_B'
   adding bbb
   active topic 'red' grew its first changeset
+  (see 'hg help topics' for more information)
   $ echo ccc > ccc
   $ hg commit -Am 'c_C'
   adding ccc
@@ -590,6 +593,7 @@
   $ hg commit -Am 'c_D'
   adding ddd
   active topic 'blue' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg up 'desc("c_B")'
   switching to topic red
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-topic-tutorial.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic-tutorial.t	Thu Aug 02 01:58:44 2018 +0200
@@ -154,6 +154,7 @@
 
   $ hg commit -m "adding condiments"
   active topic 'food' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log --graph --rev 'topic("food")'
   @  changeset:   1:13900241408b
@@ -753,6 +754,7 @@
   $ echo hammer >> shopping
   $ hg commit -m 'Adding hammer'
   active topic 'tools' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ echo saw >> shopping
   $ hg commit -m 'Adding saw'
@@ -772,6 +774,7 @@
   $ echo 'apple juice' >> shopping
   $ hg commit -m 'Adding apple juice'
   active topic 'drinks' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ echo 'orange juice' >> shopping
   $ hg commit -m 'Adding orange juice'
--- a/tests/test-topic.t	Fri Jun 08 22:52:51 2018 +0530
+++ b/tests/test-topic.t	Thu Aug 02 01:58:44 2018 +0200
@@ -278,6 +278,7 @@
   $ echo topic work >> alpha
   $ hg ci -m 'start on narf'
   active topic 'narf' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg co .^
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg topic fran
@@ -290,6 +291,7 @@
   $ echo >> fran work >> beta
   $ hg ci -m 'start on fran'
   active topic 'fran' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg co narf
   switching to topic narf
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -447,6 +449,7 @@
   marked working directory as topic: query
   $ hg ci -m 'what is narf, pinky?'
   active topic 'query' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg log -Gl2
   @  changeset:   5:c01515cfc331
   |  tag:         tip
@@ -832,10 +835,12 @@
   $ hg topic topic1990
   $ hg ci -m "Added b" --config devel.default-date="631152000 0" --user "foo"
   active topic 'topic1990' grew its first changeset
+  (see 'hg help topics' for more information)
   $ hg add c
   $ hg topic topic2010
   $ hg ci -m "Added c" --config devel.default-date="1262304000 0" --user "bar"
   active topic 'topic2010' grew its first changeset
+  (see 'hg help topics' for more information)
 
   $ hg log -G
   @  changeset:   3:76b16af75125
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/testlib/obshistory_setup.sh	Thu Aug 02 01:58:44 2018 +0200
@@ -0,0 +1,16 @@
+. $TESTDIR/testlib/common.sh
+
+cat >> $HGRCPATH <<EOF
+[ui]
+interactive = true
+[phases]
+publish=False
+[extensions]
+evolve =
+[experimental]
+evolution.effect-flags = yes
+EOF
+
+sync() {
+   hg pull -R $TESTTMP/server . -q
+}