# HG changeset patch # User Pierre-Yves David # Date 2014-09-28 20:43:31 # Node ID a8f0d8e4c80a255086929fc8c65cc59cfa020816 # Parent f4e39ceb064a0caa17db87c7b553287cfa547552 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. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -347,7 +347,7 @@ def _diverge(ui, b, path, localmarks): 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 @@ def updatefromremote(ui, repo, remotemar 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")) diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1014,18 +1014,8 @@ def _pullbookmarks(pullop): 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