help: show help topics by default in 'hg help', with longest available id
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Tue, 21 Oct 2008 11:05:45 +0200
changeset 7196 3f6a4f1de43f
parent 7195 9fabcb1fe68d
child 7197 f60730693efc
help: show help topics by default in 'hg help', with longest available id
mercurial/commands.py
--- 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))