changeset 26465:eda32ee9962f

exchange: expose bundle2 availability on pulloperation Like the previous patch, the value is cached and will prevent a function level import in streamclone.py.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 Oct 2015 12:03:30 -0700
parents 9a7fc6d48898
children 3515db5aae05
files mercurial/exchange.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Sun Oct 04 18:31:53 2015 -0700
+++ b/mercurial/exchange.py	Sun Oct 04 12:03:30 2015 -0700
@@ -894,6 +894,10 @@
             return self.heads
 
     @util.propertycache
+    def canusebundle2(self):
+        return _canusebundle2(self)
+
+    @util.propertycache
     def remotebundle2caps(self):
         return bundle2.bundle2caps(self.remote)
 
@@ -970,7 +974,7 @@
         pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
         streamclone.maybeperformlegacystreamclone(pullop)
         _pulldiscovery(pullop)
-        if _canusebundle2(pullop):
+        if pullop.canusebundle2:
             _pullbundle2(pullop)
         _pullchangeset(pullop)
         _pullphase(pullop)
@@ -1021,7 +1025,7 @@
     discovery to reduce the chance and impact of race conditions."""
     if pullop.remotebookmarks is not None:
         return
-    if _canusebundle2(pullop) and 'listkeys' in pullop.remotebundle2caps:
+    if pullop.canusebundle2 and 'listkeys' in pullop.remotebundle2caps:
         # all known bundle2 servers now support listkeys, but lets be nice with
         # new implementation.
         return