changeset 7196:3f6a4f1de43f

help: show help topics by default in 'hg help', with longest available id
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Tue, 21 Oct 2008 11:05:45 +0200
parents 9fabcb1fe68d
children f60730693efc
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Oct 21 10:29:57 2008 +0200
+++ b/mercurial/commands.py	Tue Oct 21 11:05:45 2008 +0200
@@ -1432,11 +1432,13 @@
                                          and _(" (default: %s)") % default
                                          or "")))
 
-    if ui.verbose:
-        ui.write(_("\nspecial help topics:\n"))
+    if not name:
+        ui.write(_("\nspecial help topics:\n\n"))
         topics = []
         for names, header, doc in help.helptable:
-            topics.append((", ".join(names), header))
+            names = [(-len(name), name) for name in names]
+            names.sort()
+            topics.append((names[0][1], 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))