##// END OF EJS Templates
config: move showconfig code and add config as primary alias...
Matt Mackall -
r20570:c21e1e3a default
parent child Browse files
Show More
@@ -1461,6 +1461,52 b' def commit(ui, repo, *pats, **opts):'
1461
1461
1462 cmdutil.commitstatus(repo, node, branch, bheads, opts)
1462 cmdutil.commitstatus(repo, node, branch, bheads, opts)
1463
1463
1464 @command('config|showconfig|debugconfig',
1465 [('u', 'untrusted', None, _('show untrusted configuration options'))],
1466 _('[-u] [NAME]...'))
1467 def config(ui, repo, *values, **opts):
1468 """show combined config settings from all hgrc files
1469
1470 With no arguments, print names and values of all config items.
1471
1472 With one argument of the form section.name, print just the value
1473 of that config item.
1474
1475 With multiple arguments, print names and values of all config
1476 items with matching section names.
1477
1478 With --debug, the source (filename and line number) is printed
1479 for each config item.
1480
1481 Returns 0 on success.
1482 """
1483
1484 for f in scmutil.rcpath():
1485 ui.debug('read config from: %s\n' % f)
1486 untrusted = bool(opts.get('untrusted'))
1487 if values:
1488 sections = [v for v in values if '.' not in v]
1489 items = [v for v in values if '.' in v]
1490 if len(items) > 1 or items and sections:
1491 raise util.Abort(_('only one config item permitted'))
1492 for section, name, value in ui.walkconfig(untrusted=untrusted):
1493 value = str(value).replace('\n', '\\n')
1494 sectname = section + '.' + name
1495 if values:
1496 for v in values:
1497 if v == section:
1498 ui.debug('%s: ' %
1499 ui.configsource(section, name, untrusted))
1500 ui.write('%s=%s\n' % (sectname, value))
1501 elif v == sectname:
1502 ui.debug('%s: ' %
1503 ui.configsource(section, name, untrusted))
1504 ui.write(value, '\n')
1505 else:
1506 ui.debug('%s: ' %
1507 ui.configsource(section, name, untrusted))
1508 ui.write('%s=%s\n' % (sectname, value))
1509
1464 @command('copy|cp',
1510 @command('copy|cp',
1465 [('A', 'after', None, _('record a copy that has already occurred')),
1511 [('A', 'after', None, _('record a copy that has already occurred')),
1466 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1512 ('f', 'force', None, _('forcibly copy over an existing managed file')),
@@ -5162,52 +5208,6 b' class httpservice(object):'
5162 self.httpd.serve_forever()
5208 self.httpd.serve_forever()
5163
5209
5164
5210
5165 @command('showconfig|debugconfig',
5166 [('u', 'untrusted', None, _('show untrusted configuration options'))],
5167 _('[-u] [NAME]...'))
5168 def showconfig(ui, repo, *values, **opts):
5169 """show combined config settings from all hgrc files
5170
5171 With no arguments, print names and values of all config items.
5172
5173 With one argument of the form section.name, print just the value
5174 of that config item.
5175
5176 With multiple arguments, print names and values of all config
5177 items with matching section names.
5178
5179 With --debug, the source (filename and line number) is printed
5180 for each config item.
5181
5182 Returns 0 on success.
5183 """
5184
5185 for f in scmutil.rcpath():
5186 ui.debug('read config from: %s\n' % f)
5187 untrusted = bool(opts.get('untrusted'))
5188 if values:
5189 sections = [v for v in values if '.' not in v]
5190 items = [v for v in values if '.' in v]
5191 if len(items) > 1 or items and sections:
5192 raise util.Abort(_('only one config item permitted'))
5193 for section, name, value in ui.walkconfig(untrusted=untrusted):
5194 value = str(value).replace('\n', '\\n')
5195 sectname = section + '.' + name
5196 if values:
5197 for v in values:
5198 if v == section:
5199 ui.debug('%s: ' %
5200 ui.configsource(section, name, untrusted))
5201 ui.write('%s=%s\n' % (sectname, value))
5202 elif v == sectname:
5203 ui.debug('%s: ' %
5204 ui.configsource(section, name, untrusted))
5205 ui.write(value, '\n')
5206 else:
5207 ui.debug('%s: ' %
5208 ui.configsource(section, name, untrusted))
5209 ui.write('%s=%s\n' % (sectname, value))
5210
5211 @command('^status|st',
5211 @command('^status|st',
5212 [('A', 'all', None, _('show status of all files')),
5212 [('A', 'all', None, _('show status of all files')),
5213 ('m', 'modified', None, _('show only modified files')),
5213 ('m', 'modified', None, _('show only modified files')),
@@ -13,6 +13,7 b' Show all commands except debug commands'
13 cat
13 cat
14 clone
14 clone
15 commit
15 commit
16 config
16 copy
17 copy
17 diff
18 diff
18 export
19 export
@@ -43,7 +44,6 b' Show all commands except debug commands'
43 rollback
44 rollback
44 root
45 root
45 serve
46 serve
46 showconfig
47 status
47 status
48 summary
48 summary
49 tag
49 tag
@@ -222,6 +222,7 b' Show all commands + options'
222 branches: active, closed
222 branches: active, closed
223 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
223 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
224 cat: output, rev, decode, include, exclude
224 cat: output, rev, decode, include, exclude
225 config: untrusted
225 copy: after, force, include, exclude, dry-run
226 copy: after, force, include, exclude, dry-run
226 debugancestor:
227 debugancestor:
227 debugbuilddag: mergeable-file, overwritten-file, new-file
228 debugbuilddag: mergeable-file, overwritten-file, new-file
@@ -275,7 +276,6 b' Show all commands + options'
275 revert: all, date, rev, no-backup, include, exclude, dry-run
276 revert: all, date, rev, no-backup, include, exclude, dry-run
276 rollback: dry-run, force
277 rollback: dry-run, force
277 root:
278 root:
278 showconfig: untrusted
279 tag: force, local, rev, remove, edit, message, date, user
279 tag: force, local, rev, remove, edit, message, date, user
280 tags:
280 tags:
281 tip: patch, git, style, template
281 tip: patch, git, style, template
@@ -297,6 +297,7 b' Testing -h/--help:'
297 cat output the current or given revision of files
297 cat output the current or given revision of files
298 clone make a copy of an existing repository
298 clone make a copy of an existing repository
299 commit commit the specified files or all outstanding changes
299 commit commit the specified files or all outstanding changes
300 config show combined config settings from all hgrc files
300 copy mark files as copied for the next commit
301 copy mark files as copied for the next commit
301 diff diff repository (or selected files)
302 diff diff repository (or selected files)
302 export dump the header and diffs for one or more changesets
303 export dump the header and diffs for one or more changesets
@@ -326,7 +327,6 b' Testing -h/--help:'
326 revert restore files to their checkout state
327 revert restore files to their checkout state
327 root print the root (top) of the current working directory
328 root print the root (top) of the current working directory
328 serve start stand-alone webserver
329 serve start stand-alone webserver
329 showconfig show combined config settings from all hgrc files
330 status show changed files in the working directory
330 status show changed files in the working directory
331 summary summarize working directory state
331 summary summarize working directory state
332 tag add one or more tags for the current or given revision
332 tag add one or more tags for the current or given revision
@@ -379,6 +379,7 b' Testing -h/--help:'
379 cat output the current or given revision of files
379 cat output the current or given revision of files
380 clone make a copy of an existing repository
380 clone make a copy of an existing repository
381 commit commit the specified files or all outstanding changes
381 commit commit the specified files or all outstanding changes
382 config show combined config settings from all hgrc files
382 copy mark files as copied for the next commit
383 copy mark files as copied for the next commit
383 diff diff repository (or selected files)
384 diff diff repository (or selected files)
384 export dump the header and diffs for one or more changesets
385 export dump the header and diffs for one or more changesets
@@ -408,7 +409,6 b' Testing -h/--help:'
408 revert restore files to their checkout state
409 revert restore files to their checkout state
409 root print the root (top) of the current working directory
410 root print the root (top) of the current working directory
410 serve start stand-alone webserver
411 serve start stand-alone webserver
411 showconfig show combined config settings from all hgrc files
412 status show changed files in the working directory
412 status show changed files in the working directory
413 summary summarize working directory state
413 summary summarize working directory state
414 tag add one or more tags for the current or given revision
414 tag add one or more tags for the current or given revision
@@ -62,6 +62,7 b' Short help:'
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
66 diff diff repository (or selected files)
67 diff diff repository (or selected files)
67 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
@@ -91,7 +92,6 b' Short help:'
91 revert restore files to their checkout state
92 revert restore files to their checkout state
92 root print the root (top) of the current working directory
93 root print the root (top) of the current working directory
93 serve start stand-alone webserver
94 serve start stand-alone webserver
94 showconfig show combined config settings from all hgrc files
95 status show changed files in the working directory
95 status show changed files in the working directory
96 summary summarize working directory state
96 summary summarize working directory state
97 tag add one or more tags for the current or given revision
97 tag add one or more tags for the current or given revision
@@ -138,6 +138,7 b' Short help:'
138 cat output the current or given revision of files
138 cat output the current or given revision of files
139 clone make a copy of an existing repository
139 clone make a copy of an existing repository
140 commit commit the specified files or all outstanding changes
140 commit commit the specified files or all outstanding changes
141 config show combined config settings from all hgrc files
141 copy mark files as copied for the next commit
142 copy mark files as copied for the next commit
142 diff diff repository (or selected files)
143 diff diff repository (or selected files)
143 export dump the header and diffs for one or more changesets
144 export dump the header and diffs for one or more changesets
@@ -167,7 +168,6 b' Short help:'
167 revert restore files to their checkout state
168 revert restore files to their checkout state
168 root print the root (top) of the current working directory
169 root print the root (top) of the current working directory
169 serve start stand-alone webserver
170 serve start stand-alone webserver
170 showconfig show combined config settings from all hgrc files
171 status show changed files in the working directory
171 status show changed files in the working directory
172 summary summarize working directory state
172 summary summarize working directory state
173 tag add one or more tags for the current or given revision
173 tag add one or more tags for the current or given revision
@@ -623,6 +623,7 b' Test that default list of commands omits'
623 cat output the current or given revision of files
623 cat output the current or given revision of files
624 clone make a copy of an existing repository
624 clone make a copy of an existing repository
625 commit commit the specified files or all outstanding changes
625 commit commit the specified files or all outstanding changes
626 config show combined config settings from all hgrc files
626 copy mark files as copied for the next commit
627 copy mark files as copied for the next commit
627 diff diff repository (or selected files)
628 diff diff repository (or selected files)
628 export dump the header and diffs for one or more changesets
629 export dump the header and diffs for one or more changesets
@@ -652,7 +653,6 b' Test that default list of commands omits'
652 revert restore files to their checkout state
653 revert restore files to their checkout state
653 root print the root (top) of the current working directory
654 root print the root (top) of the current working directory
654 serve start stand-alone webserver
655 serve start stand-alone webserver
655 showconfig show combined config settings from all hgrc files
656 status show changed files in the working directory
656 status show changed files in the working directory
657 summary summarize working directory state
657 summary summarize working directory state
658 tag add one or more tags for the current or given revision
658 tag add one or more tags for the current or given revision
@@ -1259,6 +1259,13 b' Dish up an empty repo; serve it cold.'
1259 output the current or given revision of files
1259 output the current or given revision of files
1260 </td></tr>
1260 </td></tr>
1261 <tr><td>
1261 <tr><td>
1262 <a href="/help/config">
1263 config
1264 </a>
1265 </td><td>
1266 show combined config settings from all hgrc files
1267 </td></tr>
1268 <tr><td>
1262 <a href="/help/copy">
1269 <a href="/help/copy">
1263 copy
1270 copy
1264 </a>
1271 </a>
@@ -1399,13 +1406,6 b' Dish up an empty repo; serve it cold.'
1399 print the root (top) of the current working directory
1406 print the root (top) of the current working directory
1400 </td></tr>
1407 </td></tr>
1401 <tr><td>
1408 <tr><td>
1402 <a href="/help/showconfig">
1403 showconfig
1404 </a>
1405 </td><td>
1406 show combined config settings from all hgrc files
1407 </td></tr>
1408 <tr><td>
1409 <a href="/help/tag">
1409 <a href="/help/tag">
1410 tag
1410 tag
1411 </a>
1411 </a>
General Comments 0
You need to be logged in to leave comments. Login now