changeset 17059:fba17a64fa49

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Jun 2012 00:40:52 -0500
parents d5422faf648c (current diff) 2440822446ce (diff)
children 69fa0459dd3b
files hgext/mq.py hgext/rebase.py mercurial/cmdutil.py mercurial/commands.py mercurial/ui.py tests/test-commit-amend.t tests/test-graft.t tests/test-rebase-bookmarks.t
diffstat 9 files changed, 117 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/hgext/mq.py	Fri Jun 29 00:40:52 2012 -0500
@@ -2925,6 +2925,10 @@
     Use the --no-backup option to discard the backup bundle once the
     operation completes.
 
+    Strip is not a history-rewriting operation and can be used on
+    changesets in the public phase. But if the stripped changesets have
+    been pushed to a remote repository you will likely pull them again.
+
     Return 0 on success.
     """
     backup = 'all'
--- a/hgext/rebase.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/hgext/rebase.py	Fri Jun 29 00:40:52 2012 -0500
@@ -238,6 +238,9 @@
 
         # Keep track of the current bookmarks in order to reset them later
         currentbookmarks = repo._bookmarks.copy()
+        activebookmark = repo._bookmarkcurrent
+        if activebookmark:
+            bookmarks.unsetcurrent(repo)
 
         sortedstate = sorted(state)
         total = len(sortedstate)
@@ -327,6 +330,11 @@
             util.unlinkpath(repo.sjoin('undo'))
         if skipped:
             ui.note(_("%d revisions have been skipped\n") % len(skipped))
+
+        if (activebookmark and
+            repo['tip'].node() == repo._bookmarks[activebookmark]):
+                bookmarks.setcurrent(repo, activebookmark)
+
     finally:
         release(lock, wlock)
 
@@ -476,13 +484,11 @@
 
 def updatebookmarks(repo, nstate, originalbookmarks, **opts):
     'Move bookmarks to their correct changesets'
-    current = repo._bookmarkcurrent
     for k, v in originalbookmarks.iteritems():
         if v in nstate:
             if nstate[v] != nullmerge:
-                # reset the pointer if the bookmark was moved incorrectly
-                if k != current:
-                    repo._bookmarks[k] = nstate[v]
+                # update the bookmarks for revs that have moved
+                repo._bookmarks[k] = nstate[v]
 
     bookmarks.write(repo)
 
--- a/mercurial/cmdutil.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/mercurial/cmdutil.py	Fri Jun 29 00:40:52 2012 -0500
@@ -1301,7 +1301,11 @@
     try:
         # First, do a regular commit to record all changes in the working
         # directory (if there are any)
-        node = commit(ui, repo, commitfunc, pats, opts)
+        ui.callhooks = False
+        try:
+            node = commit(ui, repo, commitfunc, pats, opts)
+        finally:
+            ui.callhooks = True
         ctx = repo[node]
 
         # Participating changesets:
--- a/mercurial/commands.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/mercurial/commands.py	Fri Jun 29 00:40:52 2012 -0500
@@ -2752,11 +2752,6 @@
                                             ctx.p1().node())
                 finally:
                     repo.ui.setconfig('ui', 'forcemerge', '')
-                # drop the second merge parent
-                repo.setparents(current.node(), nullid)
-                repo.dirstate.write()
-                # fix up dirstate for copies and renames
-                cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
                 # report any conflicts
                 if stats and stats[3] > 0:
                     # write out state for --continue
@@ -2768,6 +2763,12 @@
             else:
                 cont = False
 
+            # drop the second merge parent
+            repo.setparents(current.node(), nullid)
+            repo.dirstate.write()
+            # fix up dirstate for copies and renames
+            cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
+
             # commit
             source = ctx.extra().get('source')
             if not source:
--- a/mercurial/hook.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/mercurial/hook.py	Fri Jun 29 00:40:52 2012 -0500
@@ -138,6 +138,9 @@
     _redirect = state
 
 def hook(ui, repo, name, throw=False, **args):
+    if not ui.callhooks:
+        return False
+
     r = False
 
     oldstdout = -1
--- a/mercurial/ui.py	Fri Jun 29 00:01:19 2012 +0200
+++ b/mercurial/ui.py	Fri Jun 29 00:40:52 2012 -0500
@@ -19,6 +19,7 @@
         self._ucfg = config.config() # untrusted
         self._trustusers = set()
         self._trustgroups = set()
+        self.callhooks = True
 
         if src:
             self.fout = src.fout
@@ -31,6 +32,7 @@
             self._trustusers = src._trustusers.copy()
             self._trustgroups = src._trustgroups.copy()
             self.environ = src.environ
+            self.callhooks = src.callhooks
             self.fixconfig()
         else:
             self.fout = sys.stdout
--- a/tests/test-commit-amend.t	Fri Jun 29 00:01:19 2012 +0200
+++ b/tests/test-commit-amend.t	Fri Jun 29 00:40:52 2012 -0500
@@ -23,11 +23,17 @@
   nothing changed
   [1]
 
+  $ echo '[hooks]' >> $HGRCPATH
+  $ echo 'pretxncommit.foo = echo "pretxncommit $HG_NODE"; hg id -r $HG_NODE' >> $HGRCPATH
+
 Amending changeset with changes in working dir:
 
   $ echo a >> a
   $ hg ci --amend -m 'amend base1'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg (glob)
+  pretxncommit 9cd25b479c51be2f4ed2c38e7abdf7ce67d8e0dc
+  9cd25b479c51 tip
+  saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg
+  $ echo 'pretxncommit.foo = ' >> $HGRCPATH
   $ hg diff -c .
   diff -r ad120869acf0 -r 9cd25b479c51 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
--- a/tests/test-graft.t	Fri Jun 29 00:01:19 2012 +0200
+++ b/tests/test-graft.t	Fri Jun 29 00:40:52 2012 -0500
@@ -304,4 +304,57 @@
   14 1:5d205f8b35b6  3
   (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
 
-  $ cd ..
+Resolve conflicted graft
+  $ hg up -q 0
+  $ echo b > a
+  $ hg ci -m 8
+  created new head
+  $ echo a > a
+  $ hg ci -m 9
+  $ hg graft 1 --tool internal:fail
+  grafting revision 1
+  abort: unresolved conflicts, can't continue
+  (use hg resolve and hg graft --continue)
+  [255]
+  $ hg resolve --all
+  merging a
+  $ hg graft -c
+  grafting revision 1
+  $ hg export tip --git
+  # HG changeset patch
+  # User bar
+  # Date 0 0
+  # Node ID 64ecd9071ce83c6e62f538d8ce7709d53f32ebf7
+  # Parent  4bdb9a9d0b84ffee1d30f0dfc7744cade17aa19c
+  1
+  
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -a
+  +b
+
+Resolve conflicted graft with rename
+  $ echo c > a
+  $ hg ci -m 10
+  $ hg graft 2 --tool internal:fail
+  grafting revision 2
+  abort: unresolved conflicts, can't continue
+  (use hg resolve and hg graft --continue)
+  [255]
+  $ hg resolve --all
+  merging a and b to b
+  $ hg graft -c
+  grafting revision 2
+  $ hg export tip --git
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  # Node ID 2e80e1351d6ed50302fe1e05f8bd1d4d412b6e11
+  # Parent  e5a51ae854a8bbaaf25cc5c6a57ff46042dadbb4
+  2
+  
+  diff --git a/a b/b
+  rename from a
+  rename to b
--- a/tests/test-rebase-bookmarks.t	Fri Jun 29 00:01:19 2012 +0200
+++ b/tests/test-rebase-bookmarks.t	Fri Jun 29 00:40:52 2012 -0500
@@ -36,8 +36,10 @@
   adding d
   created new head
 
+  $ hg book W
+
   $ hg tglog 
-  @  3: 'D' bookmarks:
+  @  3: 'D' bookmarks: W
   |
   | o  2: 'C' bookmarks: Y Z
   | |
@@ -60,7 +62,7 @@
   $ hg tglog 
   @  3: 'C' bookmarks: Y Z
   |
-  o  2: 'D' bookmarks:
+  o  2: 'D' bookmarks: W
   |
   | o  1: 'B' bookmarks: X
   |/
@@ -82,7 +84,28 @@
   |
   o  2: 'B' bookmarks: X
   |
-  o  1: 'D' bookmarks:
+  o  1: 'D' bookmarks: W
+  |
+  o  0: 'A' bookmarks:
+  
+
+Keep active bookmark on the correct changeset
+
+  $ cd ..
+  $ hg clone -q a a3
+
+  $ cd a3
+  $ hg up -q X
+
+  $ hg rebase -d W
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
+
+  $ hg tglog
+  @  3: 'C' bookmarks: Y Z
+  |
+  o  2: 'B' bookmarks: X
+  |
+  o  1: 'D' bookmarks: W
   |
   o  0: 'A' bookmarks: