Show More
@@ -3,6 +3,8 b'' | |||
|
3 | 3 | # This software may be used and distributed according to the terms of the |
|
4 | 4 | # GNU General Public License version 2 or any later version. |
|
5 | 5 | |
|
6 | import collections | |
|
7 | ||
|
6 | 8 | from .i18n import _ |
|
7 | 9 | |
|
8 | 10 | from .thirdparty import attr |
@@ -26,8 +28,25 b' class bundlespec:' | |||
|
26 | 28 | wirecompression = attr.ib() |
|
27 | 29 | version = attr.ib() |
|
28 | 30 | wireversion = attr.ib() |
|
29 | params = attr.ib() | |
|
30 |
|
|
|
31 | # parameters explicitly overwritten by the config or the specification | |
|
32 | _explicit_params = attr.ib() | |
|
33 | # default parameter for the version | |
|
34 | # | |
|
35 | # Keeping it separated is useful to check what was actually overwritten. | |
|
36 | _default_opts = attr.ib() | |
|
37 | ||
|
38 | @property | |
|
39 | def params(self): | |
|
40 | return collections.ChainMap(self._explicit_params, self._default_opts) | |
|
41 | ||
|
42 | @property | |
|
43 | def contentopts(self): | |
|
44 | # kept for Backward Compatibility concerns. | |
|
45 | return self.params | |
|
46 | ||
|
47 | def set_param(self, key, value): | |
|
48 | """overwrite a parameter value""" | |
|
49 | self._explicit_params[key] = value | |
|
31 | 50 | |
|
32 | 51 | |
|
33 | 52 | # Maps bundle version human names to changegroup versions. |
@@ -1570,7 +1570,7 b' def bundle(ui, repo, fname, *dests, **op' | |||
|
1570 | 1570 | pycompat.bytestr(e), |
|
1571 | 1571 | hint=_(b"see 'hg help bundlespec' for supported values for --type"), |
|
1572 | 1572 | ) |
|
1573 |
cgversion = bundlespec. |
|
|
1573 | cgversion = bundlespec.params[b"cg.version"] | |
|
1574 | 1574 | |
|
1575 | 1575 | # Packed bundles are a pseudo bundle format for now. |
|
1576 | 1576 | if cgversion == b's1': |
@@ -1680,14 +1680,12 b' def bundle(ui, repo, fname, *dests, **op' | |||
|
1680 | 1680 | # Bundling of obsmarker and phases is optional as not all clients |
|
1681 | 1681 | # support the necessary features. |
|
1682 | 1682 | cfg = ui.configbool |
|
1683 | contentopts = { | |
|
1684 | b'obsolescence': cfg(b'experimental', b'evolution.bundle-obsmarker'), | |
|
1685 | b'obsolescence-mandatory': cfg( | |
|
1686 | b'experimental', b'evolution.bundle-obsmarker:mandatory' | |
|
1687 | ), | |
|
1688 | b'phases': cfg(b'experimental', b'bundle-phases'), | |
|
1689 | } | |
|
1690 | bundlespec.contentopts.update(contentopts) | |
|
1683 | obsolescence_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker') | |
|
1684 | bundlespec.set_param(b'obsolescence', obsolescence_cfg) | |
|
1685 | obs_mand_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker:mandatory') | |
|
1686 | bundlespec.set_param(b'obsolescence-mandatory', obs_mand_cfg) | |
|
1687 | phases_cfg = cfg(b'experimental', b'bundle-phases') | |
|
1688 | bundlespec.set_param(b'phases', phases_cfg) | |
|
1691 | 1689 | |
|
1692 | 1690 | bundle2.writenewbundle( |
|
1693 | 1691 | ui, |
@@ -1696,7 +1694,7 b' def bundle(ui, repo, fname, *dests, **op' | |||
|
1696 | 1694 | fname, |
|
1697 | 1695 | bversion, |
|
1698 | 1696 | outgoing, |
|
1699 |
bundlespec. |
|
|
1697 | bundlespec.params, | |
|
1700 | 1698 | compression=bcompression, |
|
1701 | 1699 | compopts=compopts, |
|
1702 | 1700 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now