Show More
@@ -102,6 +102,24 b' class bundlespec:' | |||||
102 | _bundlespecv1compengines = {b'gzip', b'bzip2', b'none'} |
|
102 | _bundlespecv1compengines = {b'gzip', b'bzip2', b'none'} | |
103 |
|
103 | |||
104 |
|
104 | |||
|
105 | def param_bool(key, value): | |||
|
106 | """make a boolean out of a parameter value""" | |||
|
107 | b = stringutil.parsebool(value) | |||
|
108 | if b is None: | |||
|
109 | msg = _(b"parameter %s should be a boolean ('%s')") | |||
|
110 | msg %= (key, value) | |||
|
111 | raise error.InvalidBundleSpecification(msg) | |||
|
112 | return b | |||
|
113 | ||||
|
114 | ||||
|
115 | # mapping of known parameter name need their value processed | |||
|
116 | bundle_spec_param_processing = { | |||
|
117 | b"obsolescence": param_bool, | |||
|
118 | b"obsolescence-mandatory": param_bool, | |||
|
119 | b"phases": param_bool, | |||
|
120 | } | |||
|
121 | ||||
|
122 | ||||
105 | def _parseparams(s): |
|
123 | def _parseparams(s): | |
106 | """parse bundlespec parameter section |
|
124 | """parse bundlespec parameter section | |
107 |
|
125 | |||
@@ -124,6 +142,9 b' def _parseparams(s):' | |||||
124 | key, value = p.split(b'=', 1) |
|
142 | key, value = p.split(b'=', 1) | |
125 | key = urlreq.unquote(key) |
|
143 | key = urlreq.unquote(key) | |
126 | value = urlreq.unquote(value) |
|
144 | value = urlreq.unquote(value) | |
|
145 | process = bundle_spec_param_processing.get(key) | |||
|
146 | if process is not None: | |||
|
147 | value = process(key, value) | |||
127 | params[key] = value |
|
148 | params[key] = value | |
128 |
|
149 | |||
129 | return version, params |
|
150 | return version, params |
@@ -1498,9 +1498,6 b' Test bundlespec overwrite default' | |||||
1498 | 1 changesets found |
|
1498 | 1 changesets found | |
1499 | $ hg debugbundle bundle-type-without-obs --part-type obsmarkers |
|
1499 | $ hg debugbundle bundle-type-without-obs --part-type obsmarkers | |
1500 | Stream params: {Compression: BZ} |
|
1500 | Stream params: {Compression: BZ} | |
1501 | obsmarkers -- {} (mandatory: True) (known-bad-output !) |
|
|||
1502 | version: 1 (50 bytes) (known-bad-output !) |
|
|||
1503 | 1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} (known-bad-output !) |
|
|||
1504 |
|
1501 | |||
1505 | Test bundlespec overwrite local config |
|
1502 | Test bundlespec overwrite local config | |
1506 | -------------------------------------- |
|
1503 | -------------------------------------- | |
@@ -1516,6 +1513,3 b' Test bundlespec overwrite local config' | |||||
1516 | 1 changesets found |
|
1513 | 1 changesets found | |
1517 | $ hg debugbundle bundle-type-without-obs2 --part-type obsmarkers |
|
1514 | $ hg debugbundle bundle-type-without-obs2 --part-type obsmarkers | |
1518 | Stream params: {Compression: BZ} |
|
1515 | Stream params: {Compression: BZ} | |
1519 | obsmarkers -- {} (mandatory: True) (known-bad-output !) |
|
|||
1520 | version: 1 (50 bytes) (known-bad-output !) |
|
|||
1521 | 1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} (known-bad-output !) |
|
General Comments 0
You need to be logged in to leave comments.
Login now