[PATCH 2 of 2] amend: stop updating the bookmarks twice
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Jul 1 01:04:28 CDT 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1435729168 25200
# Tue Jun 30 22:39:28 2015 -0700
# Node ID 36b3f896035ee0448824d5b8f74ba7553e25d04a
# Parent cc88486e842ce1cf3b696606b98505ae52031afc
amend: stop updating the bookmarks twice
There was code to move the bookmarks around both in the 'cmdutil' help and in
the main 'commit' function. We kill the 'commit' version as it is performed
outside the transaction.
The debug note is moved in cmdutil.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2612,10 +2612,12 @@ def amend(ui, repo, commitfunc, old, ext
# Move bookmarks from old parent to amend commit
bms = repo.nodebookmarks(old.node())
if bms:
marks = repo._bookmarks
for bm in bms:
+ ui.debug('moving bookmarks %r from %s to %s\n' %
+ (marks, old.hex(), hex(newid)))
marks[bm] = newid
marks.recordchange(tr)
#commit the whole amend process
createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
if createmarkers and newid != old.node():
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1521,25 +1521,14 @@ def commit(ui, repo, *pats, **opts):
opts.get('user') or old.user(),
opts.get('date') or old.date(),
match,
extra=extra)
- active = repo._activebookmark
- marks = old.bookmarks()
node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts)
if node == old.node():
ui.status(_("nothing changed\n"))
return 1
- elif marks:
- ui.debug('moving bookmarks %r from %s to %s\n' %
- (marks, old.hex(), hex(node)))
- newmarks = repo._bookmarks
- for bm in marks:
- newmarks[bm] = node
- if bm == active:
- bookmarks.activate(repo, bm)
- newmarks.write()
else:
def commitfunc(ui, repo, message, match, opts):
backup = ui.backupconfig('phases', 'new-commit')
baseui = repo.baseui
basebackup = baseui.backupconfig('phases', 'new-commit')
More information about the Mercurial-devel
mailing list