Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 22645:6e431e1635b6
pull: move bookmark movements inside the `exchange.pull`
There is no reason for bookmarks to get a special treatment. As a first step we
move the code as is in the `exchange.pull` function. Integration with the rest
of the flow will come later.
Adding bookmarks to pull means that most clone paths are now pulling bookmarks
through pull. We ensure that bookmark-update messages are properly suppressed in
that case.
In test-pull-http.t the 'requesting all changes' message disappear because we
now get the authentication error on the `listkeys`command before such message
is printed.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 26 Sep 2014 17:44:00 -0700 |
parents | 2805d23e1f88 |
children | 1d7a2422b90c |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu Oct 02 12:16:07 2014 -0500 +++ b/mercurial/exchange.py Fri Sep 26 17:44:00 2014 -0700 @@ -781,7 +781,7 @@ if self._tr is not None: self._tr.release() -def pull(repo, remote, heads=None, force=False): +def pull(repo, remote, heads=None, force=False, bookmarks=()): pullop = pulloperation(repo, remote, heads, force) if pullop.remote.local(): missing = set(pullop.remote.requirements) - pullop.repo.supported @@ -791,6 +791,7 @@ " %s") % (', '.join(sorted(missing))) raise util.Abort(msg) + remotebookmarks = remote.listkeys('bookmarks') lock = pullop.repo.lock() try: _pulldiscovery(pullop) @@ -807,6 +808,18 @@ finally: pullop.releasetransaction() lock.release() + bookmod.updatefromremote(repo.ui, repo, remotebookmarks, remote.url()) + # update specified bookmarks + if bookmarks: + marks = repo._bookmarks + writer = repo.ui.status + if repo.ui.configbool('ui', 'quietbookmarkmove', False): + writer = repo.ui.debug + for b in bookmarks: + # explicit pull overrides local bookmark if any + writer(_("importing bookmark %s\n") % b) + marks[b] = repo[remotebookmarks[b]].node() + marks.write() return pullop.cgresult