Mercurial > hg
changeset 50520:0558866957fa
stream-clone: bail-out earlier if destination repo is not empty
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 20 May 2023 01:17:27 +0200 |
parents | 3c0da0fa0eed |
children | f697af015683 |
files | mercurial/streamclone.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Sun May 21 00:00:57 2023 +0200 +++ b/mercurial/streamclone.py Sat May 20 01:17:27 2023 +0200 @@ -69,6 +69,10 @@ repo = pullop.repo remote = pullop.remote + # Streaming clone only works on an empty destination repository + if len(repo): + return False, None + bundle2supported = False if pullop.canusebundle2: if b'v2' in pullop.remotebundle2caps.get(b'stream', []): @@ -84,10 +88,6 @@ elif bundle2 and not bundle2supported: return False, None - # Streaming clone only works on empty repositories. - if len(repo): - return False, None - # Streaming clone only works if all data is being requested. if pullop.heads: return False, None