# HG changeset patch # User Pierre-Yves David # Date 1684538569 -7200 # Node ID 58e4842fbfc15e82776075a0b04fcfdd8089531f # Parent f697af01568302296af58fed54bfdee12eab35bd stream-clone: bail-out earlier if stream clone is not requested The `canperformstreamclone` function is bit messy. However it seems clearer to me to check if a stream-clone have been requested by the client or the server at all, before checking if a compatible protocol can be negotiated with the server. So I am doing some gratuitous movement so reorder conditional. diff -r f697af015683 -r 58e4842fbfc1 mercurial/streamclone.py --- a/mercurial/streamclone.py Sat May 20 01:19:26 2023 +0200 +++ b/mercurial/streamclone.py Sat May 20 01:22:49 2023 +0200 @@ -69,6 +69,16 @@ repo = pullop.repo remote = pullop.remote + # should we consider streaming clone at all ? + streamrequested = pullop.streamclonerequested + # If we don't have a preference, let the server decide for us. This + # likely only comes into play in LANs. + if streamrequested is None: + # The server can advertise whether to prefer streaming clone. + streamrequested = remote.capable(b'stream-preferred') + if not streamrequested: + return False, None + # Streaming clone only works on an empty destination repository if len(repo): return False, None @@ -92,17 +102,6 @@ elif bundle2 and not bundle2supported: return False, None - streamrequested = pullop.streamclonerequested - - # If we don't have a preference, let the server decide for us. This - # likely only comes into play in LANs. - if streamrequested is None: - # The server can advertise whether to prefer streaming clone. - streamrequested = remote.capable(b'stream-preferred') - - if not streamrequested: - return False, None - # In order for stream clone to work, the client has to support all the # requirements advertised by the server. #