Show More
@@ -2269,6 +2269,10 b' def config(ui, repo, *values, **opts):' | |||||
2269 | fm.write(b'name value', b'%s=%s\n', entryname, value) |
|
2269 | fm.write(b'name value', b'%s=%s\n', entryname, value) | |
2270 | if formatter.isprintable(defaultvalue): |
|
2270 | if formatter.isprintable(defaultvalue): | |
2271 | fm.data(defaultvalue=defaultvalue) |
|
2271 | fm.data(defaultvalue=defaultvalue) | |
|
2272 | elif isinstance(defaultvalue, list) and all( | |||
|
2273 | formatter.isprintable(e) for e in defaultvalue | |||
|
2274 | ): | |||
|
2275 | fm.data(defaultvalue=fm.formatlist(defaultvalue, name=b'value')) | |||
2272 | # TODO: no idea how to process unsupported defaultvalue types |
|
2276 | # TODO: no idea how to process unsupported defaultvalue types | |
2273 | matched = True |
|
2277 | matched = True | |
2274 | fm.end() |
|
2278 | fm.end() |
@@ -186,6 +186,7 b' Test config default of various types:' | |||||
186 | $ hg config --config commands.show.aliasprefix= commands -Tjson |
|
186 | $ hg config --config commands.show.aliasprefix= commands -Tjson | |
187 | [ |
|
187 | [ | |
188 | { |
|
188 | { | |
|
189 | "defaultvalue": [], | |||
189 | "name": "commands.show.aliasprefix", |
|
190 | "name": "commands.show.aliasprefix", | |
190 | "source": "--config", |
|
191 | "source": "--config", | |
191 | "value": "" |
|
192 | "value": "" | |
@@ -193,7 +194,7 b' Test config default of various types:' | |||||
193 | ] |
|
194 | ] | |
194 | $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)' |
|
195 | $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)' | |
195 | [ |
|
196 | [ | |
196 |
{"defaultvalue": |
|
197 | {"defaultvalue": []} | |
197 | ] |
|
198 | ] | |
198 | $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n' |
|
199 | $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n' | |
199 |
|
200 | |||
@@ -203,6 +204,7 b' Test config default of various types:' | |||||
203 | $ hg config --config progress.format= progress -Tjson |
|
204 | $ hg config --config progress.format= progress -Tjson | |
204 | [ |
|
205 | [ | |
205 | { |
|
206 | { | |
|
207 | "defaultvalue": ["topic", "bar", "number", "estimate"], | |||
206 | "name": "progress.format", |
|
208 | "name": "progress.format", | |
207 | "source": "--config", |
|
209 | "source": "--config", | |
208 | "value": "" |
|
210 | "value": "" | |
@@ -210,10 +212,10 b' Test config default of various types:' | |||||
210 | ] |
|
212 | ] | |
211 | $ hg config --config progress.format= progress -T'json(defaultvalue)' |
|
213 | $ hg config --config progress.format= progress -T'json(defaultvalue)' | |
212 | [ |
|
214 | [ | |
213 | {"defaultvalue": ""} |
|
215 | {"defaultvalue": ["topic", "bar", "number", "estimate"]} | |
214 | ] |
|
216 | ] | |
215 | $ hg config --config progress.format= progress -T'{defaultvalue}\n' |
|
217 | $ hg config --config progress.format= progress -T'{defaultvalue}\n' | |
216 |
|
218 | topic bar number estimate | ||
217 |
|
219 | |||
218 | int |
|
220 | int | |
219 |
|
221 |
General Comments 0
You need to be logged in to leave comments.
Login now