Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 467:9d5447a366a7
Add version command
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Add version command
Suggested by Arun Sharma
manifest hash: 7fc056ffe45ee854f00e76916a560fba28c74a91
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCvQW+ywK+sNU5EO8RAqGQAJ91Eysw4tHVpOB7ICeN9hMF/p+lfQCgksmg
TAKr5VNrw2wIZtSKjgQRqiA=
=8w84
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Fri, 24 Jun 2005 23:20:30 -0800 |
parents | 50da4bb9cab6 |
children | 157675add351 |
comparison
equal
deleted
inserted
replaced
466:c084cfbb2389 | 467:9d5447a366a7 |
---|---|
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 show_version(ui): | 137 def 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 show_version(ui) | 170 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 e in table.values(): |
765 (update, | 765 (update, |
766 [('m', 'merge', None, 'allow merging of conflicts'), | 766 [('m', 'merge', None, 'allow merging of conflicts'), |
767 ('C', 'clean', None, 'overwrite locally modified files')], | 767 ('C', 'clean', None, 'overwrite locally modified files')], |
768 'hg update [options] [node]'), | 768 'hg update [options] [node]'), |
769 "verify": (verify, [], 'hg verify'), | 769 "verify": (verify, [], 'hg verify'), |
770 "version": (version, [], 'hg version'), | |
770 } | 771 } |
771 | 772 |
772 norepo = "init version help debugindex debugindexdot" | 773 norepo = "init version help debugindex debugindexdot" |
773 | 774 |
774 def find(cmd): | 775 def find(cmd): |
807 | 808 |
808 u = ui.ui(options["verbose"], options["debug"], options["quiet"], | 809 u = ui.ui(options["verbose"], options["debug"], options["quiet"], |
809 not options["noninteractive"]) | 810 not options["noninteractive"]) |
810 | 811 |
811 if options["version"]: | 812 if options["version"]: |
812 show_version(u) | 813 version(u) |
813 sys.exit(0) | 814 sys.exit(0) |
814 | 815 |
815 try: | 816 try: |
816 i = find(cmd) | 817 i = find(cmd) |
817 except UnknownCommand: | 818 except UnknownCommand: |