diff mercurial/commands.py @ 22626:fb74a5833467

pull: gather all bookmark-pulling code together Pulling bookmarks is done in two rounds. First we do a simple update, then we use the content of the `bookmark` argument to possibly overwrite some bookmark with their remote location. The second step was not done right after the first one for some obscure reason. We now perform them one after the other.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 25 Sep 2014 17:53:27 -0700
parents 62ab9ca90b36
children e48a5d3996c2
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Sep 25 02:53:29 2014 -0700
+++ b/mercurial/commands.py	Thu Sep 25 17:53:27 2014 -0700
@@ -4961,6 +4961,14 @@
 
         modheads = repo.pull(other, heads=revs, force=opts.get('force'))
         bookmarks.updatefromremote(ui, repo, remotebookmarks, source)
+        # update specified bookmarks
+        if opts.get('bookmark'):
+            marks = repo._bookmarks
+            for b in opts['bookmark']:
+                # explicit pull overrides local bookmark if any
+                ui.status(_("importing bookmark %s\n") % b)
+                marks[b] = repo[remotebookmarks[b]].node()
+            marks.write()
         if checkout:
             checkout = str(repo.changelog.rev(other.lookup(checkout)))
         repo._subtoppath = source
@@ -4970,14 +4978,6 @@
         finally:
             del repo._subtoppath
 
-        # update specified bookmarks
-        if opts.get('bookmark'):
-            marks = repo._bookmarks
-            for b in opts['bookmark']:
-                # explicit pull overrides local bookmark if any
-                ui.status(_("importing bookmark %s\n") % b)
-                marks[b] = repo[remotebookmarks[b]].node()
-            marks.write()
     finally:
         other.close()
     return ret