diff mercurial/commands.py @ 7012:78341ea65d16

restructure helptable When looking up a help topic, the key is now only matched against the short names for each topic, and not the header. So hg help 'Environment Variables' must be replaced with hg help env
author Martin Geisler <mg@daimi.au.dk>
date Tue, 09 Sep 2008 21:32:39 +0200
parents 92d44ec32430
children f56e788fa292
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Sep 09 14:43:12 2008 +0200
+++ b/mercurial/commands.py	Tue Sep 09 21:32:39 2008 +0200
@@ -1339,14 +1339,10 @@
             addglobalopts(True)
 
     def helptopic(name):
-        v = None
-        for i, d in help.helptable:
-            l = i.split('|')
-            if name in l:
-                v = i
-                header = l[-1]
-                doc = d
-        if not v:
+        for names, header, doc in help.helptable:
+            if name in names:
+                break
+        else:
             raise cmdutil.UnknownCommand(name)
 
         # description
@@ -1423,9 +1419,8 @@
     if ui.verbose:
         ui.write(_("\nspecial help topics:\n"))
         topics = []
-        for i, d in help.helptable:
-            l = i.split('|')
-            topics.append((", ".join(l[:-1]), l[-1]))
+        for names, header, doc in help.helptable:
+            topics.append((", ".join(names), header))
         topics_len = max([len(s[0]) for s in topics])
         for t, desc in topics:
             ui.write(" %-*s  %s\n" % (topics_len, t, desc))