# HG changeset patch # User Matt Mackall # Date 2012-06-29 05:40:52 # Node ID fba17a64fa4978bfea19222da5e64a18cfddeecd # Parent d5422faf648cc589425cd3b0dbf1f6dbf93036a0 # Parent 2440822446ce248175dd597f0ec8df24d8d10217 merge with stable diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2925,6 +2925,10 @@ def strip(ui, repo, *revs, **opts): 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' diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -238,6 +238,9 @@ def rebase(ui, repo, **opts): # 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 @@ def rebase(ui, repo, **opts): 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 updatemq(repo, state, skipped, **opt 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) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1301,7 +1301,11 @@ def amend(ui, repo, commitfunc, old, ext 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: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2752,11 +2752,6 @@ def graft(ui, repo, *revs, **opts): 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 @@ def graft(ui, repo, *revs, **opts): 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: diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -138,6 +138,9 @@ def redirect(state): _redirect = state def hook(ui, repo, name, throw=False, **args): + if not ui.callhooks: + return False + r = False oldstdout = -1 diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -19,6 +19,7 @@ class ui(object): self._ucfg = config.config() # untrusted self._trustusers = set() self._trustgroups = set() + self.callhooks = True if src: self.fout = src.fout @@ -31,6 +32,7 @@ class ui(object): 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 diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -23,11 +23,17 @@ Nothing to amend: 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 diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -304,4 +304,57 @@ Graft with --log 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 diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t --- a/tests/test-rebase-bookmarks.t +++ b/tests/test-rebase-bookmarks.t @@ -36,8 +36,10 @@ Create a repo with several bookmarks 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 @@ Move only rebased bookmarks $ 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 @@ Keep bookmarks to the correct rebased ch | 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: