--- a/mercurial/commands.py Mon Sep 01 10:57:27 2014 -0300
+++ b/mercurial/commands.py Mon Sep 01 23:43:33 2014 +0200
@@ -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')),
--- a/mercurial/help.py Mon Sep 01 10:57:27 2014 -0300
+++ b/mercurial/help.py Mon Sep 01 23:43:33 2014 +0200
@@ -86,9 +86,10 @@
'extensioncommands': [],
}
for names, header, doc in helptable:
+ # Old extensions may use a str as doc.
if (sum(map(lowercontains, names))
or lowercontains(header)
- or lowercontains(doc())):
+ or (callable(doc) and lowercontains(doc()))):
results['topics'].append((names[0], header))
import commands # avoid cycle
for cmd, entry in commands.table.iteritems():
--- a/mercurial/repoview.py Mon Sep 01 10:57:27 2014 -0300
+++ b/mercurial/repoview.py Mon Sep 01 23:43:33 2014 +0200
@@ -189,7 +189,7 @@
# without change in the cachekey.
oldfilter = cl.filteredrevs
try:
- cl.filterrevs = () # disable filtering for tip
+ cl.filteredrevs = () # disable filtering for tip
curkey = (len(cl), cl.tip(), hash(oldfilter))
finally:
cl.filteredrevs = oldfilter
--- a/tests/test-config.t Mon Sep 01 10:57:27 2014 -0300
+++ b/tests/test-config.t Mon Sep 01 23:43:33 2014 +0200
@@ -42,3 +42,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]
--- a/tests/test-lfconvert.t Mon Sep 01 10:57:27 2014 -0300
+++ b/tests/test-lfconvert.t Mon Sep 01 23:43:33 2014 +0200
@@ -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)