test-compat: merge mercurial-5.2 into mercurial-5.1 mercurial-5.1
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 23 Jan 2020 17:40:51 +0700
branchmercurial-5.1
changeset 5086 553b2f2fda93
parent 4967 844c9eb2400f (current diff)
parent 5085 18d45ef90af1 (diff)
child 5087 5d76b320420e
child 5099 dd9037486a90
test-compat: merge mercurial-5.2 into mercurial-5.1
--- a/CHANGELOG	Thu Nov 28 10:48:44 2019 +0100
+++ b/CHANGELOG	Thu Jan 23 17:40:51 2020 +0700
@@ -9,10 +9,19 @@
   * rewind: preserve date
   * py3: fix setup.py --version
   * py3: fix documentation generation
+  * py3: fix some exception formatting
   * debian: allow to build with python 3
   * topic: add more options to command synopsis string
   * evolve: use more often seen metavariables in command synopsis strings
   * documentation: update text and add missing figures
+  * amend: cleany abort when both `--patch` and `--extract` are passed
+  * evolve: also merge the date field when solving content-divergence
+  * compatibility for changes in upcoming Mercurial 5.3
+  * evolve: fix content-divergence resolution when p1 is null (issue6201)
+  * evolve: make sure divergence resolution doesn't undo changes (issue6203)
+  * evolve: preserve date when resolving content-divergence (issue6202)
+  * topic: fix a bug in logic of choosing destination for hg update
+  * topic: fix a bug in logic to choose destination when no active topic
 
 9.2.1 -- 2019-10-05
 -------------------
--- a/contrib/merge-test-compat.sh	Thu Nov 28 10:48:44 2019 +0100
+++ b/contrib/merge-test-compat.sh	Thu Jan 23 17:40:51 2020 +0700
@@ -2,14 +2,24 @@
 set -euox pipefail
 
 unset GREP_OPTIONS
-NOTOPIC="--config experimental.topic-mode=ignore"
 
-compatbranches=`hg branches --quiet | grep 'mercurial-' | grep -v ':' | sort -n --reverse`
+compatbranches=$(hg branches --quiet | grep 'mercurial-' | grep -v ':' | sort -n --reverse)
 prev='stable'
+topic=${1:-'test-compat'}
 for branch in $compatbranches; do
-    hg up $branch
-    hg merge $prev
+    # Logic in the revsets below:
+    # 1. There is target topic on stable or compatibility branch: merge all
+    # those commits, they are related to our work and need to pass tests on all
+    # compatibility branches.
+    # 2. There is no target topic: avoid any commits that have topic set, they
+    # are definitely unrelated to what we're doing.
+    # In other words, if you want to test certain commits, assign them all to
+    # one topic and provide that topic as the first argument to this script.
+    uptarget="first(max(branch('$branch') and topic('$topic')) or max(branch('$branch') and not topic()))"
+    hg up -r "$uptarget"
+    hg topic "$topic"
+    mergetarget="first(max(branch('$prev') and topic('$topic')) or max(branch('$prev') and not topic()))"
+    hg merge -r "$mergetarget"
     hg commit -m "test-compat: merge $prev into $branch"
     prev=$branch
 done
-
--- a/docs/sharing.rst	Thu Nov 28 10:48:44 2019 +0100
+++ b/docs/sharing.rst	Thu Jan 23 17:40:51 2020 +0700
@@ -686,7 +686,10 @@
 
 Figure 10 shows how Bob's repository looks now.
 
-  [figure SG10: only one visible head, 7:aa82, successor to hidden 5:541f and 6:e3a5]
+.. figure:: figures/figure-sg10.svg
+
+  Figure 10: only one visible head, 7:aa82, successor to hidden 5:541f and
+  6:e3a5
 
 We carefully dodged a merge conflict by specifying a merge tool
 (``internal:other``) that will take Alice's changes over Bob's. (You
--- a/hgext3rd/evolve/__init__.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/__init__.py	Thu Jan 23 17:40:51 2020 +0700
@@ -763,7 +763,7 @@
     node = ctx.node()
     isobs = ctx.obsolete()
 
-    def warnobsolete():
+    def warnobsolete(*args):
         _warnobsoletewc(ui, repo, node, isobs)
     wlock = None
     try:
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Jan 23 17:40:51 2020 +0700
@@ -128,6 +128,8 @@
     """
     _checknotesize(ui, opts)
     opts = opts.copy()
+    if opts.get('patch') and opts.get('extract'):
+        raise error.Abort(_(b'cannot use both --patch and --extract'))
     if opts.get('patch'):
         return amendpatch(ui, repo, *pats, **opts)
     if opts.get('extract'):
--- a/hgext3rd/evolve/evolvecmd.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Jan 23 17:40:51 2020 +0700
@@ -391,7 +391,15 @@
     # the changeset on which resolution changeset will be based on
     resolutionparent = repo[divp1].node()
 
-    gca = repo.revs(b"ancestor(%d, %d)" % (otherp1, divp1))
+    # the nullrev has to be handled specially because -1 is overloaded to both
+    # mean nullrev (this meaning is used for the result of changectx.rev(), as
+    # called above) and the tipmost revision (this meaning is used for the %d
+    # format specifier, as used below)
+    if nodemod.nullrev in (otherp1, divp1):
+        # nullrev is the only possible ancestor if otherp1 or divp1 is nullrev
+        gca = [nodemod.nullrev]
+    else:
+        gca = repo.revs(b"ancestor(%d, %d)" % (otherp1, divp1))
     # divonly: non-obsolete csets which are topological ancestor of "divergent"
     # but not "other"
     divonly = repo.revs(b"only(%d, %d) - obsolete()" % (divergent.rev(),
@@ -493,6 +501,22 @@
                   % divergent))
         return (False, b".")
 
+    try:
+        succsdivp1 = utility._singlesuccessor(repo, divergent.p1())
+    except utility.MultipleSuccessorsError:
+        msg = _(b"ambiguous orphan resolution parent for %b")
+        raise error.Abort(msg % divergent.hex()[:12])
+    # relocate divergent cset to its obsolete parent's successsor
+    if succsdivp1 != divergent.p1().rev():
+        ui.status(_(b'rebasing "divergent" content-divergent changeset %s on'
+                    b' %s\n' % (divergent, repo[succsdivp1])))
+        with state.saver(evolvestate, {b'current': divergent.node()}):
+            newdivergent = relocate(repo, divergent, repo[succsdivp1],
+                                    evolvestate, keepbranch=True)
+        divergent = repo[newdivergent]
+        evolvestate[b'temprevs'].append(divergent.node())
+        evolvestate[b'divergent'] = divergent.node()
+
     # Sometimes we already have the other cset where we want it
     if relocatereq and other == divergent.p1():
         relocatereq = False
@@ -629,7 +653,17 @@
 
         mergehook(repo, base, divergent, other)
 
-        newnode = repo.commit(text=desc, user=user)
+        date = divergent.date()
+        if other.date() != divergent.date():
+            basedate = base.date()
+            if other.date() == basedate:
+                date = divergent.date()
+            elif divergent.date() == basedate:
+                date = other.date()
+            else:
+                date = max(divergent.date(), other.date())
+
+        newnode = repo.commit(text=desc, user=user, date=date)
         if newnode == divergent.node() or newnode is None:
             # no changes
             new = divergent
@@ -956,7 +990,7 @@
         if not ctx.obsolete():
             continue
 
-        successors = obsutil.successorssets(repo, ctx.node(), cache)
+        successors = obsutil.successorssets(repo, ctx.node(), cache=cache)
 
         # We can't make any assumptions about how to update the hash if the
         # cset in question was split or diverged.
@@ -1461,7 +1495,7 @@
         if n == ctx.node():
             # a node can't be a base for divergence with itself
             continue
-        nsuccsets = obsutil.successorssets(repo, n, cache)
+        nsuccsets = obsutil.successorssets(repo, n, cache=cache)
         for nsuccset in nsuccsets:
             if ctx.node() in nsuccset:
                 # we are only interested in *other* successor sets
--- a/hgext3rd/evolve/obsdiscovery.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Jan 23 17:40:51 2020 +0700
@@ -34,6 +34,12 @@
 )
 from mercurial.i18n import _
 
+try:
+    from mercurial.utils.stringutil import forcebytestr
+except ImportError:
+    # hg <= 4.5 (f99d64e8a4e4)
+    from mercurial.util import forcebytestr
+
 from . import (
     compat,
     exthelper,
@@ -447,7 +453,9 @@
                             for r in ranges:
                                 self._data.pop(r, None)
                     except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc:
-                        repo.ui.log(b'evoext-cache', b'error while updating obshashrange cache: %s' % exc)
+                        repo.ui.log(b'evoext-cache',
+                                    b'error while updating obshashrange cache: %s'
+                                    % forcebytestr(exc))
                         del self._updating
                         return
 
@@ -551,8 +559,11 @@
             if r'_con' in vars(self):
                 del self._con
             self._new.clear()
-            repo.ui.log(b'evoext-cache', b'error while saving new data: %s' % exc)
-            repo.ui.debug(b'evoext-cache: error while saving new data: %s' % exc)
+            repo.ui.log(b'evoext-cache',
+                        b'error while saving new data: %s'
+                        % forcebytestr(exc))
+            repo.ui.debug(b'evoext-cache: error while saving new data: %s'
+                          % forcebytestr(exc))
 
     def _trysave(self, repo):
         if self._con is None:
--- a/hgext3rd/evolve/rewind.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/rewind.py	Thu Jan 23 17:40:51 2020 +0700
@@ -90,7 +90,7 @@
         if not opts['as_divergence']:
             for rev in rewinded:
                 ctx = unfi[rev]
-                ssets = obsutil.successorssets(repo, ctx.node(), sscache)
+                ssets = obsutil.successorssets(repo, ctx.node(), cache=sscache)
                 if 1 < len(ssets):
                     msg = _(b'rewind confused by divergence on %s') % ctx
                     hint = _(b'solve divergence first or use "--as-divergence"')
--- a/hgext3rd/evolve/state.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/evolve/state.py	Thu Jan 23 17:40:51 2020 +0700
@@ -114,7 +114,7 @@
             repo.ui.debug(b'ignoring corrupted evolvestate (file contains %i bits)'
                           % len(versionblob))
             return None
-        version = struct._unpack(b'>I', versionblob)[0]
+        version = struct.unpack(b'>I', versionblob)[0]
         if version != 0:
             msg = _(b'unknown evolvestate version %i') % version
             raise error.Abort(msg, hint=_(b'upgrade your evolve'))
@@ -125,7 +125,7 @@
         while off < end:
             rtype = data[off]
             off += 1
-            length = struct._unpack(b'>I', data[off:(off + 4)])[0]
+            length = struct.unpack(b'>I', data[off:(off + 4)])[0]
             off += 4
             record = data[off:(off + length)]
             off += length
--- a/hgext3rd/pullbundle.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/pullbundle.py	Thu Jan 23 17:40:51 2020 +0700
@@ -392,7 +392,7 @@
         if filematcher is not None:
             cgstream = changegroup.makestream(repo, outgoing, version, source,
                                               bundlecaps=bundlecaps,
-                                              filematcher=filematcher)
+                                              matcher=filematcher)
         else:
             cgstream = changegroup.makestream(repo, outgoing, version, source,
                                               bundlecaps=bundlecaps)
--- a/hgext3rd/topic/destination.py	Thu Nov 28 10:48:44 2019 +0100
+++ b/hgext3rd/topic/destination.py	Thu Jan 23 17:40:51 2020 +0700
@@ -10,6 +10,7 @@
 from . import (
     common,
     topicmap,
+    constants,
 )
 from .evolvebits import builddependencies
 
@@ -68,11 +69,14 @@
     topic = repo.currenttopic
     if topic:
         revs = repo.revs(b'.::topic(%s)', topic)
-    else:
+    elif constants.extrakey in repo[b'.'].extra():
         revs = []
-    if not revs:
+    else:
         return None, None, None
-    node = revs.last()
+    if revs:
+        node = revs.last()
+    else:
+        node = repo[b'.'].node()
     if bookmarks.isactivewdirparent(repo):
         movemark = repo[b'.'].node()
     return node, movemark, None
--- a/tests/test-amend.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-amend.t	Thu Jan 23 17:40:51 2020 +0700
@@ -165,3 +165,8 @@
    -i --interactive         use interactive mode
   
   (some details hidden, use --verbose to show complete help)
+
+Check that we abort if --patch and --extract both are used at once
+  $ hg amend --patch --extract
+  abort: cannot use both --patch and --extract
+  [255]
--- a/tests/test-evolve-content-divergent-corner-cases.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-evolve-content-divergent-corner-cases.t	Thu Jan 23 17:40:51 2020 +0700
@@ -270,45 +270,22 @@
   o  0:9092f1db7931 added a
       () [default] draft
 
-  $ hg evolve --content-divergent --any --update
+  $ hg evolve --content-divergent --any --update --config ui.interactive=true <<EOF
+  > c
+  > EOF
   merge:[5] updated e
   with: [6] updated e
   base: [4] added e
-  rebasing "other" content-divergent changeset de4ea3103326 on 9150fe93bec6
-  merging d
-  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  unresolved merge conflicts
-  (see 'hg help evolve.interrupted')
-  [1]
-
-  $ hg diff --no-git --config diff.unified=3
-  diff -r 9150fe93bec6 d
-  --- a/d	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
-  @@ -1,1 +1,5 @@
-  +<<<<<<< destination: 9150fe93bec6 - test: added d
-   d
-  +=======
-  +dd
-  +>>>>>>> evolving:    de4ea3103326 - test: updated e
-  diff -r 9150fe93bec6 e
-  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/e	Thu Jan 01 00:00:00 1970 +0000
-  @@ -0,0 +1,1 @@
-  +ee
-
-  $ echo dresolved > d
-  $ hg res -m
-  (no more unresolved files)
-  continue: hg evolve --continue
-
-  $ hg evolve --continue
-  evolving 6:de4ea3103326 "updated e"
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 83b1664a580f
+  rebasing "divergent" content-divergent changeset ff6f7cd76a7c on 155349b645be
+  rebasing "other" content-divergent changeset de4ea3103326 on 155349b645be
+  file 'd' was deleted in local but was modified in other.
+  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
+  What do you want to do? c
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  working directory is now at eb6357cd41b6
 
   $ hg glog -l1
-  @  8:83b1664a580f updated e
+  @  9:eb6357cd41b6 updated e
   |   () [default] draft
   ~
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-first-changeset.t	Thu Jan 23 17:40:51 2020 +0700
@@ -0,0 +1,41 @@
+  $ . $TESTDIR/testlib/pythonpath.sh
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "evolve=" >> $HGRCPATH
+
+This test file tests the case of content-divergence resolution of changesets
+that have the null revision as the parent.
+
+  $ hg init issue6201
+  $ cd issue6201
+
+  $ touch test
+  $ hg add test
+  $ hg commit -m test
+  $ hg log -T '{node|short}\n'
+  be090ea66256
+
+  $ echo a >> test
+  $ hg amend -m div1
+  $ hg log -T '{node|short}\n'
+  79fa0eb22d65
+
+  $ hg up be090ea66256 --hidden --quiet
+  updated to hidden changeset be090ea66256
+  (hidden revision 'be090ea66256' was rewritten as: 79fa0eb22d65)
+  working directory parent is obsolete! (be090ea66256)
+  $ echo a >> test
+  $ echo b >> test
+  $ hg amend -m div2
+  2 new content-divergent changesets
+  $ hg log -T '{node|short}\n'
+  4b2524b7508e
+  79fa0eb22d65
+
+  $ hg evolve --content-divergent --tool :other
+  merge:[1] div1
+  with: [2] div2
+  base: [0] test
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 12772224141b
+
+  $ hg evolve --list
--- a/tests/test-evolve-content-divergent-interrupted.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-evolve-content-divergent-interrupted.t	Thu Jan 23 17:40:51 2020 +0700
@@ -195,6 +195,7 @@
   merge:[5] added d
   with: [7] added d
   base: [4] added d
+  rebasing "divergent" content-divergent changeset e49523854bc8 on ddcf04e1458c
   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
@@ -203,6 +204,7 @@
   [1]
 
   $ hg evolve --abort
+  1 new orphan changesets
   2 new content-divergent changesets
   evolve aborted
   working directory is now at 491e10505bae
--- a/tests/test-evolve-content-divergent-stack.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-evolve-content-divergent-stack.t	Thu Jan 23 17:40:51 2020 +0700
@@ -147,23 +147,26 @@
   merge:[6] added b
   with: [10] added b
   base: [2] added b
+  rebasing "divergent" content-divergent changeset d5f148423c16 on f66f262fff6c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   merge:[7] added c
   with: [11] added c
   base: [3] added c
+  rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on eadfd9d70680
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   merge:[8] added d
   with: [12] added d
   base: [4] added d
+  rebasing "divergent" content-divergent changeset c72d2885eb51 on b2cac10f3836
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at f66f262fff6c
 
   $ hg glog
-  o  16:038fe7db3d88 added d
+  o  19:038fe7db3d88 added d
   |   () [default] draft
-  o  15:b2cac10f3836 added c
+  o  17:b2cac10f3836 added c
   |   () [default] draft
-  o  14:eadfd9d70680 added b
+  o  15:eadfd9d70680 added b
   |   () [default] draft
   @  13:f66f262fff6c watbar to a
   |   () [default] draft
@@ -315,26 +318,29 @@
   merge:[11] added b
   with: [6] added b
   base: [2] added b
-  rebasing "other" content-divergent changeset d5f148423c16 on c04ff147ef79
+  rebasing "divergent" content-divergent changeset 6eb54b5af3fb on 74fbf3e6a0b6
+  rebasing "other" content-divergent changeset d5f148423c16 on 74fbf3e6a0b6
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   merge:[12] added c
   with: [7] added c
   base: [3] added c
-  rebasing "other" content-divergent changeset 3ce4be6d8e5e on 6eb54b5af3fb
+  rebasing "divergent" content-divergent changeset 8ed612937375 on 4e29776e83a5
+  rebasing "other" content-divergent changeset 3ce4be6d8e5e on 4e29776e83a5
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   merge:[13] added d
   with: [8] added d
   base: [4] added d
-  rebasing "other" content-divergent changeset c72d2885eb51 on 8ed612937375
+  rebasing "divergent" content-divergent changeset d45f050514c2 on 77126af93a25
+  rebasing "other" content-divergent changeset c72d2885eb51 on 77126af93a25
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at 74fbf3e6a0b6
 
   $ hg glog
-  o  21:5f7a38bdb75c added d
+  o  24:c8f73c376a6e added d
   |   () [default] draft
-  o  19:9865d598f0e0 added c
+  o  21:77126af93a25 added c
   |   () [default] draft
-  o  17:ac70b8c8eb63 added b
+  o  18:4e29776e83a5 added b
   |   () [default] draft
   @  15:74fbf3e6a0b6 watbar to a
   |   () [default] draft
@@ -343,3 +349,278 @@
   o  0:8fa14d15e168 added hgignore
       () [default] draft
   $ cd ..
+
+Make sure that content-divergent resolution doesn't undo a change (issue6203)
+-----------------------------------------------------------------------------
+
+  $ hg init issue6203
+  $ cd issue6203
+  $ echo a > a; hg add a; hg ci -m a
+  $ echo 'b with typo' > b; hg add b; hg ci -m b
+  $ echo c > c; hg add c; hg ci -m c
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] b
+  $ echo 'b without typo' > b
+  $ hg amend
+  1 new orphan changesets
+  $ hg evolve
+  move:[2] c
+  atop:[3] b
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d; hg add d; hg ci -m d
+  created new head
+  $ hg rebase --hidden --config experimental.evolution.allowdivergence=True -s 1 -d 5
+  rebasing 1:d420a663b65e "b"
+  rebasing 2:49f182e7a6cc "c"
+  4 new content-divergent changesets
+  $ hg log -G -v --patch
+  *  changeset:   7:ef4885dea3da
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  files:       c
+  |  description:
+  |  c
+  |
+  |
+  |  diff -r fe788ccf5416 -r ef4885dea3da c
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  *  changeset:   6:fe788ccf5416
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  files:       b
+  |  description:
+  |  b
+  |
+  |
+  |  diff -r 980f7dc84c29 -r fe788ccf5416 b
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +b with typo
+  |
+  @  changeset:   5:980f7dc84c29
+  |  parent:      0:cb9a9f314b8b
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  files:       d
+  |  description:
+  |  d
+  |
+  |
+  |  diff -r cb9a9f314b8b -r 980f7dc84c29 d
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +d
+  |
+  | *  changeset:   4:fef59171875e
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  instability: content-divergent
+  | |  files:       c
+  | |  description:
+  | |  c
+  | |
+  | |
+  | |  diff -r 5b2d00df9c4e -r fef59171875e c
+  | |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  | |  @@ -0,0 +1,1 @@
+  | |  +c
+  | |
+  | *  changeset:   3:5b2d00df9c4e
+  |/   parent:      0:cb9a9f314b8b
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    files:       b
+  |    description:
+  |    b
+  |
+  |
+  |    diff -r cb9a9f314b8b -r 5b2d00df9c4e b
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +b without typo
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     files:       a
+     description:
+     a
+  
+  
+     diff -r 000000000000 -r cb9a9f314b8b a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+  
+
+  $ hg evolve --content-divergent
+  merge:[6] b
+  with: [3] b
+  base: [1] b
+  rebasing "other" content-divergent changeset 5b2d00df9c4e on 980f7dc84c29
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[7] c
+  with: [4] c
+  base: [2] c
+  rebasing "divergent" content-divergent changeset ef4885dea3da on 0999c349998d
+  rebasing "other" content-divergent changeset fef59171875e on 0999c349998d
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Expected result:
+Changeset with description "b" only adds file "b" with content "b without typo".
+Changeset with description "c" only adds file "c" with content "c".
+
+  $ hg glog -l2 -p
+  o  12:4ca627f76da9 c
+  |   () [default] draftdiff -r 0999c349998d -r 4ca627f76da9 c
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  o  9:0999c349998d b
+  |   () [default] draftdiff -r 980f7dc84c29 -r 0999c349998d b
+  ~  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b without typo
+  
+  $ cd ..
+
+Testing case when resolution parent is ambiguous (MultipleSuccessorsError)
+--------------------------------------------------------------------------
+
+  $ hg init multiplesuccs1
+  $ cd multiplesuccs1
+  $ echo base > base
+  $ hg ci -Aqm "added base"
+  $ echo foo > foo
+  $ hg ci -Aqm "added foo"
+  $ echo bar > bar; echo car > car
+  $ hg ci -Aqm "added bar and car"
+  $ echo dar > dar
+  $ hg ci -Aqm "added dar"
+
+  $ cd ..
+  $ hg clone multiplesuccs1 multiplesuccs2
+  updating to branch default
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd multiplesuccs2
+  $ hg up -r "desc('added foo')"
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo newfoo > foo
+  $ hg amend
+  2 new orphan changesets
+  $ hg evolve
+  move:[2] added bar and car
+  atop:[4] added foo
+  move:[3] added dar
+
+  $ cd ../multiplesuccs1
+  $ hg up -r "desc('added base')"
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ echo tuna > tuna
+  $ hg ci -Aqm "added tuna"
+  $ hg rebase -s "desc('added foo')" -d .
+  rebasing 1:8da7bbaea4f7 "added foo"
+  rebasing 2:7f4b97b13607 "added bar and car"
+  rebasing 3:9f12b2fcb3de "added dar"
+
+  $ cd ../multiplesuccs2
+  $ hg pull
+  pulling from $TESTTMP/multiplesuccs1
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 1 changes to 5 files (+1 heads)
+  3 new obsolescence markers
+  6 new content-divergent changesets
+  new changesets 9703820a7d5b:9a1f460df8b5 (4 drafts)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ hg glog
+  *  10:9a1f460df8b5 added dar
+  |   () [default] draft
+  *  9:7dd5b9d42ef3 added bar and car
+  |   () [default] draft
+  *  8:afd8b2ea1b77 added foo
+  |   () [default] draft
+  o  7:9703820a7d5b added tuna
+  |   () [default] draft
+  | *  6:57a3f8edf065 added dar
+  | |   () [default] draft
+  | *  5:f4ed107810a7 added bar and car
+  | |   () [default] draft
+  | @  4:8a2d93492f59 added foo
+  |/    () [default] draft
+  o  0:bde1d2b6b5e5 added base
+      () [default] draft
+
+  $ hg evolve -r 4+5 --content-divergent
+  merge:[8] added foo
+  with: [4] added foo
+  base: [1] added foo
+  rebasing "other" content-divergent changeset 8a2d93492f59 on 9703820a7d5b
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[9] added bar and car
+  with: [5] added bar and car
+  base: [2] added bar and car
+  rebasing "divergent" content-divergent changeset 7dd5b9d42ef3 on 8ef6ad88580d
+  rebasing "other" content-divergent changeset f4ed107810a7 on 8ef6ad88580d
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  2 new orphan changesets
+  working directory is now at 8ef6ad88580d
+
+  $ hg glog
+  o  15:09ba686a465e added bar and car
+  |   () [default] draft
+  @  12:8ef6ad88580d added foo
+  |   () [default] draft
+  | *  10:9a1f460df8b5 added dar
+  | |   () [default] draft
+  | x  9:7dd5b9d42ef3 added bar and car
+  | |   () [default] draft
+  | x  8:afd8b2ea1b77 added foo
+  |/    () [default] draft
+  o  7:9703820a7d5b added tuna
+  |   () [default] draft
+  | *  6:57a3f8edf065 added dar
+  | |   () [default] draft
+  | x  5:f4ed107810a7 added bar and car
+  | |   () [default] draft
+  | x  4:8a2d93492f59 added foo
+  |/    () [default] draft
+  o  0:bde1d2b6b5e5 added base
+      () [default] draft
+
+  $ echo bar > bar; hg ci -Aqm "added bar"
+  $ echo car > car; hg ci -Aqm "added car"
+  $ hg prune --split -s 16+17 -r 15
+  1 changesets pruned
+
+  $ hg evolve --content-divergent
+  skipping 57a3f8edf065: have a different parent than 9a1f460df8b5 (not handled yet)
+  | 57a3f8edf065, 9a1f460df8b5 are not based on the same changeset.
+  | With the current state of its implementation, 
+  | evolve does not work in that case.
+  | rebase one of them next to the other and run 
+  | this command again.
+  | - either: hg rebase --dest 'p1(57a3f8edf065)' -r 9a1f460df8b5
+  | - or:     hg rebase --dest 'p1(9a1f460df8b5)' -r 57a3f8edf065
--- a/tests/test-evolve-issue5958.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-evolve-issue5958.t	Thu Jan 23 17:40:51 2020 +0700
@@ -22,6 +22,8 @@
 (Make changes in unrelated files so that we don't have any merge conflicts
 during the rebase, but the two touched revisions aren't identical)
 
+date: updated on both side to the same value
+
   $ echo hi > bar.txt
   $ hg add -q bar.txt
   $ hg amend -q
@@ -79,10 +81,176 @@
        rewritten(date) as 0065551bd38f using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
        rewritten(date) as c17bf400a278 using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
   
+  $ hg evolve --list --rev .
+  08bc7ba82799: add foo.txt
+    content-divergent: c17bf400a278 (draft) (precursor cc71ffbc7c00)
+  
+  $ hg log --hidden -r cc71ffbc7c00 -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  1 cc71ffbc7c00 1970-01-01 00:00 +0000: date-changed using metaedit as 4:c17bf400a278; date-changed using metaedit as 2:0065551bd38f
+  $ hg log -r 'desc("add foo.txt")' -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  4 c17bf400a278 1969-12-31 23:59 -0000: 
+  6 08bc7ba82799 1969-12-31 23:59 -0000: 
   $ hg evolve --content-divergent
   merge:[6] add foo.txt
   with: [4] add foo.txt
   base: [1] add foo.txt
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   1 new orphan changesets
-  working directory is now at 2372e6d39855
+  working directory is now at 459c64f7eaad
+  $ hg log -r 'desc("add foo.txt")' -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  4 c17bf400a278 1969-12-31 23:59 -0000: rewritten using evolve as 7:459c64f7eaad
+  7 459c64f7eaad 1969-12-31 23:59 -0000: 
+
+date: updated one one side to an older value
+
+  $ hg evolve -r .
+  move:[7] add foo.txt
+  atop:[0] add r0
+  working directory is now at 545776b4e79f
+  $ hg update --hidden --rev 'predecessors(.)'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 459c64f7eaad
+  (hidden revision '459c64f7eaad' was rewritten as: 545776b4e79f)
+  working directory parent is obsolete! (459c64f7eaad)
+  (use 'hg evolve' to update to its successor: 545776b4e79f)
+  $ hg amend --date "0 3"
+  1 new orphan changesets
+  2 new content-divergent changesets
+  $ hg rebase -r . -d 0
+  rebasing 9:c117f15338e6 "add foo.txt" (tip)
+  $ hg log -G
+  @  changeset:   10:7a09c7a39546
+  |  tag:         tip
+  |  parent:      0:a24ed8ad918c
+  |  user:        test
+  |  date:        Wed Dec 31 23:59:57 1969 -0000
+  |  instability: content-divergent
+  |  summary:     add foo.txt
+  |
+  | *  changeset:   8:545776b4e79f
+  |/   parent:      0:a24ed8ad918c
+  |    user:        test
+  |    date:        Wed Dec 31 23:59:58 1969 -0000
+  |    instability: content-divergent
+  |    summary:     add foo.txt
+  |
+  o  changeset:   0:a24ed8ad918c
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add r0
+  
+  $ hg evolve --list -r .
+  7a09c7a39546: add foo.txt
+    content-divergent: 545776b4e79f (draft) (precursor 459c64f7eaad)
+  
+  $ hg log -r 459c64f7eaad+7a09c7a39546+545776b4e79f --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  7 459c64f7eaad 1969-12-31 23:59 -0000: date-changed using amend as 9:c117f15338e6; rebased using evolve as 8:545776b4e79f
+  10 7a09c7a39546 1969-12-31 23:59 -0000: 
+  8 545776b4e79f 1969-12-31 23:59 -0000: 
+  $ hg evolve --content-divergent
+  merge:[8] add foo.txt
+  with: [10] add foo.txt
+  base: [7] add foo.txt
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 39c4200c0d94
+  $ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  11 39c4200c0d94 1969-12-31 23:59 -0000: 
+
+date: updated one side to an newer value
+
+  $ hg update --hidden --rev 'predecessors(.)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 7a09c7a39546
+  (hidden revision '7a09c7a39546' was rewritten as: 39c4200c0d94)
+  working directory parent is obsolete! (7a09c7a39546)
+  (use 'hg evolve' to update to its successor: 39c4200c0d94)
+  $ hg amend --date "120 0"
+  2 new content-divergent changesets
+  $ hg log -G
+  @  changeset:   12:da3be3d72fe2
+  |  tag:         tip
+  |  parent:      0:a24ed8ad918c
+  |  user:        test
+  |  date:        Thu Jan 01 00:02:00 1970 +0000
+  |  instability: content-divergent
+  |  summary:     add foo.txt
+  |
+  | *  changeset:   11:39c4200c0d94
+  |/   parent:      0:a24ed8ad918c
+  |    user:        test
+  |    date:        Wed Dec 31 23:59:57 1969 -0000
+  |    instability: content-divergent
+  |    summary:     add foo.txt
+  |
+  o  changeset:   0:a24ed8ad918c
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add r0
+  
+  $ hg evolve --list -r .
+  da3be3d72fe2: add foo.txt
+    content-divergent: 39c4200c0d94 (draft) (precursor 7a09c7a39546)
+  
+  $ hg up 39c4200c0d94
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -r 7a09c7a39546+39c4200c0d94+da3be3d72fe2 --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  10 7a09c7a39546 1969-12-31 23:59 -0000: date-changed using amend as 12:da3be3d72fe2; rewritten using evolve as 11:39c4200c0d94
+  11 39c4200c0d94 1969-12-31 23:59 -0000: 
+  12 da3be3d72fe2 1970-01-01 00:02 +0000: 
+  $ hg evolve --content-divergent
+  merge:[11] add foo.txt
+  with: [12] add foo.txt
+  base: [10] add foo.txt
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 06cde6010a51
+  $ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  13 06cde6010a51 1970-01-01 00:02 +0000: 
+
+date: updated each side to a different value, newer should win
+
+  $ hg amend --date "235 0"
+  $ hg update --hidden --rev 'predecessors(.)'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 06cde6010a51
+  (hidden revision '06cde6010a51' was rewritten as: a7412ff9bfb3)
+  working directory parent is obsolete! (06cde6010a51)
+  (use 'hg evolve' to update to its successor: a7412ff9bfb3)
+  $ hg amend --date "784 0"
+  2 new content-divergent changesets
+  $ hg log -G
+  @  changeset:   15:e3077936ec52
+  |  tag:         tip
+  |  parent:      0:a24ed8ad918c
+  |  user:        test
+  |  date:        Thu Jan 01 00:13:04 1970 +0000
+  |  instability: content-divergent
+  |  summary:     add foo.txt
+  |
+  | *  changeset:   14:a7412ff9bfb3
+  |/   parent:      0:a24ed8ad918c
+  |    user:        test
+  |    date:        Thu Jan 01 00:03:55 1970 +0000
+  |    instability: content-divergent
+  |    summary:     add foo.txt
+  |
+  o  changeset:   0:a24ed8ad918c
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add r0
+  
+  $ hg evolve --list -r .
+  e3077936ec52: add foo.txt
+    content-divergent: a7412ff9bfb3 (draft) (precursor 06cde6010a51)
+  
+  $ hg log -r 39c4200c0d94+a7412ff9bfb3+e3077936ec52 --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  11 39c4200c0d94 1969-12-31 23:59 -0000: date-changed using evolve as 13:06cde6010a51
+  14 a7412ff9bfb3 1970-01-01 00:03 +0000: 
+  15 e3077936ec52 1970-01-01 00:13 +0000: 
+  $ hg evolve --content-divergent
+  merge:[14] add foo.txt
+  with: [15] add foo.txt
+  base: [13] add foo.txt
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 1a39f3901288
+  $ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
+  16 1a39f3901288 1970-01-01 00:13 +0000: 
--- a/tests/test-topic-dest.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-topic-dest.t	Thu Jan 23 17:40:51 2020 +0700
@@ -500,3 +500,32 @@
   pick 38eea8439aee 14 arthur
   pick 411315c48bdc 15 pompadour
   #  p, pick = use commit
+
+  $ cd ..
+
+destination check: when active topic is empty
+
+  $ hg init emptytopic
+  $ cd emptytopic
+  $ echo a > a
+  $ hg ci -Am "added a"
+  adding a
+  $ hg topic foo
+  marked working directory as topic: foo
+  $ hg up
+  clearing empty topic "foo"
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+destination check: when wdp has a topic but wdir has no active topic:
+
+  $ hg topic foo
+  marked working directory as topic: foo
+  $ echo b > b
+  $ hg ci -Am "added b"
+  adding b
+  active topic 'foo' grew its first changeset
+  (see 'hg help topics' for more information)
+  $ hg topic --clear
+  $ hg up
+  switching to topic foo
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-topic-stack-complex.t	Thu Nov 28 10:48:44 2019 +0100
+++ b/tests/test-topic-stack-complex.t	Thu Jan 23 17:40:51 2020 +0700
@@ -176,4 +176,7 @@
   with: [s4] Added e and f
   base: [3] Added e and f
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 8faad6276dc6
+  working directory is now at 80b2ddbf01d3
+
+  $ hg log -r 80b2ddbf01d3 -T '{date|hgdate}\n'
+  0 1