merge with stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Sun, 11 May 2014 01:29:11 -0700
changeset 932 bcd0c12070b2
parent 922 ec4c17e0aee6 (current diff)
parent 931 32915143d448 (diff)
child 937 43cceb37324c
merge with stable
README
hgext/evolve.py
tests/test-prune.t
--- a/README	Wed Apr 23 15:58:55 2014 -0700
+++ b/README	Sun May 11 01:29:11 2014 -0700
@@ -29,7 +29,12 @@
 ==========
 
 The simplest way to contribute is to issue a pull request on Bitbucket
-(https://bitbucket.org/marmoute/mutable-history).
+(https://bitbucket.org/marmoute/mutable-history). Please don't forget
+to update and run the tests when you fix a bug or add a feature. To
+run the tests:
+
+    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.
@@ -62,6 +67,13 @@
     - avoid exchanging common markers in some case
  - add a hook related to the new commands
 
+3.3.2 --
+
+- fix a bug where evolve were creating changeset with 2 parents on windows
+  (fix issues #16, #35 and #42)
+- adds a --obsolete flag to import (requieres Mercurial 3.0)
+- prune: update to successor rather than parent when pruning '.' with -s
+
 3.3.1 -- 2014-04-23
 
 - various language fix
@@ -72,6 +84,15 @@
 
 3.3.0 -- 2014-03-04
 
+<<<<<<< local: 1205:ec4c17e0aee6   (default)
+======= base: 1196:fc04758ea9f5 3.3.1  (stable)
+- drop `latercomer` and `conflicting` compatibility. Those old alias are
+  deprecated for a long time now.
+=======
+- raise Mercurial's minimal requirement to 2.7
+- drop `latercomer` and `conflicting` compatibility. Those old alias are
+  deprecated for a long time now.
+>>>>>>> other: 1240:32915143d448 tip @ (stable)
 - add verbose hint about how to handle corner case by hand.
   This should help people until evolve is able to to it itself.
 - removed the qsync extension. The only user I knew about (logilab) is not
--- a/hgext/evolve.py	Wed Apr 23 15:58:55 2014 -0700
+++ b/hgext/evolve.py	Sun May 11 01:29:11 2014 -0700
@@ -57,6 +57,7 @@
 from mercurial import merge
 from mercurial import node
 from mercurial import phases
+from mercurial import patch
 from mercurial import revset
 from mercurial import scmutil
 from mercurial import templatekw
@@ -804,7 +805,10 @@
         destbookmarks = repo.nodebookmarks(dest.node())
         nodesrc = orig.node()
         destphase = repo[nodesrc].phase()
+        wlock = lock = None
         try:
+            wlock = repo.wlock()
+            lock = repo.lock()
             r = rebase.rebasenode(repo, orig.node(), dest.node(),
                                   {node.nullrev: node.nullrev}, False)
             if r[-1]: #some conflict
@@ -818,6 +822,8 @@
                 pass
             exc.__class__ = LocalMergeFailure
             raise
+        finally:
+            lockmod.release(lock, wlock)
         oldbookmarks = repo.nodebookmarks(nodesrc)
         if nodenew is not None:
             phases.retractboundary(repo, destphase, [nodenew])
@@ -869,6 +875,38 @@
      _('record the specified user in metadata'), _('USER')),
 ]
 
+if getattr(mercurial.cmdutil, 'tryimportone', None) is not None:
+    # hg 3.0 and greate
+    @eh.uisetup
+    def _installimportobsolete(ui):
+        entry = cmdutil.findcmd('import', commands.table)[1]
+        entry[1].append(('', 'obsolete', False,
+                        _('mark the old node as obsoleted by'
+                          'the created commit')))
+
+    @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
+    def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
+        extracted = patch.extract(ui, hunk)
+        expected = extracted[5]
+        oldextract = patch.extract
+        try:
+            patch.extract = lambda ui, hunk: extracted
+            ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
+        finally:
+            patch.extract = oldextract
+        created = ret[1]
+        if opts['obsolete'] and created is not None and created != expected:
+                tr = repo.transaction('import-obs')
+                try:
+                    metadata = {'user': ui.username()}
+                    repo.obsstore.create(tr, node.bin(expected), (created,),
+                                         metadata=metadata)
+                    tr.close()
+                finally:
+                    tr.release()
+        return ret
+
+
 def _deprecatealias(oldalias, newalias):
     '''Deprecates an alias for a command in favour of another
 
@@ -1672,7 +1710,7 @@
         for p in sortedrevs(revs):
             cp = repo[p]
             if not cp.mutable():
-                # note: create marker would had raise something anyway
+                # note: createmarkers() would have raised something anyway
                 raise util.Abort('cannot prune immutable changeset: %s' % cp,
                                  hint='see "hg help phases" for details')
             precs.append(cp)
@@ -1698,11 +1736,19 @@
 
         # informs that changeset have been pruned
         ui.status(_('%i changesets pruned\n') % len(precs))
-        # update to an unkilled parent
+
         wdp = repo['.']
-        newnode = wdp
-        while newnode.obsolete():
-            newnode = newnode.parents()[0]
+
+        if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
+            # '.' killed, so update to the successor
+            newnode = sucs[0]
+        else:
+            # update to an unkilled parent
+            newnode = wdp
+
+            while newnode.obsolete():
+                newnode = newnode.parents()[0]
+
         if newnode.node() != wdp.node():
             commands.update(ui, repo, newnode.rev())
             ui.status(_('working directory now at %s\n') % newnode)
@@ -1884,7 +1930,7 @@
             updatebookmarks(newid)
             if not repo[newid].files():
                 ui.warn(_("new changeset is empty\n"))
-                ui.status(_('(use "hg kill ." to remove it)\n'))
+                ui.status(_('(use "hg prune ." to remove it)\n'))
         finally:
             wlock.release()
     finally:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-import.t	Sun May 11 01:29:11 2014 -0700
@@ -0,0 +1,92 @@
+
+This feature requires mercurial 3.0
+(and the `only(` revset is 3.0 specific)
+
+  $ (hg help revset | grep ' only(') || exit 80
+
+Test creation of obsolescence marker by path import
+
+  $ hg init auto-obsolete
+  $ cd auto-obsolete
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo 'rebase=' >> $HGRCPATH
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+  $ echo A > a
+  $ hg commit -Am A
+  adding a
+  $ echo B > b
+  $ hg commit -Am B
+  adding b
+  $ hg up '.^'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo C > c
+  $ hg commit -Am C
+  adding c
+  created new head
+  $ hg log -G
+  @  changeset:   2:eb8dd0f31b51
+  |  tag:         tip
+  |  parent:      0:f2bbf19cf96d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     C
+  |
+  | o  changeset:   1:95b760afef3c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     B
+  |
+  o  changeset:   0:f2bbf19cf96d
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+
+(actual test)
+
+  $ hg export 'desc(B)' | hg import - --obsolete
+  applying patch from stdin
+  $ hg log -G
+  @  changeset:   3:00c49133f17e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     B
+  |
+  o  changeset:   2:eb8dd0f31b51
+  |  parent:      0:f2bbf19cf96d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     C
+  |
+  o  changeset:   0:f2bbf19cf96d
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  $ hg debugobsolete
+  95b760afef3c234ffb3f9fd391edcb36e60921a4 00c49133f17e5e5a52b6ef1b6d516c0e90b56d8a 0 {'date': '* *', 'user': 'test'} (glob)
+
+  $ hg rollback
+  repository tip rolled back to revision 2 (undo import)
+  working directory now based on revision 2
+  $ hg log -G
+  @  changeset:   2:eb8dd0f31b51
+  |  tag:         tip
+  |  parent:      0:f2bbf19cf96d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     C
+  |
+  | o  changeset:   1:95b760afef3c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     B
+  |
+  o  changeset:   0:f2bbf19cf96d
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  $ hg debugobsolete
+
--- a/tests/test-prune.t	Wed Apr 23 15:58:55 2014 -0700
+++ b/tests/test-prune.t	Sun May 11 01:29:11 2014 -0700
@@ -115,8 +115,12 @@
 
 one old, one new
 
+  $ hg up 'desc("add ee")'
+  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ hg prune 'desc("add ee")' -s 'desc("add nE")'
   1 changesets pruned
+  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  working directory now at 6e8148413dd5
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '314064000 0', ('p1': '47d2a3944de8b013de3be9578e8e344ea2e6c097', )?'user': 'blah'} (re)
   7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '\d+ \d+', ('p1': '1f0dee641bb7258c56bd60e93edfa2405381c41e', )?'user': 'test'} (re)
--- a/tests/test-uncommit.t	Wed Apr 23 15:58:55 2014 -0700
+++ b/tests/test-uncommit.t	Sun May 11 01:29:11 2014 -0700
@@ -316,7 +316,7 @@
 
   $ hg uncommit e
   new changeset is empty
-  (use "hg kill ." to remove it)
+  (use "hg prune ." to remove it)
   $ hg debugobsolete
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 e8db4aa611f6d5706374288e6898e498f5c44098 0 {'date': '* *', 'user': 'test'} (glob)
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c706fe2c12f83ba5010cb60ea6af3bd1f0c2d6d3 0 {'date': '* *', 'user': 'test'} (glob)