changeset 1107:1c227ecb744d

merge: all the stable sweetness into default
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 02 Sep 2014 20:11:45 +0200
parents 580a2d838996 (current diff) 6b0cf1b73693 (diff)
children 87d60434b434
files README hgext/evolve.py tests/test-sharing.t tests/test-tutorial.t
diffstat 11 files changed, 106 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/README	Fri Aug 29 16:13:19 2014 +0200
+++ b/README	Tue Sep 02 20:11:45 2014 +0200
@@ -64,10 +64,11 @@
 4.2.0 --
 
 - uncommit: add a --rev argument
-
-4.1.1 --
-
+- evolve: add a `working directory now at xxxxxxxxxx` message
+- evolve: automatically translate obsolete hashes when evolving
 - properly skip marker creating if patch apply cleanly
+- prune: work around a massive slowdown from lazy revset
+- grab: "fix" the grab alias on window
 
 4.1.0 -- 2014-08-08
 
--- a/debian/control	Fri Aug 29 16:13:19 2014 +0200
+++ b/debian/control	Tue Sep 02 20:11:45 2014 +0200
@@ -13,6 +13,7 @@
  python-sphinx (>= 1.0.8),
  imagemagick,
  librsvg2-bin,
+ curl,
 Python-Version: >= 2.6
 Homepage: https://bitbucket.org/marmoute/mutable-history
 
--- a/debian/docs	Fri Aug 29 16:13:19 2014 +0200
+++ b/debian/docs	Tue Sep 02 20:11:45 2014 +0200
@@ -1,1 +1,2 @@
 html
+README
--- a/hgext/evolve.py	Fri Aug 29 16:13:19 2014 +0200
+++ b/hgext/evolve.py	Tue Sep 02 20:11:45 2014 +0200
@@ -22,11 +22,13 @@
 testedwith = ''
 buglink = 'http://bz.selenic.com/'
 
-import sys
+import sys, os
 import random
 from StringIO import StringIO
 import struct
 import urllib
+import re
+sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
 
 import mercurial
 from mercurial import util
@@ -69,6 +71,7 @@
 from mercurial import localrepo
 from mercurial.hgweb import hgweb_mod
 from mercurial import bundle2
+from mercurial import util
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
@@ -376,8 +379,13 @@
         ui.setconfig('alias', 'odiff',
             "diff --hidden --rev 'limit(precursors(.),1)' --rev .")
     if ui.config('alias', 'grab', None) is None:
-        ui.setconfig('alias', 'grab',
-            "! $HG rebase --dest . --rev $@ && $HG up tip")
+        if os.name == 'nt':
+            ui.setconfig('alias', 'grab',
+                "! " + util.hgexecutable() + " rebase --dest . --rev  && "
+                 + util.hgexecutable() + " up tip")
+        else:
+            ui.setconfig('alias', 'grab',
+                "! $HG rebase --dest . --rev $@ && $HG up tip")
 
 
 ### Troubled revset symbol
@@ -776,6 +784,32 @@
     destbookmarks = repo.nodebookmarks(dest.node())
     nodesrc = orig.node()
     destphase = repo[nodesrc].phase()
+    commitmsg = orig.description()
+
+    cache = {}
+    sha1s = re.findall(sha1re, commitmsg)
+    unfi = repo.unfiltered()
+    for sha1 in sha1s:
+        ctx = None
+        try:
+            ctx = unfi[sha1]
+        except error.RepoLookupError:
+            continue
+
+        if not ctx.obsolete():
+            continue
+
+        successors = obsolete.successorssets(repo, ctx.node(), cache)
+
+        # We can't make any assumptions about how to update the hash if the
+        # cset in question was split or diverged.
+        if len(successors) == 1 and len(successors[0]) == 1:
+            newsha1 = node.hex(successors[0][0])
+            commitmsg = commitmsg.replace(sha1, newsha1[:len(sha1)])
+        else:
+            repo.ui.note(_('The stale commit message reference to %s could '
+                           'not be updated') % sha1)
+
     tr = repo.transaction('relocate')
     try:
         try:
@@ -786,7 +820,7 @@
                         'unresolved merge conflicts (see hg help resolve)')
             cmdutil.duplicatecopies(repo, orig.node(), dest.node())
             nodenew = rebase.concludenode(repo, orig.node(), dest.node(),
-                                          node.nullid)
+                                          node.nullid, commitmsg)
         except util.Abort, exc:
             class LocalMergeFailure(MergeFailure, exc.__class__):
                 pass
@@ -1112,6 +1146,8 @@
     confirmopt = opts['confirm']
     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
 
+    startnode = repo['.']
+
     if contopt:
         if anyopt:
             raise util.Abort('cannot specify both "--any" and "--continue"')
@@ -1155,7 +1191,10 @@
                     print 'hg update %s' % ctx.rev()
                     return 0
                 else:
-                    return hg.update(repo, ctx.rev())
+                    res = hg.update(repo, ctx.rev())
+                    if ctx != startnode:
+                        ui.status(_('working directory is now at %s\n') % ctx)
+                    return res
 
         troubled = repo.revs('troubled()')
         if troubled:
@@ -1188,6 +1227,8 @@
         progresscb()
         seen += 1
         if not allopt:
+            if repo['.'] != startnode:
+                ui.status(_('working directory is now at %s\n') % repo['.'])
             return result
         progresscb()
         tro = _picknexttroubled(ui, repo, anyopt or allopt)
@@ -1195,6 +1236,9 @@
     if allopt:
         ui.progress('evolve', None)
 
+    if repo['.'] != startnode:
+        ui.status(_('working directory is now at %s\n') % repo['.'])
+
 
 def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb):
     repo = repo.unfiltered()
@@ -1733,11 +1777,19 @@
         if bookmark:
             _deletebookmark(ui, marks, bookmark)
         for ctx in repo.unfiltered().set('bookmark() and %ld', precs):
-            ldest = list(repo.set('max((::%d) - obsolete())', ctx))
-            if ldest:
-                dest = ldest[0]
-                updatebookmarks = _bookmarksupdater(repo, ctx.node())
-                updatebookmarks(dest.node())
+            # used to be:
+            #
+            #   ldest = list(repo.set('max((::%d) - obsolete())', ctx))
+            #   if ldest:
+            #      c = ldest[0]
+            #
+            # but then revset took a lazy arrow in the knee and became much
+            # slower. The new forms makes as much sense and a much faster.
+            for dest in ctx.ancestors():
+                if not dest.obsolete():
+                    updatebookmarks = _bookmarksupdater(repo, ctx.node())
+                    updatebookmarks(dest.node())
+                    break
     finally:
         lockmod.release(lock, wlock)
 
--- a/tests/test-evolve.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-evolve.t	Tue Sep 02 20:11:45 2014 +0200
@@ -193,13 +193,13 @@
 It is therefore advisable to always set the bookmark before committing::
 
   $ hg book feature-B
-  $ hg commit --message "another feature"
+  $ hg commit --message "another feature (child of $(hg log -r . -T '{node|short}'))"
 
 So here we are::
 
   $ hg book
      feature-A                 1:568a468b60fc
-   * feature-B                 2:7b36850622b2
+   * feature-B                 2:73296a82292a
 
 
 Fix The Second Patch
@@ -222,7 +222,7 @@
 changeset plus the updating changeset are hidden from view by default::
 
   $ hg log
-  4	feature-B: another feature - test
+  4	feature-B: another feature (child of 568a468b60fc) - test
   1	feature-A: a nifty feature - test
   0	: base - test
 
@@ -242,7 +242,7 @@
   1 new unstable changesets
   $ hg log
   6	feature-A: a nifty feature - test
-  4	feature-B: another feature - test
+  4	feature-B: another feature (child of 568a468b60fc) - test
   1	: a nifty feature - test
   0	: base - test
   $ hg up -q 0
@@ -251,27 +251,28 @@
   |
   | x  5:c296b79833d1@default(draft) temporary amend commit for 568a468b60fc
   | |
-  | | o  4:207cbc4ea7fe@default(draft) another feature
+  | | o  4:6992c59c6b06@default(draft) another feature (child of 568a468b60fc)
   | |/
-  | | x  3:5bb880fc0f12@default(draft) temporary amend commit for 7b36850622b2
+  | | x  3:c97947cdc7a2@default(draft) temporary amend commit for 73296a82292a
   | | |
-  | | x  2:7b36850622b2@default(draft) another feature
+  | | x  2:73296a82292a@default(draft) another feature (child of 568a468b60fc)
   | |/
   | x  1:568a468b60fc@default(draft) a nifty feature
   |/
   @  0:e55e0562ee93@default(public) base
   
   $ hg debugobsolete
-  7b36850622b2fd159fa30a4fb2a1edd2043b4a14 207cbc4ea7fee30d18b3a25f534fe5db22c6071b 0 (*) {'user': 'test'} (glob)
-  5bb880fc0f12dd61eee6de36f62b93fdbc3684b0 0 {7b36850622b2fd159fa30a4fb2a1edd2043b4a14} (*) {'user': 'test'} (glob)
+  73296a82292a76fb8a7061969d2489ec0d84cd5e 6992c59c6b06a1b4a92e24ff884829ae026d018b 0 (*) {'user': 'test'} (glob)
+  c97947cdc7a2a11cf78419f5c2c3dd3944ec79e8 0 {73296a82292a76fb8a7061969d2489ec0d84cd5e} (*) {'user': 'test'} (glob)
   568a468b60fc99a42d5d4ddbe181caff1eef308d ba0ec09b1babf3489b567853807f452edd46704f 0 (*) {'user': 'test'} (glob)
   c296b79833d1d497f33144786174bf35e04e44a3 0 {568a468b60fc99a42d5d4ddbe181caff1eef308d} (*) {'user': 'test'} (glob)
   $ hg evolve
-  move:[4] another feature
+  move:[4] another feature (child of 568a468b60fc)
   atop:[6] a nifty feature
   merging main-file-1
+  working directory is now at 5c9c8d9c2e4e
   $ hg log
-  7	feature-B: another feature - test
+  7	feature-B: another feature (child of ba0ec09b1bab) - test
   6	feature-A: a nifty feature - test
   0	: base - test
 
@@ -300,7 +301,7 @@
   $ hg glog
   @  8	feature-B: another feature that rox - test
   |
-  | o  7	: another feature - test
+  | o  7	: another feature (child of ba0ec09b1bab) - test
   |/
   o  6	feature-A: a nifty feature - test
   |
@@ -308,13 +309,14 @@
   
   $ hg evolve --any --traceback
   recreate:[8] another feature that rox
-  atop:[7] another feature
+  atop:[7] another feature (child of ba0ec09b1bab)
   computing new diff
-  committed as ca3b75e3e59b
+  committed as 476d0454d60e
+  working directory is now at 476d0454d60e
   $ hg glog
-  @  9	feature-B: bumped update to abe98aeaaa35: - test
+  @  9	feature-B: bumped update to 5c9c8d9c2e4e: - test
   |
-  o  7	: another feature - test
+  o  7	: another feature (child of ba0ec09b1bab) - test
   |
   o  6	feature-A: a nifty feature - test
   |
@@ -369,6 +371,7 @@
   move:[11] dansk 3!
   atop:[14] dansk 2!
   merging main-file-1
+  working directory is now at cfb5ebed336d
   $ hg glog
   @  15	: dansk 3! - test
   |
@@ -376,7 +379,7 @@
   |
   o  13	feature-B: dansk! - test
   |
-  o  7	: another feature - test
+  o  7	: another feature (child of ba0ec09b1bab) - test
   |
   o  6	feature-A: a nifty feature - test
   |
@@ -731,6 +734,7 @@
   $ hg stab --any
   move:[15] c
   atop:[13] a
+  working directory is now at 3742bde73477
   $ hg st -C --change=tip
   A c
     a
@@ -743,11 +747,11 @@
   2 changesets folded
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ glog
-  @  16:e6d8dace77a1@default(draft) Folding with custom commit message
+  @  16:d6239ff09c9f@default(draft) Folding with custom commit message
   |
-  o  13:e9c952d5bc4b@default(draft) dansk!
+  o  13:56ade053f46d@default(draft) dansk!
   |
-  o  7:abe98aeaaa35@default(public) another feature
+  o  7:5c9c8d9c2e4e@default(public) another feature (child of ba0ec09b1bab)
   |
   o  6:ba0ec09b1bab@default(public) a nifty feature
   |
@@ -762,8 +766,8 @@
   2 changesets folded
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg qlog
-  17 - 2451d817c756 A longer
+  17 - dba606655966 A longer
                     commit message (draft)
-  7 - abe98aeaaa35 another feature (public)
+  7 - 5c9c8d9c2e4e another feature (child of ba0ec09b1bab) (public)
   6 - ba0ec09b1bab a nifty feature (public)
   0 - e55e0562ee93 base (public)
--- a/tests/test-sharing.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-sharing.t	Tue Sep 02 20:11:45 2014 +0200
@@ -204,6 +204,7 @@
   atop:[2] fix bug 15
   computing new diff
   committed as 227d860d9ad0
+  working directory is now at 227d860d9ad0
 
 Figure SG08
   $ hg --hidden shortlog -G
--- a/tests/test-stabilize-conflict.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-stabilize-conflict.t	Tue Sep 02 20:11:45 2014 +0200
@@ -81,6 +81,7 @@
   move:[2] babar count up to fifteen
   atop:[4] babar count up to ten
   merging babar
+  working directory is now at 71c18f70c34f
   $ hg resolve -l
   $ hg log -G
   @  changeset:   5:71c18f70c34f
--- a/tests/test-stabilize-order.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-stabilize-order.t	Tue Sep 02 20:11:45 2014 +0200
@@ -71,6 +71,7 @@
   resolving manifests
   getting b
   b
+  working directory is now at bede829dd2d3
   $ glog
   @  8:bede829dd2d3@default(draft) addb
   |
@@ -99,6 +100,7 @@
   resolving manifests
   getting c
   c
+  working directory is now at 65095d7d0dd5
   $ hg debugobsolete > successors.new
   $ diff -u successors.old successors.new
   --- successors.old* (glob)
@@ -159,6 +161,7 @@
   resolving manifests
   getting c
   c
+  working directory is now at e99ecf51c867
   $ glog
   @  12:e99ecf51c867@default(draft) addc
   |
--- a/tests/test-stabilize-result.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-stabilize-result.t	Tue Sep 02 20:11:45 2014 +0200
@@ -165,6 +165,7 @@
   rebasing to destination parent: 66719795a494
   computing new diff
   committed as (a7cabd7bd9c2|671b9d7eeaec) (re)
+  working directory is now at (a7cabd7bd9c2|671b9d7eeaec) (re)
   $ glog
   @  14:(a7cabd7bd9c2|671b9d7eeaec)@default\(draft\) bk:\[\] bumped update to 1cf0aacfd363: (re)
   |
@@ -258,6 +259,7 @@
   copying changeset 283ccd10e2b8 to 7bc2f5967f5e
   a
   committed changeset 21:f344982e63c4
+  working directory is now at f344982e63c4
   $ hg st
   $ glog
   @  21:f344982e63c4@default(draft) bk:[] More addition
--- a/tests/test-tutorial.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-tutorial.t	Tue Sep 02 20:11:45 2014 +0200
@@ -703,6 +703,7 @@
   move:[15] animals
   atop:[14] bathroom stuff
   merging shopping
+  working directory is now at ee942144f952
 
 The old version of bathroom is hidden again.
 
@@ -754,6 +755,7 @@
   $ hg evolve
   update:[8] animals
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at ee942144f952
 
 Relocating unstable change after prune
 ----------------------------------------------
@@ -831,6 +833,7 @@
   move:[17] SPAM SPAM SPAM
   atop:[14] bathroom stuff
   merging shopping
+  working directory is now at 40aa40daeefb
 
   $ hg log -G
   @  40aa40daeefb (draft): SPAM SPAM SPAM
--- a/tests/test-userguide.t	Fri Aug 29 16:13:19 2014 +0200
+++ b/tests/test-userguide.t	Tue Sep 02 20:11:45 2014 +0200
@@ -253,6 +253,7 @@
   $ hg evolve --all
   move:[23] fix bug 67
   atop:[24] fix bug 53
+  working directory is now at 0d972d6888e6
   $ hg --hidden shortlog -G -r 21::
   @  25:0d972d6888e6  draft  fix bug 67
   |
@@ -301,6 +302,7 @@
   $ hg evolve --all
   move:[27] new feature
   atop:[28] fix a bug
+  working directory is now at 166c1c368ab6
   $ hg --hidden shortlog -G -r 25::
   @  30:166c1c368ab6  draft  new feature
   |