Allow --help and --version being used together.
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 26 Aug 2005 08:42:56 +0200
changeset 1049 160a68cd393f
parent 1048 7fbb440b2e63
child 1050 9c09094de48c
Allow --help and --version being used together.
mercurial/commands.py
--- a/mercurial/commands.py	Fri Aug 26 08:37:41 2005 +0200
+++ b/mercurial/commands.py	Fri Aug 26 08:42:56 2005 +0200
@@ -269,9 +269,12 @@
         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
     )
 
-def help_(ui, cmd=None):
+def help_(ui, cmd=None, with_version=False):
     """show help for a given command or all commands"""
     if cmd and cmd != 'shortlist':
+        if with_version:
+            show_version(ui)
+            ui.write('\n')
         key, i = find(cmd)
         # synopsis
         ui.write("%s\n\n" % i[2])
@@ -305,7 +308,7 @@
 
     else:
         # program name
-        if ui.verbose:
+        if ui.verbose or with_version:
             show_version(ui)
         else:
             ui.status("Mercurial Distributed SCM\n")
@@ -1634,7 +1637,7 @@
     try:
         try:
             if options['help']:
-                help_(u, cmd)
+                help_(u, cmd, options['version'])
                 sys.exit(0)
             elif options['version']:
                 show_version(u)