stream-clone: bail-out earlier if pull is partial
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 20 May 2023 01:19:26 +0200
changeset 50521 f697af015683
parent 50520 0558866957fa
child 50522 58e4842fbfc1
stream-clone: bail-out earlier if pull is partial The `canperformstreamclone` function is bit messy. However it seems clearer to me to process the very generic condition about "can we consider a stream-clone at all", before checking if a stream-clone is requested and if a compatible protocol can be negotiated with the server. So I am doing some gratuitous movement so reorder conditional.
mercurial/streamclone.py
--- a/mercurial/streamclone.py	Sat May 20 01:17:27 2023 +0200
+++ b/mercurial/streamclone.py	Sat May 20 01:19:26 2023 +0200
@@ -73,6 +73,10 @@
     if len(repo):
         return False, None
 
+    # Streaming clone only works if all data is being requested.
+    if pullop.heads:
+        return False, None
+
     bundle2supported = False
     if pullop.canusebundle2:
         if b'v2' in pullop.remotebundle2caps.get(b'stream', []):
@@ -88,10 +92,6 @@
     elif bundle2 and not bundle2supported:
         return False, None
 
-    # Streaming clone only works if all data is being requested.
-    if pullop.heads:
-        return False, None
-
     streamrequested = pullop.streamclonerequested
 
     # If we don't have a preference, let the server decide for us. This