pull: perform bookmark updates in the transaction
authorPierre-Yves David <pierre-yves.david@fb.com>
Sun, 28 Sep 2014 15:21:38 -0700
changeset 22666 0f8120c1ecf5
parent 22665 8319f7e78395
child 22667 3acc3f95548c
pull: perform bookmark updates in the transaction
mercurial/bookmarks.py
mercurial/exchange.py
--- a/mercurial/bookmarks.py	Sun Sep 28 00:41:55 2014 -0700
+++ b/mercurial/bookmarks.py	Sun Sep 28 15:21:38 2014 -0700
@@ -357,7 +357,7 @@
             n = '%s@%s' % (b, p)
     return n
 
-def updatefromremote(ui, repo, remotemarks, path, explicit=()):
+def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()):
     ui.debug("checking for updated bookmarks\n")
     localmarks = repo._bookmarks
     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
@@ -397,10 +397,11 @@
                             _("importing bookmark %s\n") % (b, b)))
 
     if changed:
+        tr = trfunc()
         for b, node, writer, msg in sorted(changed):
             localmarks[b] = node
             writer(msg)
-        localmarks.write()
+        localmarks.recordchange(tr)
 
 def diff(ui, dst, src):
     ui.status(_("searching for changed bookmarks\n"))
--- a/mercurial/exchange.py	Sun Sep 28 00:41:55 2014 -0700
+++ b/mercurial/exchange.py	Sun Sep 28 15:21:38 2014 -0700
@@ -1015,6 +1015,7 @@
     remotebookmarks = pullop.remotebookmarks
     bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
                              pullop.remote.url(),
+                             pullop.gettransaction,
                              explicit=pullop.explicitbookmarks)
 
 def _pullobsolete(pullop):