mercurial/exchange.py
changeset 25369 02defdb1b628
parent 25337 636b1f1b9f8d
child 25402 0c2ded041d10
--- a/mercurial/exchange.py	Thu May 28 14:01:53 2015 -0700
+++ b/mercurial/exchange.py	Wed May 27 04:57:03 2015 -0700
@@ -895,7 +895,6 @@
                     " %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 @@
         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