[PATCH] help: treat hg help pattern like hg help patterns
timeless
timeless at mozdev.org
Fri Oct 16 19:28:27 UTC 2015
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1445023325 14400
# Fri Oct 16 15:22:05 2015 -0400
# Node ID dbd326c55e98a081253ad6e6d2d8e453c06115fe
# Parent e8f1b728591786143174515ea18089db0df4af90
help: treat hg help pattern like hg help patterns
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -513,12 +513,19 @@
queries += [helpcmd]
if not queries:
queries = (helptopic, helpcmd, helpext, helpextcmd)
- for f in queries:
- try:
- rst = f(name)
+ def findtopic(name, queries):
+ rst = None
+ for f in queries:
+ try:
+ rst = f(name)
+ break
+ except error.UnknownCommand:
+ pass
+ return rst
+ for topic in [name, name + 's', name + 'es']:
+ rst = findtopic(topic, queries)
+ if rst:
break
- except error.UnknownCommand:
- pass
else:
if unknowncmd:
raise error.UnknownCommand(name)
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -450,6 +450,11 @@
(use "hg help -v ad" to show built-in aliases and global options)
+Test singular help
+ $ hg help pattern |grep '^[^ ]'
+ File Name Patterns
+ """"""""""""""""""
+
Test command without options
$ hg help verify
More information about the Mercurial-devel
mailing list