amend: stop updating the bookmarks twice
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 30 Jun 2015 22:39:28 -0700
changeset 25694 5ede49f4383a
parent 25693 a6c1eac2fb1e
child 25695 ce3d4b858420
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 into cmdutil.
mercurial/cmdutil.py
mercurial/commands.py
--- a/mercurial/cmdutil.py	Tue Jun 30 22:36:49 2015 -0700
+++ b/mercurial/cmdutil.py	Tue Jun 30 22:39:28 2015 -0700
@@ -2614,6 +2614,8 @@
                 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
--- a/mercurial/commands.py	Tue Jun 30 22:36:49 2015 -0700
+++ b/mercurial/commands.py	Tue Jun 30 22:39:28 2015 -0700
@@ -1523,21 +1523,10 @@
                                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')