# HG changeset patch # User Pierre-Yves David # Date 2024-04-02 19:53:17 # Node ID c4aab3661f254d0619aeaafbbfde89c124c784eb # Parent cc44b3df9bb4d6b3e53c3f6e23a42a4a832fbc09 bundlespec: rationalize the way we specify stream bundle version Instead of having weird dedicated option for each version (v2, v3, etc) we reuse the same "stream" parameters. This is consistent with the ability to request a stream clone using "none-v2;stream=v2". This changeset introduce no user visible change, this is pure internal cleaning. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1728,9 +1728,10 @@ def writenewbundle( caps = {} if opts.get(b'obsolescence', False): caps[b'obsmarkers'] = (b'V1',) - if opts.get(b'streamv2'): + stream_version = opts.get(b'stream', b"") + if stream_version == b"v2": caps[b'stream'] = [b'v2'] - elif opts.get(b'streamv3-exp'): + elif stream_version == b"v3-exp": caps[b'stream'] = [b'v3-exp'] bundle = bundle20(ui, caps) bundle.setcompression(compression, compopts) @@ -1774,10 +1775,10 @@ def _addpartsfromopts(ui, repo, bundler, if repository.REPO_FEATURE_SIDE_DATA in repo.features: part.addparam(b'exp-sidedata', b'1') - if opts.get(b'streamv2', False): + if opts.get(b'stream', b"") == b"v2": addpartbundlestream2(bundler, repo, stream=True) - if opts.get(b'streamv3-exp', False): + if opts.get(b'stream', b"") == b"v3-exp": addpartbundlestream2(bundler, repo, stream=True) if opts.get(b'tagsfnodescache', True): diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -136,7 +136,7 @@ class bundlespec: b'cg.version': b'02', b'obsolescence': False, b'phases': False, - b"streamv2": True, + b"stream": "v2", b'tagsfnodescache': False, b'revbranchcache': False, }, @@ -145,7 +145,7 @@ class bundlespec: b'cg.version': b'03', b'obsolescence': False, b'phases': False, - b"streamv3-exp": True, + b"stream": "v3-exp", b'tagsfnodescache': False, b'revbranchcache': False, }, @@ -388,10 +388,7 @@ def isstreamclonespec(bundlespec): if ( bundlespec.wirecompression == b'UN' and bundlespec.wireversion == b'02' - and ( - bundlespec.contentopts.get(b'streamv2') - or bundlespec.contentopts.get(b'streamv3-exp') - ) + and bundlespec.contentopts.get(b'stream', None) in (b"v2", b"v3-exp") ): return True