##// END OF EJS Templates
config: exit non zero on non-existent config option (issue4247)...
Aaron Kushner -
r22316:816be4ca stable
parent child Browse files
Show More
@@ -1498,7 +1498,7 b' def config(ui, repo, *values, **opts):'
1498
1498
1499 See :hg:`help config` for more information about config files.
1499 See :hg:`help config` for more information about config files.
1500
1500
1501 Returns 0 on success.
1501 Returns 0 on success, 1 if NAME does not exist.
1502
1502
1503 """
1503 """
1504
1504
@@ -1551,6 +1551,7 b' def config(ui, repo, *values, **opts):'
1551 items = [v for v in values if '.' in v]
1551 items = [v for v in values if '.' in v]
1552 if len(items) > 1 or items and sections:
1552 if len(items) > 1 or items and sections:
1553 raise util.Abort(_('only one config item permitted'))
1553 raise util.Abort(_('only one config item permitted'))
1554 matched = False
1554 for section, name, value in ui.walkconfig(untrusted=untrusted):
1555 for section, name, value in ui.walkconfig(untrusted=untrusted):
1555 value = str(value).replace('\n', '\\n')
1556 value = str(value).replace('\n', '\\n')
1556 sectname = section + '.' + name
1557 sectname = section + '.' + name
@@ -1560,14 +1561,20 b' def config(ui, repo, *values, **opts):'
1560 ui.debug('%s: ' %
1561 ui.debug('%s: ' %
1561 ui.configsource(section, name, untrusted))
1562 ui.configsource(section, name, untrusted))
1562 ui.write('%s=%s\n' % (sectname, value))
1563 ui.write('%s=%s\n' % (sectname, value))
1564 matched = True
1563 elif v == sectname:
1565 elif v == sectname:
1564 ui.debug('%s: ' %
1566 ui.debug('%s: ' %
1565 ui.configsource(section, name, untrusted))
1567 ui.configsource(section, name, untrusted))
1566 ui.write(value, '\n')
1568 ui.write(value, '\n')
1569 matched = True
1567 else:
1570 else:
1568 ui.debug('%s: ' %
1571 ui.debug('%s: ' %
1569 ui.configsource(section, name, untrusted))
1572 ui.configsource(section, name, untrusted))
1570 ui.write('%s=%s\n' % (sectname, value))
1573 ui.write('%s=%s\n' % (sectname, value))
1574 matched = True
1575 if matched:
1576 return 0
1577 return 1
1571
1578
1572 @command('copy|cp',
1579 @command('copy|cp',
1573 [('A', 'after', None, _('record a copy that has already occurred')),
1580 [('A', 'after', None, _('record a copy that has already occurred')),
@@ -42,3 +42,8 b' Test "%unset"'
42
42
43 $ hg showconfig unsettest
43 $ hg showconfig unsettest
44 unsettest.set-after-unset=should be set (.hg/hgrc)
44 unsettest.set-after-unset=should be set (.hg/hgrc)
45
46 Test exit code when no config matches
47
48 $ hg config Section.idontexist
49 [1]
@@ -326,6 +326,7 b' process.'
326 verified existence of 6 revisions of 4 largefiles
326 verified existence of 6 revisions of 4 largefiles
327 [1]
327 [1]
328 $ hg -R largefiles-repo-hg showconfig paths
328 $ hg -R largefiles-repo-hg showconfig paths
329 [1]
329
330
330
331
331 Avoid a traceback if a largefile isn't available (issue3519)
332 Avoid a traceback if a largefile isn't available (issue3519)
General Comments 0
You need to be logged in to leave comments. Login now