diff mercurial/bookmarks.py @ 22658:a8f0d8e4c80a

pull: gather explicit bookmark pulls with bookmark updates There is no reason to make them at different times. So we gather them. This is the first step toward merging them.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 28 Sep 2014 13:43:31 -0700
parents 15bc5ea297f5
children 798185707833
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Sun Sep 28 12:47:25 2014 -0700
+++ b/mercurial/bookmarks.py	Sun Sep 28 13:43:31 2014 -0700
@@ -347,7 +347,7 @@
             n = '%s@%s' % (b, p)
     return n
 
-def updatefromremote(ui, repo, remotemarks, path):
+def updatefromremote(ui, repo, remotemarks, path, explicit=()):
     ui.debug("checking for updated bookmarks\n")
     localmarks = repo._bookmarks
     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
@@ -375,6 +375,14 @@
             localmarks[b] = node
             writer(msg)
         localmarks.write()
+    # update specified bookmarks
+    if explicit:
+        marks = repo._bookmarks
+        for b in explicit:
+            # explicit pull overrides local bookmark if any
+            repo.ui.status(_("importing bookmark %s\n") % b)
+            marks[b] = repo[remotemarks[b]].node()
+        marks.write()
 
 def diff(ui, dst, src):
     ui.status(_("searching for changed bookmarks\n"))