Mercurial > hg
changeset 50523:a6543983b8f4
stream-clone: check is a compatible protocol can be found
The previous code was explicitly checking if "v2" is listed in the "stream"
bundle2 capability. The new code is checking is there is anything common
between the versions supported client side and server side overlaps.
This prepare the introduction of more stream version than "v2".
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 20 May 2023 01:39:13 +0200 |
parents | 58e4842fbfc1 |
children | 58adcabc295f |
files | mercurial/streamclone.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Sat May 20 01:22:49 2023 +0200 +++ b/mercurial/streamclone.py Sat May 20 01:39:13 2023 +0200 @@ -15,6 +15,7 @@ from .interfaces import repository from . import ( bookmarks, + bundle2 as bundle2mod, cacheutil, error, narrowspec, @@ -89,8 +90,10 @@ bundle2supported = False if pullop.canusebundle2: - if b'v2' in pullop.remotebundle2caps.get(b'stream', []): - bundle2supported = True + local_caps = bundle2mod.getrepocaps(repo, role=b'client') + local_supported = set(local_caps.get(b'stream', [])) + remote_supported = set(pullop.remotebundle2caps.get(b'stream', [])) + bundle2supported = bool(local_supported & remote_supported) # else # Server doesn't support bundle2 stream clone or doesn't support # the versions we support. Fall back and possibly allow legacy.