##// END OF EJS Templates
streamclone: rework canperformstreamclone...
Boris Feld -
r35775:bbf7abd0 default
parent child Browse files
Show More
@@ -18,12 +18,11 b' from . import ('
18 18 util,
19 19 )
20 20
21 def canperformstreamclone(pullop, bailifbundle2supported=False):
21 def canperformstreamclone(pullop, bundle2=False):
22 22 """Whether it is possible to perform a streaming clone as part of pull.
23 23
24 ``bailifbundle2supported`` will cause the function to return False if
25 bundle2 stream clones are supported. It should only be called by the
26 legacy stream clone code path.
24 ``bundle2`` will cause the function to consider stream clone through
25 bundle2 and only through bundle2.
27 26
28 27 Returns a tuple of (supported, requirements). ``supported`` is True if
29 28 streaming clone is supported and False otherwise. ``requirements`` is
@@ -35,18 +34,18 b' def canperformstreamclone(pullop, bailif'
35 34
36 35 bundle2supported = False
37 36 if pullop.canusebundle2:
38 if 'v1' in pullop.remotebundle2caps.get('stream', []):
37 if 'v2' in pullop.remotebundle2caps.get('stream', []):
39 38 bundle2supported = True
40 39 # else
41 40 # Server doesn't support bundle2 stream clone or doesn't support
42 41 # the versions we support. Fall back and possibly allow legacy.
43 42
44 43 # Ensures legacy code path uses available bundle2.
45 if bailifbundle2supported and bundle2supported:
44 if bundle2supported and not bundle2:
46 45 return False, None
47 46 # Ensures bundle2 doesn't try to do a stream clone if it isn't supported.
48 #elif not bailifbundle2supported and not bundle2supported:
49 # return False, None
47 elif bundle2 and not bundle2supported:
48 return False, None
50 49
51 50 # Streaming clone only works on empty repositories.
52 51 if len(repo):
General Comments 0
You need to be logged in to leave comments. Login now