changeset 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 f4e39ceb064a
children 798185707833
files mercurial/bookmarks.py mercurial/exchange.py
diffstat 2 files changed, 11 insertions(+), 13 deletions(-) [+]
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"))
--- a/mercurial/exchange.py	Sun Sep 28 12:47:25 2014 -0700
+++ b/mercurial/exchange.py	Sun Sep 28 13:43:31 2014 -0700
@@ -1014,18 +1014,8 @@
     repo = pullop.repo
     remotebookmarks = pullop.remotebookmarks
     bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
-                             pullop.remote.url())
-    # update specified bookmarks
-    if pullop.explicitbookmarks:
-        marks = repo._bookmarks
-        writer = repo.ui.status
-        if repo.ui.configbool('ui', 'quietbookmarkmove', False):
-            writer = repo.ui.debug
-        for b in pullop.explicitbookmarks:
-            # explicit pull overrides local bookmark if any
-            writer(_("importing bookmark %s\n") % b)
-            marks[b] = repo[remotebookmarks[b]].node()
-        marks.write()
+                             pullop.remote.url(),
+                             explicit=pullop.explicitbookmarks)
 
 def _pullobsolete(pullop):
     """utility function to pull obsolete markers from a remote