# HG changeset patch # User Pierre-Yves David # Date 2014-09-26 00:53:27 # Node ID fb74a58334678e562a30e512c281f4d300d45aa5 # Parent 62ab9ca90b367845075c3e68806c6e8588c69fc4 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4961,6 +4961,14 @@ def pull(ui, repo, source="default", **o 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 @@ def pull(ui, repo, source="default", **o 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 diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t --- a/tests/test-bundle2.t +++ b/tests/test-bundle2.t @@ -907,8 +907,8 @@ pull over ssh added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers updating bookmark book_02de + importing bookmark book_02de (run 'hg heads' to see heads, 'hg merge' to merge) - importing bookmark book_02de $ hg -R other debugobsolete 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} @@ -929,8 +929,8 @@ pull over http added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers updating bookmark book_42cc + importing bookmark book_42cc (run 'hg heads .' to see heads, 'hg merge' to merge) - importing bookmark book_42cc $ cat main-error.log $ hg -R other debugobsolete 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}