diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -895,7 +895,6 @@ def pull(repo, remote, heads=None, force " %s") % (', '.join(sorted(missing))) raise util.Abort(msg) - pullop.remotebookmarks = remote.listkeys('bookmarks') lock = pullop.repo.lock() try: pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) @@ -943,6 +942,16 @@ def _pulldiscovery(pullop): step = pulldiscoverymapping[stepname] step(pullop) +@pulldiscovery('b1:bookmarks') +def _pullbookmarkbundle1(pullop): + """fetch bookmark data in bundle1 case + + If not using bundle2, we have to fetch bookmarks before changeset + discovery to reduce the chance and impact of race conditions.""" + if not _canusebundle2(pullop): # all bundle2 server now support listkeys + pullop.remotebookmarks = pullop.remote.listkeys('bookmarks') + + @pulldiscovery('changegroup') def _pulldiscoverychangegroup(pullop): """discovery phase for the pull