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