Mercurial > hg
comparison mercurial/commands.py @ 49325:bf66f7a1e3f8
bundlespec: merge the contentopts and params dictionnary
They are content using the same keys. Using differents object for access open
the gates for confusion in the code using them (this is already the case). So we
start fusing their usages to make the parameters more useful.
More work will be needed to make them really useful, but the first step is
here: not throwing the value away.
However this is still not making the previously introduced test useful because
currently, the default config value overwrite the one from the bundlespec. We
will fix this in the coming changesets.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 17 May 2022 16:36:32 +0100 |
parents | 2e726c934fcd |
children | 5bc3e76f919d |
comparison
equal
deleted
inserted
replaced
49324:61ba04693d65 | 49325:bf66f7a1e3f8 |
---|---|
1568 except error.UnsupportedBundleSpecification as e: | 1568 except error.UnsupportedBundleSpecification as e: |
1569 raise error.InputError( | 1569 raise error.InputError( |
1570 pycompat.bytestr(e), | 1570 pycompat.bytestr(e), |
1571 hint=_(b"see 'hg help bundlespec' for supported values for --type"), | 1571 hint=_(b"see 'hg help bundlespec' for supported values for --type"), |
1572 ) | 1572 ) |
1573 cgversion = bundlespec.contentopts[b"cg.version"] | 1573 cgversion = bundlespec.params[b"cg.version"] |
1574 | 1574 |
1575 # Packed bundles are a pseudo bundle format for now. | 1575 # Packed bundles are a pseudo bundle format for now. |
1576 if cgversion == b's1': | 1576 if cgversion == b's1': |
1577 raise error.InputError( | 1577 raise error.InputError( |
1578 _(b'packed bundles cannot be produced by "hg bundle"'), | 1578 _(b'packed bundles cannot be produced by "hg bundle"'), |
1678 compopts[b'threads'] = compthreads | 1678 compopts[b'threads'] = compthreads |
1679 | 1679 |
1680 # Bundling of obsmarker and phases is optional as not all clients | 1680 # Bundling of obsmarker and phases is optional as not all clients |
1681 # support the necessary features. | 1681 # support the necessary features. |
1682 cfg = ui.configbool | 1682 cfg = ui.configbool |
1683 contentopts = { | 1683 obsolescence_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker') |
1684 b'obsolescence': cfg(b'experimental', b'evolution.bundle-obsmarker'), | 1684 bundlespec.set_param(b'obsolescence', obsolescence_cfg) |
1685 b'obsolescence-mandatory': cfg( | 1685 obs_mand_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker:mandatory') |
1686 b'experimental', b'evolution.bundle-obsmarker:mandatory' | 1686 bundlespec.set_param(b'obsolescence-mandatory', obs_mand_cfg) |
1687 ), | 1687 phases_cfg = cfg(b'experimental', b'bundle-phases') |
1688 b'phases': cfg(b'experimental', b'bundle-phases'), | 1688 bundlespec.set_param(b'phases', phases_cfg) |
1689 } | |
1690 bundlespec.contentopts.update(contentopts) | |
1691 | 1689 |
1692 bundle2.writenewbundle( | 1690 bundle2.writenewbundle( |
1693 ui, | 1691 ui, |
1694 repo, | 1692 repo, |
1695 b'bundle', | 1693 b'bundle', |
1696 fname, | 1694 fname, |
1697 bversion, | 1695 bversion, |
1698 outgoing, | 1696 outgoing, |
1699 bundlespec.contentopts, | 1697 bundlespec.params, |
1700 compression=bcompression, | 1698 compression=bcompression, |
1701 compopts=compopts, | 1699 compopts=compopts, |
1702 ) | 1700 ) |
1703 | 1701 |
1704 | 1702 |