changeset 3456:b03d955e391e

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 26 Jan 2018 17:55:16 +0100
parents 56277182c029 (current diff) f7ecb11d71bb (diff)
children 82e9f9603b1b
files CHANGELOG hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py
diffstat 5 files changed, 64 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Thu Jan 25 17:29:21 2018 -0800
+++ b/CHANGELOG	Fri Jan 26 17:55:16 2018 +0100
@@ -7,6 +7,12 @@
   * grab: new command to grab a changeset, put in on wdir parent
           and update to it
 
+7.2.2 -- (in-progress)
+----------------------
+
+  * fold: fix issue related to bookmarks movement (issue5772)
+  * amend: take lock before parsing the commit description (issue5266)
+
 7.2.1 --2018-01-20
 -------------------
 
--- a/hgext3rd/evolve/__init__.py	Thu Jan 25 17:29:21 2018 -0800
+++ b/hgext3rd/evolve/__init__.py	Fri Jan 26 17:55:16 2018 +0100
@@ -696,7 +696,8 @@
     ui.warn(msg % shortnode)
 
     # Check that evolve is activated for performance reasons
-    if ui.quiet or not obsolete.isenabled(repo, commandopt):
+    evolvecommandenabled = any('evolve' in e for e in cmdtable)
+    if ui.quiet or not evolvecommandenabled:
         return
 
     # Show a warning for helping the user to solve the issue
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Jan 25 17:29:21 2018 -0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Jan 26 17:55:16 2018 +0100
@@ -128,13 +128,13 @@
         edit = opts.pop('edit', False)
         log = opts.get('logfile')
         opts['amend'] = True
-        if not (edit or opts['message'] or log):
-            opts['message'] = repo['.'].description()
         _resolveoptions(ui, opts)
         _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
         try:
             wlock = repo.wlock()
             lock = repo.lock()
+            if not (edit or opts['message'] or log):
+                opts['message'] = repo['.'].description()
             rewriteutil.precheck(repo, [repo['.'].rev()], action='amend')
             return commitcmd[0](ui, repo, *pats, **opts)
         finally:
@@ -613,6 +613,11 @@
             phases.retractboundary(repo, tr, targetphase, [newid])
             obsolete.createmarkers(repo, [(ctx, (repo[newid],))
                                    for ctx in allctx], metadata=metadata)
+            # move bookmarks from old nodes to the new one
+            # XXX: we should make rewriteutil.rewrite() handle such cases
+            for ctx in allctx:
+                bmupdater = rewriteutil.bookmarksupdater(repo, ctx.node(), tr)
+                bmupdater(newid)
             tr.close()
         finally:
             tr.release()
--- a/tests/test-evolve.t	Thu Jan 25 17:29:21 2018 -0800
+++ b/tests/test-evolve.t	Fri Jan 26 17:55:16 2018 +0100
@@ -1250,6 +1250,24 @@
   (use 'hg help' for the full list of commands or 'hg -v' for details)
   [255]
 
+Shows "use 'hg evolve' to..." hints iff the evolve command is enabled
+
+  $ hg --hidden up 14
+  updating to a hidden changeset 484fb3cfa7f2
+  (hidden revision '484fb3cfa7f2' was rewritten as: 98e171e2f272)
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (484fb3cfa7f2)
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolutioncommands=evolve
+  > EOF
+  $ hg --hidden up 15
+  updating to a hidden changeset daa1ff1c7fbd
+  (hidden revision 'daa1ff1c7fbd' was rewritten as: 0c049e4e5422)
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (daa1ff1c7fbd)
+  (use 'hg evolve' to update to its successor: 0c049e4e5422)
+
 Restore all of the evolution features
 
   $ cat >> $HGRCPATH <<EOF
@@ -1259,7 +1277,7 @@
 
 Check hg evolve --rev on singled out commit
   $ hg up 98e171e2f272 -C
-  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ mkcommit j1
   $ mkcommit j2
   $ mkcommit j3
--- a/tests/test-fold.t	Thu Jan 25 17:29:21 2018 -0800
+++ b/tests/test-fold.t	Fri Jan 26 17:55:16 2018 +0100
@@ -8,7 +8,7 @@
   > [extensions]
   > evolve=
   > [ui]
-  > logtemplate = '{rev} - {node|short} {desc|firstline} [{author}] ({phase})\n'
+  > logtemplate = '{rev} - {node|short} {desc|firstline} [{author}] ({phase}) {bookmarks}\n'
   > EOF
 
   $ hg init fold-tests
@@ -16,6 +16,7 @@
   $ hg debugbuilddag .+3:branchpoint+4*branchpoint+2
   $ hg up 'desc("r7")'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bookmark bm1
   $ hg log -G
   o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
   |
@@ -23,7 +24,7 @@
   |
   o  8 - abf57d94268b r8 [debugbuilddag] (draft)
   |
-  | @  7 - 4de32a90b66c r7 [debugbuilddag] (draft)
+  | @  7 - 4de32a90b66c r7 [debugbuilddag] (draft) bm1
   | |
   | o  6 - f69452c5b1af r6 [debugbuilddag] (draft)
   | |
@@ -87,6 +88,27 @@
   3 changesets folded
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+Checking whether the bookmarks are moved or not
+
+  $ hg log -G
+  @  11 - 198b5c405d01 r5 [debugbuilddag] (draft) bm1
+  |
+  | o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
+  | |
+  | o  9 - 529dfc5bb875 r9 [debugbuilddag] (draft)
+  | |
+  | o  8 - abf57d94268b r8 [debugbuilddag] (draft)
+  | |
+  o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
+  |/
+  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
+  |
+  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
+  |
+  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
+  |
+  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
+  
 (test inherited from test-evolve.t)
 
   $ hg fold --from 6 # want to run hg fold 6
@@ -95,7 +117,7 @@
   [255]
 
   $ hg log -G
-  @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
+  @  11 - 198b5c405d01 r5 [debugbuilddag] (draft) bm1
   |
   | o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
   | |
@@ -124,7 +146,7 @@
   $ hg log -G
   o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
   |
-  | @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
+  | @  11 - 198b5c405d01 r5 [debugbuilddag] (draft) bm1
   | |
   | o  4 - bebd167eb94d r4 [debugbuilddag] (draft)
   |/
@@ -144,8 +166,9 @@
   $ hg commit '-m r11'
   $ hg up '.^'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (leaving bookmark bm1)
   $ hg log -G
-  o  13 - 14d0e0da8e91 r11 [test] (draft)
+  o  13 - 14d0e0da8e91 r11 [test] (draft) bm1
   |
   | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
   | |
@@ -190,7 +213,7 @@
   2 changesets folded
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft)
+  @  14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft) bm1
   |
   | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
   | |
@@ -209,7 +232,7 @@
   2 changesets folded
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -G
-  @  15 - 91880abed0f2 r4 [test] (draft)
+  @  15 - 91880abed0f2 r4 [test] (draft) bm1
   |
   | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
   |/