Show More
@@ -17,7 +17,7 b' from . import (' | |||
|
17 | 17 | util, |
|
18 | 18 | ) |
|
19 | 19 | |
|
20 | def canperformstreamclone(repo, remote, heads, streamrequested=None): | |
|
20 | def canperformstreamclone(pullop): | |
|
21 | 21 | """Whether it is possible to perform a streaming clone as part of pull. |
|
22 | 22 | |
|
23 | 23 | Returns a tuple of (supported, requirements). ``supported`` is True if |
@@ -25,14 +25,19 b' def canperformstreamclone(repo, remote, ' | |||
|
25 | 25 | a set of repo requirements from the remote, or ``None`` if stream clone |
|
26 | 26 | isn't supported. |
|
27 | 27 | """ |
|
28 | repo = pullop.repo | |
|
29 | remote = pullop.remote | |
|
30 | ||
|
28 | 31 | # Streaming clone only works on empty repositories. |
|
29 | 32 | if len(repo): |
|
30 | 33 | return False, None |
|
31 | 34 | |
|
32 | 35 | # Streaming clone only works if all data is being requested. |
|
33 | if heads: | |
|
36 | if pullop.heads: | |
|
34 | 37 | return False, None |
|
35 | 38 | |
|
39 | streamrequested = pullop.streamclonerequested | |
|
40 | ||
|
36 | 41 | # If we don't have a preference, let the server decide for us. This |
|
37 | 42 | # likely only comes into play in LANs. |
|
38 | 43 | if streamrequested is None: |
@@ -75,16 +80,14 b' def maybeperformlegacystreamclone(pullop' | |||
|
75 | 80 | A legacy stream clone will not be performed if a bundle2 stream clone is |
|
76 | 81 | supported. |
|
77 | 82 | """ |
|
78 | repo = pullop.repo | |
|
79 | remote = pullop.remote | |
|
80 | ||
|
81 | r = canperformstreamclone(repo, remote, pullop.heads, | |
|
82 | streamrequested=pullop.streamclonerequested) | |
|
83 | supported, requirements = r | |
|
83 | supported, requirements = canperformstreamclone(pullop) | |
|
84 | 84 | |
|
85 | 85 | if not supported: |
|
86 | 86 | return |
|
87 | 87 | |
|
88 | repo = pullop.repo | |
|
89 | remote = pullop.remote | |
|
90 | ||
|
88 | 91 | # Save remote branchmap. We will use it later to speed up branchcache |
|
89 | 92 | # creation. |
|
90 | 93 | rbranchmap = None |
General Comments 0
You need to be logged in to leave comments.
Login now