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