comparison mercurial/exchange.py @ 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 41dd7b2c7e15
comparison
equal deleted inserted replaced
26464:9a7fc6d48898 26465:eda32ee9962f
892 # We pulled a specific subset 892 # We pulled a specific subset
893 # sync on this subset 893 # sync on this subset
894 return self.heads 894 return self.heads
895 895
896 @util.propertycache 896 @util.propertycache
897 def canusebundle2(self):
898 return _canusebundle2(self)
899
900 @util.propertycache
897 def remotebundle2caps(self): 901 def remotebundle2caps(self):
898 return bundle2.bundle2caps(self.remote) 902 return bundle2.bundle2caps(self.remote)
899 903
900 def gettransaction(self): 904 def gettransaction(self):
901 # deprecated; talk to trmanager directly 905 # deprecated; talk to trmanager directly
968 lock = pullop.repo.lock() 972 lock = pullop.repo.lock()
969 try: 973 try:
970 pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) 974 pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
971 streamclone.maybeperformlegacystreamclone(pullop) 975 streamclone.maybeperformlegacystreamclone(pullop)
972 _pulldiscovery(pullop) 976 _pulldiscovery(pullop)
973 if _canusebundle2(pullop): 977 if pullop.canusebundle2:
974 _pullbundle2(pullop) 978 _pullbundle2(pullop)
975 _pullchangeset(pullop) 979 _pullchangeset(pullop)
976 _pullphase(pullop) 980 _pullphase(pullop)
977 _pullbookmarks(pullop) 981 _pullbookmarks(pullop)
978 _pullobsolete(pullop) 982 _pullobsolete(pullop)
1019 1023
1020 If not using bundle2, we have to fetch bookmarks before changeset 1024 If not using bundle2, we have to fetch bookmarks before changeset
1021 discovery to reduce the chance and impact of race conditions.""" 1025 discovery to reduce the chance and impact of race conditions."""
1022 if pullop.remotebookmarks is not None: 1026 if pullop.remotebookmarks is not None:
1023 return 1027 return
1024 if _canusebundle2(pullop) and 'listkeys' in pullop.remotebundle2caps: 1028 if pullop.canusebundle2 and 'listkeys' in pullop.remotebundle2caps:
1025 # all known bundle2 servers now support listkeys, but lets be nice with 1029 # all known bundle2 servers now support listkeys, but lets be nice with
1026 # new implementation. 1030 # new implementation.
1027 return 1031 return
1028 pullop.remotebookmarks = pullop.remote.listkeys('bookmarks') 1032 pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
1029 1033