merge stable into default
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 11 Nov 2014 15:48:02 +0000
changeset 1158 0f6c97421cd9
parent 1145 fb51113a1c08 (current diff)
parent 1157 5951969400ce (diff)
child 1159 04bd66779a1f
merge stable into default
--- a/README	Mon Sep 29 21:31:27 2014 -0400
+++ b/README	Tue Nov 11 15:48:02 2014 +0000
@@ -28,11 +28,9 @@
 Contribute
 ==========
 
-The simplest way to contribute is to issue a pull request on Bitbucket
-(https://bitbucket.org/marmoute/mutable-history). Alternatively, you
-can use the patchbomb extension to send email to mercurial
-devel. Please make sure to use the evolve-ext flag when doing so. You
-can use a command like this:
+Please use the patchbomb extension to send email to mercurial devel. Please
+make sure to use the evolve-ext flag when doing so. You can use a command like
+this:
 
     hg email --to mercurial-devel@selenic.com --flag evolve-ext --rev '<your patches>'
 
@@ -46,13 +44,6 @@
     cd tests
     python run-tests.py --with-hg=/path/to/hg
 
-However, some cutting-edge changes may be found in a mutable repository hosted
-by logilab before they are published.
-
-    http://hg.netv6.net/marmoute-wip/evolve/
-
-Be sure to check latest draft changeset before submitting new changesets.
-
 
 Changelog
 =========
@@ -61,6 +52,7 @@
 
 - amend: fix --logfile argument
 - evolve: preserve branch change when evolving
+- evolve: fix potential crash while solving `bumped` changesets.
 
 5.0.0 -- 2014-10-22
 
--- a/hgext/evolve.py	Mon Sep 29 21:31:27 2014 -0400
+++ b/hgext/evolve.py	Tue Nov 11 15:48:02 2014 +0000
@@ -19,6 +19,7 @@
     - improves some aspect of the early implementation in Mercurial core
 '''
 
+__version__ = '5.1.0'
 testedwith = '3.2'
 buglink = 'http://bz.selenic.com/'
 
@@ -85,7 +86,7 @@
         return oldmemfilectx(*args, **kwargs)
 else:
     raise util.Abort('Your Mercurial is too old for this version of Evolve\n'
-                     'requires version 3.2 or above')
+                     'requires version %s or above' % min(testedwith.split()))
 
 
 # This extension contains the following code
@@ -1190,7 +1191,6 @@
                     displayer.show(ctx)
 
                 if dryrunopt:
-                    print 'hg update %s' % ctx.rev()
                     return 0
                 else:
                     res = hg.update(repo, ctx.rev())
@@ -1302,9 +1302,12 @@
 
     # Look for an unstable which can be stabilized as a child of
     # node. The unstable must be a child of one of node predecessors.
+    directdesc = set([pctx.rev()])
     for ctx in selfanddescendants(repo, pctx):
         for child in ctx.children():
-            if child.unstable():
+            if ctx.rev() in directdesc and not child.obsolete():
+                directdesc.add(child.rev())
+            elif child.unstable():
                 return child
     return None
 
@@ -1313,9 +1316,7 @@
     """Stabilize a unstable changeset"""
     obs = orig.parents()[0]
     if not obs.obsolete():
-        print obs.rev(), orig.parents()
-        print orig.rev()
-        obs = orig.parents()[1]
+        obs = orig.parents()[1] # second parent is obsolete ?
     assert obs.obsolete()
     newer = obsolete.successorssets(repo, obs.node())
     # search of a parent which is not killed
@@ -1414,7 +1415,7 @@
         files = set()
         copied = copies.pathcopies(prec, bumped)
         precmanifest = prec.manifest()
-        for key, val in bumped.manifest().iteritems():
+        for key, val in bumped.manifest().items():
             if precmanifest.pop(key, None) != val:
                 files.add(key)
         files.update(precmanifest)  # add missing files
@@ -1488,13 +1489,13 @@
                          "| `hg prune` to kill older version.")
     if other.p1() not in divergent.parents():
         raise util.Abort("parents are not common (not handled yet)",
-                    hint="| %(d)s, %(o)s are not based on the same changeset."
-                         "| With the current state of its implementation, "
+                    hint="| %(d)s, %(o)s are not based on the same changeset.\n"
+                         "| With the current state of its implementation, \n"
                          "| evolve does not work in that case.\n"
-                         "| rebase one of them next to the other and run "
+                         "| rebase one of them next to the other and run \n"
                          "| this command again.\n"
-                         "| - either: hg rebase -dest 'p1(%(d)s)' -r %(o)s"
-                         "| - or:     hg rebase -dest 'p1(%(d)s)' -r %(o)s"
+                         "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n"
+                         "| - or:     hg rebase --dest 'p1(%(o)s)' -r %(d)s"
                               % {'d': divergent, 'o': other})
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
--- a/setup.py	Mon Sep 29 21:31:27 2014 -0400
+++ b/setup.py	Tue Nov 11 15:48:02 2014 +0000
@@ -2,10 +2,21 @@
 # Credit to Augie Fackler <durin42@gmail.com>
 
 from distutils.core import setup
+from os.path import dirname, join
+
+def get_version(relpath):
+    '''Read version info from a file without importing it'''
+    for line in open(join(dirname(__file__), relpath), 'rb'):
+        # Decode to a fail-safe string for PY3
+        # (gives unicode object in PY2)
+        line = line.decode('utf8')
+        if '__version__' in line:
+          if "'" in line:
+            return line.split("'")[1]
 
 setup(
     name='hg-evolve',
-    version='5.0.0',
+    version=get_version('hgext/evolve.py'),
     author='Pierre-Yves David',
     maintainer='Pierre-Yves David',
     maintainer_email='pierre-yves.david@ens-lyon.org',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-bumped.t	Tue Nov 11 15:48:02 2014 +0000
@@ -0,0 +1,83 @@
+  $ hg init public
+  $ cd public
+  $ echo a > a
+  $ hg commit -A -m init
+  adding a
+  $ cd ..
+
+  $ evolvepath=$(echo $(dirname $TESTDIR))/hgext/evolve.py
+  $ hg clone -U public private
+  $ cd private
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > rebase =
+  > evolve = $evolvepath
+  > [phases]
+  > publish = false
+  > EOF
+  $ cd ..
+
+  $ cp -a private alice
+  $ cp -a private bob
+
+  $ cd alice
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a >> a
+  $ hg commit -u alice -m 'modify a'
+  $ hg push ../private
+  pushing to ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ hg log -r 'draft()'
+  changeset:   1:4d1169d82e47
+  tag:         tip
+  user:        alice
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify a
+  
+
+  $ cd ../bob
+  $ hg pull ../private
+  pulling from ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  pull obsolescence markers
+  (run 'hg update' to get a working copy)
+  $ hg log -r 'draft()'
+  changeset:   1:4d1169d82e47
+  tag:         tip
+  user:        alice
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify a
+  
+  $ hg push ../public
+  pushing to ../public
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ hg log -r 'draft()'
+
+  $ cd ../alice
+  $ hg amend -m 'tweak a'
+  $ hg pull ../public
+  pulling from ../public
+  searching for changes
+  no changes found
+  pull obsolescence markers
+  1 new bumped changesets
+
+  $ hg evolve -a
+  recreate:[2] tweak a
+  atop:[1] modify a
+  computing new diff
+  committed as 4d1169d82e47
+  working directory is now at 4d1169d82e47
--- a/tests/test-evolve.t	Mon Sep 29 21:31:27 2014 -0400
+++ b/tests/test-evolve.t	Tue Nov 11 15:48:02 2014 +0000
@@ -846,3 +846,17 @@
   |
   o  0 [default] a0
   
+
+Evolve from the middle of a stack pick the right changesets.
+
+  $ hg up 7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg ci --amend -m 'a1__'
+  2 new unstable changesets
+
+  $ hg up 8
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg evolve
+  nothing to evolve here
+  (2 troubled changesets, do you want --any ?)
+  [2]
--- a/tests/test-touch.t	Mon Sep 29 21:31:27 2014 -0400
+++ b/tests/test-touch.t	Tue Nov 11 15:48:02 2014 +0000
@@ -86,3 +86,25 @@
   o  4:[0-9a-f]{12} a (re)
   
 
+check move data kept after rebase on touch:
+
+  $ touch gna1
+  $ hg commit -Am gna1
+  adding gna1
+  $ hg mv gna1 gna2
+  $ hg commit -m move
+  $ hg st -C --change=tip
+  A gna2
+    gna1
+  R gna1
+  $ hg up .^
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg touch
+  1 new unstable changesets
+
+  $ hg rebase -s 11 -d 12
+  $ hg st -C --change=tip
+  A gna2
+    gna1
+  R gna1