diff -r 62ab9ca90b36 -r fb74a5833467 mercurial/commands.py --- 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