comparison mercurial/bundle2.py @ 51555:c4aab3661f25

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 02 Apr 2024 21:53:17 +0200
parents 780fc16b62e6
children f28c52a9f7b4
comparison
equal deleted inserted replaced
51554:cc44b3df9bb4 51555:c4aab3661f25
1726 raise error.ProgrammingError(msg) 1726 raise error.ProgrammingError(msg)
1727 1727
1728 caps = {} 1728 caps = {}
1729 if opts.get(b'obsolescence', False): 1729 if opts.get(b'obsolescence', False):
1730 caps[b'obsmarkers'] = (b'V1',) 1730 caps[b'obsmarkers'] = (b'V1',)
1731 if opts.get(b'streamv2'): 1731 stream_version = opts.get(b'stream', b"")
1732 if stream_version == b"v2":
1732 caps[b'stream'] = [b'v2'] 1733 caps[b'stream'] = [b'v2']
1733 elif opts.get(b'streamv3-exp'): 1734 elif stream_version == b"v3-exp":
1734 caps[b'stream'] = [b'v3-exp'] 1735 caps[b'stream'] = [b'v3-exp']
1735 bundle = bundle20(ui, caps) 1736 bundle = bundle20(ui, caps)
1736 bundle.setcompression(compression, compopts) 1737 bundle.setcompression(compression, compopts)
1737 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts) 1738 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts)
1738 chunkiter = bundle.getchunks() 1739 chunkiter = bundle.getchunks()
1772 mandatory=False, 1773 mandatory=False,
1773 ) 1774 )
1774 if repository.REPO_FEATURE_SIDE_DATA in repo.features: 1775 if repository.REPO_FEATURE_SIDE_DATA in repo.features:
1775 part.addparam(b'exp-sidedata', b'1') 1776 part.addparam(b'exp-sidedata', b'1')
1776 1777
1777 if opts.get(b'streamv2', False): 1778 if opts.get(b'stream', b"") == b"v2":
1778 addpartbundlestream2(bundler, repo, stream=True) 1779 addpartbundlestream2(bundler, repo, stream=True)
1779 1780
1780 if opts.get(b'streamv3-exp', False): 1781 if opts.get(b'stream', b"") == b"v3-exp":
1781 addpartbundlestream2(bundler, repo, stream=True) 1782 addpartbundlestream2(bundler, repo, stream=True)
1782 1783
1783 if opts.get(b'tagsfnodescache', True): 1784 if opts.get(b'tagsfnodescache', True):
1784 addparttagsfnodescache(repo, bundler, outgoing) 1785 addparttagsfnodescache(repo, bundler, outgoing)
1785 1786