changeset 15020:607f1434501d

help: drop with_version If --version is specified, we print the version and exit (as documented).
author Matt Mackall <mpm@selenic.com>
date Thu, 04 Aug 2011 15:08:41 -0500
parents f4522df38c65
children 573e82fef44d
files mercurial/commands.py mercurial/dispatch.py tests/test-help.t
diffstat 3 files changed, 6 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Aug 02 15:21:10 2011 -0400
+++ b/mercurial/commands.py	Thu Aug 04 15:08:41 2011 -0500
@@ -2579,7 +2579,7 @@
     [('e', 'extension', None, _('show only help for extensions')),
      ('c', 'command', None, _('show only help for commands'))],
     _('[-ec] [TOPIC]'))
-def help_(ui, name=None, with_version=False, unknowncmd=False, full=True, **opts):
+def help_(ui, name=None, unknowncmd=False, full=True, **opts):
     """show help for a given topic or a help overview
 
     With no arguments, print a list of commands with short help messages.
@@ -2612,10 +2612,6 @@
             option_lists.append((msg, ()))
 
     def helpcmd(name):
-        if with_version:
-            version_(ui)
-            ui.write('\n')
-
         try:
             aliases, entry = cmdutil.findcmd(name, table, strict=unknowncmd)
         except error.AmbiguousCommand, inst:
@@ -2809,10 +2805,7 @@
 
     else:
         # program name
-        if ui.verbose or with_version:
-            version_(ui)
-        else:
-            ui.status(_("Mercurial Distributed SCM\n"))
+        ui.status(_("Mercurial Distributed SCM\n"))
         ui.status('\n')
 
         # list of commands
--- a/mercurial/dispatch.py	Tue Aug 02 15:21:10 2011 -0400
+++ b/mercurial/dispatch.py	Thu Aug 04 15:08:41 2011 -0500
@@ -622,10 +622,10 @@
         for ui_ in uis:
             ui_.setconfig('web', 'cacerts', '')
 
+    if options['version']:
+        return commands.version_(ui)
     if options['help']:
-        return commands.help_(ui, cmd, options['version'])
-    elif options['version']:
-        return commands.version_(ui)
+        return commands.help_(ui, cmd)
     elif not cmd:
         return commands.help_(ui, 'shortlist')
 
--- a/tests/test-help.t	Tue Aug 02 15:21:10 2011 -0400
+++ b/tests/test-help.t	Thu Aug 04 15:08:41 2011 -0500
@@ -199,12 +199,7 @@
 Test short command list with verbose option
 
   $ hg -v help shortlist
-  Mercurial Distributed SCM (version *) (glob)
-  (see http://mercurial.selenic.com for more information)
-  
-  Copyright (C) 2005-2011 Matt Mackall and others
-  This is free software; see the source for copying conditions. There is NO
-  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  Mercurial Distributed SCM
   
   basic commands:
   
@@ -359,32 +354,6 @@
   Copyright (C) 2005-2011 Matt Mackall and others
   This is free software; see the source for copying conditions. There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  hg add [OPTION]... [FILE]...
-  
-  add the specified files on the next commit
-  
-      Schedule files to be version controlled and added to the repository.
-  
-      The files will be added to the repository at the next commit. To undo an
-      add before that, see "hg forget".
-  
-      If no names are given, add all files to the repository.
-  
-      Returns 0 if all files are successfully added.
-  
-  use "hg -v help add" to show verbose help
-  
-  options:
-  
-   -I --include PATTERN [+]  include names matching the given patterns
-   -X --exclude PATTERN [+]  exclude names matching the given patterns
-   -S --subrepos             recurse into subrepositories
-   -n --dry-run              do not perform actions, just print output
-  
-  [+] marked option can be specified multiple times
-  
-  use "hg -v help add" to show global options
 
   $ hg add --skjdfks
   hg add: option --skjdfks not recognized