##// 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 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 1551 items = [v for v in values if '.' in v]
1552 1552 if len(items) > 1 or items and sections:
1553 1553 raise util.Abort(_('only one config item permitted'))
1554 matched = False
1554 1555 for section, name, value in ui.walkconfig(untrusted=untrusted):
1555 1556 value = str(value).replace('\n', '\\n')
1556 1557 sectname = section + '.' + name
@@ -1560,14 +1561,20 b' def config(ui, repo, *values, **opts):'
1560 1561 ui.debug('%s: ' %
1561 1562 ui.configsource(section, name, untrusted))
1562 1563 ui.write('%s=%s\n' % (sectname, value))
1564 matched = True
1563 1565 elif v == sectname:
1564 1566 ui.debug('%s: ' %
1565 1567 ui.configsource(section, name, untrusted))
1566 1568 ui.write(value, '\n')
1569 matched = True
1567 1570 else:
1568 1571 ui.debug('%s: ' %
1569 1572 ui.configsource(section, name, untrusted))
1570 1573 ui.write('%s=%s\n' % (sectname, value))
1574 matched = True
1575 if matched:
1576 return 0
1577 return 1
1571 1578
1572 1579 @command('copy|cp',
1573 1580 [('A', 'after', None, _('record a copy that has already occurred')),
@@ -42,3 +42,8 b' Test "%unset"'
42 42
43 43 $ hg showconfig unsettest
44 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 326 verified existence of 6 revisions of 4 largefiles
327 327 [1]
328 328 $ hg -R largefiles-repo-hg showconfig paths
329 [1]
329 330
330 331
331 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