comparison mercurial/commands.py @ 470:0ab093b473c5

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-----
author mpm@selenic.com
date Sat, 25 Jun 2005 00:16:39 -0800
parents 157675add351
children 520540fd6b64 934279f3ca53
comparison
equal deleted inserted replaced
469:e205194ca7ef 470:0ab093b473c5
132 ui.status("\n") 132 ui.status("\n")
133 else: 133 else:
134 ui.status("summary: %s\n" % description.splitlines()[0]) 134 ui.status("summary: %s\n" % description.splitlines()[0])
135 ui.status("\n") 135 ui.status("\n")
136 136
137 def version(ui): 137 def show_version(ui):
138 """output version and copyright information""" 138 """output version and copyright information"""
139 ui.write("Mercurial version %s\n" % version.get_version()) 139 ui.write("Mercurial version %s\n" % version.get_version())
140 ui.status( 140 ui.status(
141 "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n" 141 "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n"
142 "This is free software; see the source for copying conditions. " 142 "This is free software; see the source for copying conditions. "
165 except UnknownCommand: 165 except UnknownCommand:
166 ui.warn("hg: unknown command %s\n" % cmd) 166 ui.warn("hg: unknown command %s\n" % cmd)
167 sys.exit(0) 167 sys.exit(0)
168 else: 168 else:
169 if not ui.quiet: 169 if not ui.quiet:
170 version(ui) 170 show_version(ui)
171 ui.write('\n') 171 ui.write('\n')
172 ui.write('hg commands:\n\n') 172 ui.write('hg commands:\n\n')
173 173
174 h = {} 174 h = {}
175 for e in table.values(): 175 for c,e in table.items():
176 f = e[0] 176 f = c
177 if f.__name__.startswith("debug"): continue 177 aliases = None
178 if "|" in f:
179 l = f.split("|")
180 f, aliases = l[0], l[1:]
181 if f.startswith("debug"): continue
178 d = "" 182 d = ""
179 if f.__doc__: 183 if e[0].__doc__:
180 d = f.__doc__.splitlines(0)[0].rstrip() 184 d = e[0].__doc__.splitlines(0)[0].rstrip()
181 h[f.__name__.rstrip("_")] = d 185 h[f] = d
182 186
183 fns = h.keys() 187 fns = h.keys()
184 fns.sort() 188 fns.sort()
185 m = max(map(len, fns)) 189 m = max(map(len, fns))
186 for f in fns: 190 for f in fns:
770 (update, 774 (update,
771 [('m', 'merge', None, 'allow merging of conflicts'), 775 [('m', 'merge', None, 'allow merging of conflicts'),
772 ('C', 'clean', None, 'overwrite locally modified files')], 776 ('C', 'clean', None, 'overwrite locally modified files')],
773 'hg update [options] [node]'), 777 'hg update [options] [node]'),
774 "verify": (verify, [], 'hg verify'), 778 "verify": (verify, [], 'hg verify'),
775 "version": (version, [], 'hg version'), 779 "version": (show_version, [], 'hg version'),
776 } 780 }
777 781
778 norepo = "init version help debugindex debugindexdot" 782 norepo = "init version help debugindex debugindexdot"
779 783
780 def find(cmd): 784 def find(cmd):
813 817
814 u = ui.ui(options["verbose"], options["debug"], options["quiet"], 818 u = ui.ui(options["verbose"], options["debug"], options["quiet"],
815 not options["noninteractive"]) 819 not options["noninteractive"])
816 820
817 if options["version"]: 821 if options["version"]:
818 version(u) 822 show_version(u)
819 sys.exit(0) 823 sys.exit(0)
820 824
821 try: 825 try:
822 i = find(cmd) 826 i = find(cmd)
823 except UnknownCommand: 827 except UnknownCommand: