equal
deleted
inserted
replaced
1 # bundlecaches.py - utility to deal with pre-computed bundle for servers |
1 # bundlecaches.py - utility to deal with pre-computed bundle for servers |
2 # |
2 # |
3 # This software may be used and distributed according to the terms of the |
3 # This software may be used and distributed according to the terms of the |
4 # GNU General Public License version 2 or any later version. |
4 # GNU General Public License version 2 or any later version. |
|
5 |
|
6 import collections |
5 |
7 |
6 from .i18n import _ |
8 from .i18n import _ |
7 |
9 |
8 from .thirdparty import attr |
10 from .thirdparty import attr |
9 |
11 |
24 class bundlespec: |
26 class bundlespec: |
25 compression = attr.ib() |
27 compression = attr.ib() |
26 wirecompression = attr.ib() |
28 wirecompression = attr.ib() |
27 version = attr.ib() |
29 version = attr.ib() |
28 wireversion = attr.ib() |
30 wireversion = attr.ib() |
29 params = attr.ib() |
31 # parameters explicitly overwritten by the config or the specification |
30 contentopts = attr.ib() |
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 # Maps bundle version human names to changegroup versions. |
52 # Maps bundle version human names to changegroup versions. |
34 _bundlespeccgversions = { |
53 _bundlespeccgversions = { |
35 b'v1': b'01', |
54 b'v1': b'01', |