Fix up version module name and command conflict
authormpm@selenic.com
Sat, 25 Jun 2005 00:16:39 -0800
changeset 470 0ab093b473c5
parent 469 e205194ca7ef
child 471 4c7f687e4313
Fix up version module name and command conflict -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Fix up version module name and command conflict This unties the command name from the function name manifest hash: 926d097f75cbb5eb2464bb253e9a89050c6208bd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCvRLnywK+sNU5EO8RAvryAJ9RU0PLFOXjjtQjs8UVyOC9wde69gCgrV+G 8jYfMyWwvwsmOM7wMblPGqM= =Acyk -----END PGP SIGNATURE-----
mercurial/commands.py
--- a/mercurial/commands.py	Fri Jun 24 23:50:27 2005 -0800
+++ b/mercurial/commands.py	Sat Jun 25 00:16:39 2005 -0800
@@ -134,7 +134,7 @@
             ui.status("summary:     %s\n" % description.splitlines()[0])
     ui.status("\n")
 
-def version(ui):
+def show_version(ui):
     """output version and copyright information"""
     ui.write("Mercurial version %s\n" % version.get_version())
     ui.status(
@@ -167,18 +167,22 @@
         sys.exit(0)
     else:
         if not ui.quiet:
-            version(ui)
+            show_version(ui)
             ui.write('\n')
         ui.write('hg commands:\n\n')
 
         h = {}
-        for e in table.values():
-            f = e[0]
-            if f.__name__.startswith("debug"): continue
+        for c,e in table.items():
+            f = c
+            aliases = None
+            if "|" in f:
+                l = f.split("|")
+                f, aliases = l[0], l[1:]
+            if f.startswith("debug"): continue
             d = ""
-            if f.__doc__:
-                d = f.__doc__.splitlines(0)[0].rstrip()
-            h[f.__name__.rstrip("_")] = d
+            if e[0].__doc__:
+                d = e[0].__doc__.splitlines(0)[0].rstrip()
+            h[f] = d
 
         fns = h.keys()
         fns.sort()
@@ -772,7 +776,7 @@
               ('C', 'clean', None, 'overwrite locally modified files')],
              'hg update [options] [node]'),
     "verify": (verify, [], 'hg verify'),
-    "version": (version, [], 'hg version'),
+    "version": (show_version, [], 'hg version'),
     }
 
 norepo = "init version help debugindex debugindexdot"
@@ -815,7 +819,7 @@
            not options["noninteractive"])
 
     if options["version"]:
-        version(u)
+        show_version(u)
         sys.exit(0)
 
     try: