[PATCH 3 of 5 modernize-streamclone] exchange: expose property on pulloperation for bundle2 availability
Gregory Szorc
gregory.szorc at gmail.com
Sun Oct 4 15:11:29 CDT 2015
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1443985410 25200
# Sun Oct 04 12:03:30 2015 -0700
# Node ID 1aa7ea121a54e5e2b6aaa3268452e7309fec7df5
# Parent bd70e2580060df39691b6e1106914e230efe079e
exchange: expose property on pulloperation for bundle2 availability
Like the previous patch, the value is cached and will prevent a function
level import in streamclone.py.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -884,8 +884,12 @@ class pulloperation(object):
# sync on this subset
return self.heads
@util.propertycache
+ def canusebundle2(self):
+ return _canusebundle2(self)
+
+ @util.propertycache
def bundle2caps(self):
return bundle2.bundle2caps(self.remote)
def gettransaction(self):
@@ -960,9 +964,9 @@ def pull(repo, remote, heads=None, force
try:
pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
streamclone.maybeperformlegacystreamclone(pullop)
_pulldiscovery(pullop)
- if _canusebundle2(pullop):
+ if pullop.canusebundle2:
_pullbundle2(pullop)
_pullchangeset(pullop)
_pullphase(pullop)
_pullbookmarks(pullop)
@@ -1011,9 +1015,9 @@ 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 _canusebundle2(pullop) and 'listkeys' in pullop.bundle2caps:
+ if pullop.canusebundle2 and 'listkeys' in pullop.bundle2caps:
# all known bundle2 servers now support listkeys, but lets be nice with
# new implementation.
return
pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
More information about the Mercurial-devel
mailing list