mercurial/commands.py
changeset 22367 c5df4af17110
parent 22315 188b8aa2120b
parent 22316 816be4ca4ae2
child 22381 392ae5cb8d62
--- a/mercurial/commands.py	Tue Aug 26 04:58:41 2014 -0700
+++ b/mercurial/commands.py	Thu Sep 04 09:59:23 2014 -0400
@@ -1498,7 +1498,7 @@
 
     See :hg:`help config` for more information about config files.
 
-    Returns 0 on success.
+    Returns 0 on success, 1 if NAME does not exist.
 
     """
 
@@ -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 = False
     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 = True
                 elif v == sectname:
                     ui.debug('%s: ' %
                              ui.configsource(section, name, untrusted))
                     ui.write(value, '\n')
+                    matched = True
         else:
             ui.debug('%s: ' %
                      ui.configsource(section, name, untrusted))
             ui.write('%s=%s\n' % (sectname, value))
+            matched = True
+    if matched:
+        return 0
+    return 1
 
 @command('copy|cp',
     [('A', 'after', None, _('record a copy that has already occurred')),