mercurial/commands.py
changeset 36417 199443c55463
parent 36416 07e207e88b42
child 36422 04c319a07c7b
--- a/mercurial/commands.py	Wed Feb 21 23:02:39 2018 +0900
+++ b/mercurial/commands.py	Wed Feb 21 22:47:47 2018 +0900
@@ -1632,7 +1632,7 @@
     of that config item.
 
     With multiple arguments, print names and values of all config
-    items with matching section names.
+    items with matching section names or section.names.
 
     With --edit, start an editor on the user-level config file. With
     --global, edit the system-wide config file. With --local, edit the
@@ -1698,8 +1698,7 @@
     if values:
         selsections = [v for v in values if '.' not in v]
         selentries = [v for v in values if '.' in v]
-        if len(selentries) > 1 or selentries and selsections:
-            raise error.Abort(_('only one config item permitted'))
+    uniquesel = (len(selentries) == 1 and not selsections)
     selsections = set(selsections)
     selentries = set(selentries)
 
@@ -1711,23 +1710,16 @@
             source = source or 'none'
             value = value.replace('\n', '\\n')
         entryname = section + '.' + name
-        if values:
-            if section in selsections:
-                fm.startitem()
-                fm.condwrite(ui.debugflag, 'source', '%s: ', source)
-                fm.write('name value', '%s=%s\n', entryname, value)
-                matched = True
-            elif entryname in selentries:
-                fm.startitem()
-                fm.condwrite(ui.debugflag, 'source', '%s: ', source)
-                fm.write('value', '%s\n', value)
-                fm.data(name=entryname)
-                matched = True
+        if values and not (section in selsections or entryname in selentries):
+            continue
+        fm.startitem()
+        fm.condwrite(ui.debugflag, 'source', '%s: ', source)
+        if uniquesel:
+            fm.data(name=entryname)
+            fm.write('value', '%s\n', value)
         else:
-            fm.startitem()
-            fm.condwrite(ui.debugflag, 'source', '%s: ', source)
             fm.write('name value', '%s=%s\n', entryname, value)
-            matched = True
+        matched = True
     fm.end()
     if matched:
         return 0