[PATCH] bundle2: pull bookmark the old way if no bundle2 liskeys support (issue4701)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Jun 8 15:46:36 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433795558 25200
#      Mon Jun 08 13:32:38 2015 -0700
# Node ID ffe937d583d702dae10af83989695def011a6297
# Parent  6fabde6ef4453ee6c2aa964184f6cf2c54483621
bundle2: pull bookmark the old way if no bundle2 liskeys support (issue4701)

All known servers implementation have listkeys support with bundle2, but people
in the process of implementing new server may not. Let's be nice with them.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -953,12 +953,16 @@ def _pullbookmarkbundle1(pullop):
 
     If not using bundle2, we have to fetch bookmarks before changeset
     discovery to reduce the chance and impact of race conditions."""
     if pullop.remotebookmarks is not None:
         return
-    if not _canusebundle2(pullop): # all bundle2 server now support listkeys
-        pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
+    if (_canusebundle2(pullop)
+            and 'listkeys' in bundle2.bundle2caps(pullop.remote)):
+        # all known bundle2 server now support listkeys, but lets be nice with
+        # new implementation.
+        return
+    pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
 
 
 @pulldiscovery('changegroup')
 def _pulldiscoverychangegroup(pullop):
     """discovery phase for the pull


More information about the Mercurial-devel mailing list