[PATCH 02 of 17] restructure helptable

Martin Geisler mg at daimi.au.dk
Sat Aug 23 15:55:18 CDT 2008


# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219523130 -7200
# Node ID ff89b88af021591d388b5b686ee7f2d54b23c2da
# Parent  25579da18a5ebc2b6e4f72fca348dc4648036e60
restructure helptable

diff -r 25579da18a5e -r ff89b88af021 mercurial/commands.py
--- a/mercurial/commands.py	Sat Aug 23 22:25:30 2008 +0200
+++ b/mercurial/commands.py	Sat Aug 23 22:25:30 2008 +0200
@@ -1325,14 +1325,12 @@
             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:
+        found = None
+        for names, header, doc in help.helptable:
+            if name in names:
+                found = True
+                break
+        if not found:
             raise cmdutil.UnknownCommand(name)
 
         # description
@@ -1409,9 +1407,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))
diff -r 25579da18a5e -r ff89b88af021 mercurial/help.py
--- a/mercurial/help.py	Sat Aug 23 22:25:30 2008 +0200
+++ b/mercurial/help.py	Sat Aug 23 22:25:30 2008 +0200
@@ -6,7 +6,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 helptable = (
-    ("dates|Date Formats",
+    (["dates"], "Date Formats",
     r'''
     Some commands allow the user to specify a date:
     backout, commit, import, tag: Specify the commit date.
@@ -45,7 +45,7 @@
     "-{days}" - within a given number of days of today
     '''),
 
-    ("patterns|File Name Patterns",
+    (["patterns"], "File Name Patterns",
     r'''
     Mercurial accepts several notations for identifying one or more
     files at a time.
@@ -91,7 +91,7 @@
 
     '''),
 
-    ('environment|env|Environment Variables',
+    (['environment', 'env'], 'Environment Variables',
     r'''
 HG::
     Path to the 'hg' executable, automatically passed when running hooks,
@@ -162,7 +162,7 @@
     appropriately if Mercurial is not installed system-wide.
     '''),
 
-    ('revs|revisions|Specifying Single Revisions',
+    (['revs', 'revisions'], 'Specifying Single Revisions',
     r'''
     Mercurial accepts several notations for identifying individual
     revisions.
@@ -195,7 +195,7 @@
     the first parent.
     '''),
 
-    ('mrevs|multirevs|Specifying Multiple Revisions',
+    (['mrevs', 'multirevs'], 'Specifying Multiple Revisions',
     r'''
     When Mercurial accepts more than one revision, they may be
     specified individually, or provided as a continuous range,


More information about the Mercurial-devel mailing list