Comments
Patch
@@ -1551,6 +1551,7 @@
items = [v for v in values if '.' in v]
if len(items) > 1 or items and sections:
raise util.Abort(_('only one config item permitted'))
+ matched = 0
for section, name, value in ui.walkconfig(untrusted=untrusted):
value = str(value).replace('\n', '\\n')
sectname = section + '.' + name
@@ -1560,14 +1561,20 @@
ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
ui.write('%s=%s\n' % (sectname, value))
+ matched += 1
elif v == sectname:
ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
ui.write(value, '\n')
+ matched += 1
else:
ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
ui.write('%s=%s\n' % (sectname, value))
+ matched += 1
+ if matched:
+ return 0
+ return 1
@command('copy|cp',
[('A', 'after', None, _('record a copy that has already occurred')),
@@ -83,3 +83,8 @@
$ hg showconfig unsettest
unsettest.set-after-unset=should be set (.hg/hgrc)
+
+Test exit code when no config matches
+
+ $ hg config Section.idontexist
+ [1]
@@ -326,6 +326,7 @@
verified existence of 6 revisions of 4 largefiles
[1]
$ hg -R largefiles-repo-hg showconfig paths
+ [1]
Avoid a traceback if a largefile isn't available (issue3519)