test-compat: merge mercurial-4.8 into mercurial-4.7 mercurial-4.7
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 Jul 2019 11:40:20 +0200
branchmercurial-4.7
changeset 4771 ac079483153a
parent 4672 653c42af172e (current diff)
parent 4770 97f1a229dd99 (diff)
child 4772 c6fc1000af1e
child 4783 5d50f3de4714
test-compat: merge mercurial-4.8 into mercurial-4.7
tests/test-evolve.t
tests/test-pick.t
--- a/.hgtags	Wed Jun 05 17:42:50 2019 +0200
+++ b/.hgtags	Mon Jul 29 11:40:20 2019 +0200
@@ -79,3 +79,4 @@
 8c4289d0e91e95b3281c378e1ac3f4ff4678b4d3 8.4.0
 33c617626fd90a0a00e831b4762f64fecb609317 8.5.0
 05c9dcf5512ed77490a35b4d6b1c3fe860259f48 8.5.1
+756db65030c64b22836fe236d1db3b95477e3ef7 9.0.0
--- a/CHANGELOG	Wed Jun 05 17:42:50 2019 +0200
+++ b/CHANGELOG	Mon Jul 29 11:40:20 2019 +0200
@@ -1,7 +1,17 @@
 Changelog
 =========
 
-8.6.0 - in progress
+9.0.1 - in progress
+-------------------
+
+  * pick: no longer forget file in case of conflict (issue6037)
+  * pick: properly report and cleanup "unfinished state"
+  * prune: don't update wcp if pruned revision are unrelated (issue6137)
+  * prune: spell --successor flag without any unnecessary shortcuts
+  * evolve: properly prune changeset with no change in case of conflict (issue5967)
+  * touch: detect resulting divergence in more cases (issue6107)
+
+9.0.0 -- 2019-06-06
 -------------------
 
   * evolve: preserve the working directory after resolving instability (BC)
@@ -13,9 +23,20 @@
   * evolve: use "unstable" instead of "troubled"
   * evolve: run multiple stabilisation in the same transaction
   * evolve: improve users merging during content-divergence
+  * evolve: reduce the verbosity of `content-divergence` resolution
+  * documentation: various improvement and vocabulary update
+  * packaging: fix documentation build step on debian
+  * progress: improved support in various command
+  * help: avoid duplicated entry for some templates
   * obsdiscovery: drop support for deprecated discovery protocol `obshash`
     (Make sure your servers are configured to use the obshashrange one.
     It is available in evolve 7.2 and above.)
+
+(topic 0.15.0)
+
+  * stack: handle hash sizes when --debug flag is provided
+  * stack: remove 'topic.' prefix from colors/labels (BC)
+  * stack: always provide (full) node hash to non-default --template
   * topic: drop the b# alias. It conflicted with normal hashes.
   * topic: add a `experimental.topic.allow-publish` option (default: True)
 
--- a/debian/changelog	Wed Jun 05 17:42:50 2019 +0200
+++ b/debian/changelog	Mon Jul 29 11:40:20 2019 +0200
@@ -1,8 +1,8 @@
-mercurial-evolve (8.5.1-0) UNRELEASED; urgency=medium
+mercurial-evolve (9.0.0-1) unstable; urgency=medium
 
   * new upstream release
 
- -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Tue, 23 Apr 2019 15:30:11 +0200
+ -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Thu, 06 Jun 2019 14:17:12 +0200
 
 mercurial-evolve (8.5.0-1) unstable; urgency=medium
 
--- a/debian/control	Wed Jun 05 17:42:50 2019 +0200
+++ b/debian/control	Mon Jul 29 11:40:20 2019 +0200
@@ -7,14 +7,14 @@
  Pierre-Yves David <pierre-yves.david@logilab.fr>,
 Standards-Version: 3.9.3
 Build-Depends:
- mercurial (>= 4.1),
+ mercurial (>= 4.5),
  python,
  debhelper (>= 8),
  python-sphinx (>= 1.0.8),
  imagemagick,
  librsvg2-bin,
  wget,
-Python-Version: >= 2.6
+X-Python-Version: >= 2.7
 Homepage: https://www.mercurial-scm.org/doc/evolution/
 
 Package: mercurial-evolve
@@ -22,7 +22,7 @@
 Depends:
  ${python:Depends},
  ${misc:Depends},
- mercurial (>= 4.1),
+ mercurial (>= 4.5),
 Description: evolve extension for Mercurial
  This package provides the experimental "evolve" extension for the Mercurial
  DVCS.
--- a/docs/evolve-faq.rst	Wed Jun 05 17:42:50 2019 +0200
+++ b/docs/evolve-faq.rst	Mon Jul 29 11:40:20 2019 +0200
@@ -157,11 +157,11 @@
 Fix my history afterward: ``prune -n``
 --------------------------------------
 
-Sometimes you need to create an obsolete marker by hand. This may happen when
-upstream has applied some of your patches for example.
+Sometimes you need to create an obsolescence marker by hand. This may happen
+when upstream has applied some of your patches for example.
 
-you can use ``hg prune <old-changeset> --succ <new-changeset>`` to add obsolete
-marker.
+You can use ``hg prune <old-changeset> --successor <new-changeset>`` to add
+obsolescence marker.
 
 View diff from the last amend
 -----------------------------
@@ -172,8 +172,8 @@
     [alias]
     odiff = diff --rev 'limit(predecessors(.),1)' --rev .
 
-View obsolete markers
----------------------
+View obsolescence markers
+-------------------------
 
 hgview_ is the only viewer that currently supports this feature. You
 need version 1.6.2
@@ -204,12 +204,3 @@
 graphical viewer do not.
 
 You can use ``hg log --graph --hidden`` from the command line
-
-
-
-
-
-
-
-
-
--- a/hgext3rd/evolve/__init__.py	Wed Jun 05 17:42:50 2019 +0200
+++ b/hgext3rd/evolve/__init__.py	Mon Jul 29 11:40:20 2019 +0200
@@ -51,39 +51,38 @@
     # re-exchange all markers every time.
     evolution.obsdiscovery = yes
 
-Obsolescence Markers Discovery Experiment
-=========================================
+Obsolescence Markers Discovery
+==============================
 
-We are experimenting with a new protocol to discover common markers between
-local and remote repositories. This experiment is still at an early stage but
-is already raising better results than the previous version (when usable).
+The evolve extension containts an experimental new protocol to discover common
+markers between local and remote repositories.
 
-"Large" repositories (hundreds of thousand) are currently unsupported. Some key
-algorithm has a naive implementation with too aggressive caching, creating
-memory consumption issue (this will get fixed).
+"Large" repositories (hundreds of thousands) will take some time to warm the
+necessary cache. Some key algorithm has a naive implementation that can result
+in large memory or CPU Load.
 
-Medium sized repositories works fine, but be prepared for a noticeable initial
-cache filling. for the Mercurial repository, this is around 20 seconds
-
-The following config control the experiment::
+The following config controls the new protocol::
 
   [experimental]
 
   # enable new discovery protocol
-  # (needed on both client and server)
+  # default to "yes"
   obshashrange = yes
 
   # control cache warming at the end of transaction
-  #   yes:  warm all caches at the end of each transaction,
+  #   yes:  warm all caches at the end of each transaction
+  #         (recommended for server),
   #   off:  warm no caches at the end of transaction,
-  #   auto: warm cache at the end of server side transaction (default).
+  #         (no cache overhead during transaction,
+  #          but cache will be warm from scratch on usage)
+  #   auto: warm cache at the end of server side transaction(ie: push)
+  #         (default).
   obshashrange.warm-cache = 'auto'
 
-    $ hg debugupdatecache
+When you switch to using this protocol, we recommand that you explicitly warm
+cache for your server side repositories.::
 
-It is recommended to enable the blackbox extension. It gathers useful data about
-the experiment. It is shipped with Mercurial so no extra install is needed::
-    $ hg debugupdatecache
+  $ hg debugupdatecache
 
 It is recommended to enable the blackbox extension. It gathers useful data about
 the experiment. It is shipped with Mercurial so no extra install is needed::
@@ -104,7 +103,7 @@
     # ensuring no large repository will get affected.
     obshashrange.max-revs = 100000 # default is None
 
-For very large repositories. it is currently recommended to disable obsmarkers
+For very large repositories, it might be useful to disable obsmarkers
 discovery (Make sure you follow release announcement to know when you can turn
 it back on)::
 
@@ -1277,7 +1276,7 @@
     revs = repo.revs("(%ld)::", revs)
     kwargs['rev'] = []
     kwargs['new'] = []
-    kwargs['succ'] = []
+    kwargs['successor'] = []
     kwargs['biject'] = False
     return cmdrewrite.cmdprune(ui, repo, *revs, **kwargs)
 
@@ -1356,9 +1355,12 @@
 
 @eh.uisetup
 def setupevolveunfinished(ui):
-    data = ('evolvestate', False, False, _('evolve in progress'),
-            _("use 'hg evolve --continue' or 'hg evolve --abort' to abort"))
-    cmdutil.unfinishedstates.append(data)
+    estate = ('evolvestate', False, False, _('evolve in progress'),
+              _("use 'hg evolve --continue' or 'hg evolve --abort' to abort"))
+    cmdutil.unfinishedstates.append(estate)
+    pstate = ('pickstate', False, False, _('pick in progress'),
+              _("use 'hg pick --continue' or 'hg pick --abort' to abort"))
+    cmdutil.unfinishedstates.append(pstate)
 
     afterresolved = ('evolvestate', _('hg evolve --continue'))
     pickresolved = ('pickstate', _('hg pick --continue'))
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Jun 05 17:42:50 2019 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon Jul 29 11:40:20 2019 +0200
@@ -958,7 +958,7 @@
 @eh.command(
     'prune|obsolete',
     [('n', 'new', [], _("successor changeset (DEPRECATED)")),
-     ('s', 'succ', [], _("successor changeset"), _('REV')),
+     ('s', 'successor', [], _("successor changeset"), _('REV')),
      ('r', 'rev', [], _("revisions to prune"), _('REV')),
      ('k', 'keep', None, _("does not modify working copy during prune")),
      ('n', 'note', '', _('store a note on prune'), _('TEXT')),
@@ -966,9 +966,9 @@
                            "(pairing multiple precursors to multiple successors)")),
      ('', 'biject', False, _("alias to --pair (DEPRECATED)")),
      ('', 'fold', False,
-      _("record a fold (multiple precursors, one successors)")),
+      _("record a fold (multiple precursors, one successor)")),
      ('', 'split', False,
-      _("record a split (on precursor, multiple successors)")),
+      _("record a split (one precursor, multiple successors)")),
      ('B', 'bookmark', [], _("remove revs only reachable from given"
                              " bookmark"), _('BOOKMARK'))] + metadataopts,
     _('[OPTION] [-r] REV...'),
@@ -985,23 +985,23 @@
     When you prune the parent of your working copy, Mercurial updates the working
     copy to a non-obsolete parent.
 
-    You can use ``-s/--succ`` to tell Mercurial that a newer version (successor) of the
-    pruned changeset exists. Mercurial records successor revisions in obsolescence
-    markers.
+    You can use ``-s/--successor`` to tell Mercurial that a newer version
+    (successor) of the pruned changeset exists. Mercurial records successor
+    revisions in obsolescence markers.
 
     If you prune a single revision and specify multiple revisions in
-    ``-s/--succ``, you are recording a "split" and must acknowledge it by
+    ``-s/--successor``, you are recording a "split" and must acknowledge it by
     passing ``--split``. Similarly, when you prune multiple changesets with a
     single successor, you must pass the ``--fold`` option.
 
-    If you want to supersede multiple revisions at the same time, use
+    If you want to supersede multiple revisions at the same time, use the
     ``--pair`` option to pair the pruned precursor and successor changesets.
     This is commonly useful for resolving history divergence, or when someone
-    else does edits history without obsolescence enabled.
+    else edits history without obsolescence enabled.
     """
     _checknotesize(ui, opts)
     revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
-    succs = opts['new'] + opts['succ']
+    succs = opts['new'] + opts['successor']
     bookmarks = set(opts.get('bookmark'))
     metadata = _getmetadata(**opts)
     biject = opts.get('pair') or opts.get('biject')
@@ -1063,16 +1063,24 @@
 
         wdp = repo['.']
 
-        if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
-            # '.' killed, so update to the successor
-            newnode = sucs[0]
+        if wdp in precs:
+            if len(sucs) == 1 and len(precs) == 1:
+                # '.' killed, so update to the successor
+                newnode = sucs[0]
+            elif biject:
+                # find the exact successor of '.'
+                newnode = sucs[precs.index(wdp)]
+            else:
+                # update to an unkilled parent
+                newnode = wdp
+
+                while newnode in precs or newnode.obsolete():
+                    newnode = newnode.parents()[0]
         else:
-            # update to an unkilled parent
+            # no need to update anywhere as wdp is not related to revs
+            # being pruned
             newnode = wdp
 
-            while newnode in precs or newnode.obsolete():
-                newnode = newnode.parents()[0]
-
         if newnode.node() != wdp.node():
             if opts.get('keep', False):
                 # This is largely the same as the implementation in
@@ -1368,8 +1376,12 @@
         p2 = newmapping.get(p2, p2)
 
         if not (duplicate or allowdivergence):
-            # The user hasn't yet decided what to do with the revived
-            # cset, let's ask
+            # If reviving this cset creates divergence, let's ask user
+            # what to do: create divergence or duplicate
+
+            # We need to check two cases that can cause divergence:
+            # case 1: the rev being revived has a non-obsolete successor (easily
+            #     detected by successorssets)
             sset = obsutil.successorssets(repo, ctx.node())
             nodivergencerisk = (len(sset) == 0
                                 or (len(sset) == 1
@@ -1377,6 +1389,12 @@
                                     and repo[sset[0][0]].rev() == ctx.rev()
                                 ))
             if nodivergencerisk:
+                # case 2: one of the precursors of the rev being revived has a
+                #     non-obsolete successor (we need divergentsets for this)
+                from . import evolvecmd
+                if evolvecmd.divergentsets(repo, ctx):
+                    nodivergencerisk = False
+            if nodivergencerisk:
                 duplicate = False
             else:
                 displayer.show(ctx)
@@ -1431,7 +1449,7 @@
         revs.append(opts['rev'])
 
     overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
-    with repo.wlock(), repo.lock(), repo.transaction('pick'), ui.configoverride(overrides, 'pick'):
+    with repo.wlock(), repo.lock(), ui.configoverride(overrides, 'pick'):
         pickstate = state.cmdstate(repo, path='pickstate')
         pctx = repo['.']
 
@@ -1470,6 +1488,7 @@
             ui.status(_("aborting pick, updating to %s\n") %
                       node.hex(pctxnode)[:12])
             hg.updaterepo(repo, pctxnode, True)
+            pickstate.delete()
             return 0
 
         else:
--- a/hgext3rd/evolve/evolvecmd.py	Wed Jun 05 17:42:50 2019 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Jul 29 11:40:20 2019 +0200
@@ -1534,9 +1534,9 @@
     If so, evolve rebases that changeset. If not, evolve refuses to guess your
     intention, and gives a hint about what you might want to do next.
 
-    Any time evolve creates a changeset, it updates the working copy to the new
-    changeset. Using ``--update`` will make evolve perform an update after any
-    successful evolve operation.
+    When ``--update`` is used, successful evolve operations update the working
+    directory to the newly created changesets. Moreover, an update will always
+    be performed if the current working directory parent is obsolete.
 
     Automatic mode only handles common use cases. For example, it avoids taking
     action in the case of ambiguity, and it ignores orphan changesets that are
@@ -2052,8 +2052,11 @@
     if node is None:
         repo.ui.status(_("evolution of %d:%s created no changes"
                          " to commit\n") % (ctx.rev(), ctx))
-    newctx = repo[node] if node is not None else repo['.']
-    obsolete.createmarkers(repo, [(ctx, (newctx,))], operation='evolve')
+        replacement = ()
+    else:
+        replacement = (repo[node],)
+
+    obsolete.createmarkers(repo, [(ctx, replacement)], operation='evolve')
 
     # make sure we are continuing evolve and not `hg next --evolve`
     if evolvestate['command'] == 'evolve':
--- a/hgext3rd/evolve/metadata.py	Wed Jun 05 17:42:50 2019 +0200
+++ b/hgext3rd/evolve/metadata.py	Mon Jul 29 11:40:20 2019 +0200
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-__version__ = '8.6.0.dev'
+__version__ = '9.0.1.dev'
 testedwith = '4.5.2 4.6.2 4.7 4.8 4.9 5.0'
 minimumhgversion = '4.5'
 buglink = 'https://bz.mercurial-scm.org/'
--- a/hgext3rd/topic/__init__.py	Wed Jun 05 17:42:50 2019 +0200
+++ b/hgext3rd/topic/__init__.py	Mon Jul 29 11:40:20 2019 +0200
@@ -186,7 +186,7 @@
               'topic.active': 'green',
              }
 
-__version__ = '0.15.0.dev'
+__version__ = '0.15.1.dev'
 
 testedwith = '4.5.2 4.6.2 4.7 4.8 4.9 5.0'
 minimumhgversion = '4.5'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-issue5967.t	Mon Jul 29 11:40:20 2019 +0200
@@ -0,0 +1,73 @@
+hg evolve --continue and obsmarkers after conflict resolution with no changes to commit (issue5967)
+https://bz.mercurial-scm.org/show_bug.cgi?id=5967
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ hg init issue5967
+  $ cd issue5967
+  $ cat > .hg/hgrc << EOF
+  > [alias]
+  > glog = log -GT "{rev}: {desc}"
+  > [extensions]
+  > evolve=
+  > EOF
+
+  $ echo apple > a
+  $ hg ci -qAm 'apple'
+  $ echo banana > a
+  $ hg ci -m 'banana'
+
+Amending revision 0 in a way that causes conflicts
+
+  $ hg prev
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [0] apple
+  $ echo apricot > a
+  $ hg amend -m 'apricot'
+  1 new orphan changesets
+
+  $ hg glog
+  @  2: apricot
+  
+  *  1: banana
+  |
+  x  0: apple
+  
+
+Trying to evolve, then manually discarding changes from revision 1
+
+  $ hg evolve
+  move:[1] banana
+  atop:[2] apricot
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  fix conflicts and see `hg help evolve.interrupted`
+  [1]
+
+  $ echo apricot > a
+  $ hg resolve --mark a
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+This will correctly notice that revision 1 can be dropped
+
+  $ hg evolve --continue
+  evolving 1:dd9b5dd30cd6 "banana"
+  evolution of 1:dd9b5dd30cd6 created no changes to commit
+  working directory is now at 4d6fec23dcc4
+  $ hg glog
+  @  2: apricot
+  
+
+This is important: 1 should not have a successor (especially not revision 2)
+
+  $ hg olog --all
+  @  4d6fec23dcc4 (2) apricot
+  |
+  x  3ba7db0ce860 (0) apple
+       rewritten(description, content) as 4d6fec23dcc4 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  $ hg olog --hidden --all 1
+  x  dd9b5dd30cd6 (1) banana
+       pruned using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  
--- a/tests/test-evolve-split.t	Wed Jun 05 17:42:50 2019 +0200
+++ b/tests/test-evolve-split.t	Mon Jul 29 11:40:20 2019 +0200
@@ -42,7 +42,7 @@
   $ printf "pp" > pp;
   $ hg add pp
   $ hg commit -m "_pp"
-  $ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
+  $ hg prune --successor "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
   1 changesets pruned
   1 new orphan changesets
   $ hg log -G
--- a/tests/test-evolve.t	Wed Jun 05 17:42:50 2019 +0200
+++ b/tests/test-evolve.t	Mon Jul 29 11:40:20 2019 +0200
@@ -595,7 +595,7 @@
   picking 3:0e84df4912da "add 3"
   $ hg graft -r1
   grafting 1:73d38bb17fd7 "add 1"
-  $ hg prune -r2 --succ .
+  $ hg prune -r2 --successor .
   1 changesets pruned
   $ glog --hidden
   @  6:417185465d2c@default(draft) add 1
--- a/tests/test-pick.t	Wed Jun 05 17:42:50 2019 +0200
+++ b/tests/test-pick.t	Mon Jul 29 11:40:20 2019 +0200
@@ -3,6 +3,7 @@
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -G -T "{rev}:{node|short} {desc}\n"
+  > glf = log -GT "{rev}: {desc} ({files})\n"
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
@@ -386,3 +387,62 @@
   o  d03a6bcc83cd: default
   
   $ cd ..
+
+Check that pick doesn't drop files after conflicts occur (issue6037)
+--------------------------------------------------------------------
+
+  $ hg init issue6037
+  $ cd issue6037
+
+  $ echo apple > a
+  $ hg ci -qAm 'apple'
+
+  $ echo apricot > a
+  $ echo banana > b
+  $ hg ci -qAm 'apricot and banana'
+
+  $ echo avocado > a
+  $ hg ci -m 'avocado'
+
+  $ hg glf
+  @  2: avocado (a)
+  |
+  o  1: apricot and banana (a b)
+  |
+  o  0: apple (a)
+  
+Now let's change order of 1 and 2 using pick command
+
+  $ hg up -r 0
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+We avoid merge conflict here just to make the test shorter
+
+  $ hg pick -r 2 --tool :other
+  picking 2:f08a1e4a33c4 "avocado"
+
+Now we pick revision 1 that touches two files (a and b), merge conflict is expected
+
+  $ hg pick -r 1
+  picking 1:892e123ebf62 "apricot and banana"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+  $ hg resolve -t :other a
+  (no more unresolved files)
+  continue: hg pick --continue
+  $ hg pick --continue
+
+Demonstrate that b was not forgotten and is definitely included in 4
+
+  $ hg status b -A
+  C b
+  $ hg glf
+  @  4: apricot and banana (a b)
+  |
+  o  3: avocado (a)
+  |
+  o  0: apple (a)
+  
+  $ cd ..
--- a/tests/test-prune.t	Wed Jun 05 17:42:50 2019 +0200
+++ b/tests/test-prune.t	Mon Jul 29 11:40:20 2019 +0200
@@ -229,17 +229,18 @@
   814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
 
-two old, two new with --pair
+two old, two new with --pair (also test bookmark move)
 
   $ hg up 0
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ hg bookmark prune-pair-book
   $ mkcommit n1
   created new head
   $ mkcommit n2
 
   $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --pair
-  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  working directory is now at 1f0dee641bb7
+  4 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  working directory is now at 6e8148413dd5
   2 changesets pruned
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
@@ -252,11 +253,15 @@
   354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
   cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
   21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
+  $ hg log --hidden -r 'desc("add n2") + desc("add nE") + bookmark("prune-pair-book")'
+  14:21b6f2f1cece[] (obsolete/draft) add n2
+  12:6e8148413dd5[prune-pair-book] (draft) add nE
 
 test hg strip replacement
 
   $ hg up 10
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  (leaving bookmark prune-pair-book)
   $ mkcommit n1
   created new head
   $ mkcommit n2
@@ -454,3 +459,45 @@
      r10                       8:d62d843c9a01
      rg                        15:cd0038e05e1b
 
+  $ cd ..
+
+Test that prune doesn't update off when pruning unrelated commit (issue6137)
+----------------------------------------------------------------------------
+
+  $ hg init issue6137
+  $ cd issue6137
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+
+  $ hg prune .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory is now at 9092f1db7931
+  1 changesets pruned
+
+  $ echo c > c
+  $ hg ci -Aqm "added c"
+
+update to obsoleted revision and perform prune on unrelated revision:
+  $ hg up -r "desc('added b')" --hidden -q
+  updated to hidden changeset 5f6d8a4bf34a
+  (hidden revision '5f6d8a4bf34a' is pruned)
+  working directory parent is obsolete! (5f6d8a4bf34a)
+
+  $ hg log -G
+  o  2:29edef26570b[] (draft) added c
+  |
+  | @  1:5f6d8a4bf34a[] (obsolete/draft) added b
+  |/
+  o  0:9092f1db7931[] (draft) added a
+  
+  $ hg prune -r "desc('added c')"
+  1 changesets pruned
+
+  $ hg par
+  1:5f6d8a4bf34a[] (obsolete/draft) added b
+  working directory parent is obsolete! (5f6d8a4bf34a)
+  (use 'hg evolve' to update to its parent successor)
+
+  $ cd ..
--- a/tests/test-touch.t	Wed Jun 05 17:42:50 2019 +0200
+++ b/tests/test-touch.t	Mon Jul 29 11:40:20 2019 +0200
@@ -170,3 +170,25 @@
   (see 'hg help phases' for details)
   [255]
   $ hg touch --duplicate 2
+
+  $ cd ..
+
+Make sure touch doesn't fail to warn about divergence (issue6107)
+
+  $ hg init touchdiv
+  $ cd touchdiv
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m "added c"
+
+  $ hg amend -m "modified c"
+  $ hg prune . -q
+
+  $ hg touch -r "desc('added c')" --hidden
+  $ hg touch -r "desc('modified c')" --hidden
+  [1] modified c
+  reviving this changeset will create divergence unless you make a duplicate.
+  (a)llow divergence or (d)uplicate the changeset?  a
+  2 new content-divergent changesets
+
+  $ cd ..