[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] make 'svn help' tell how to discover version

From: <kfogel_at_collab.net>
Date: 2004-10-13 19:56:07 CEST

Greg Hudson <ghudson@MIT.EDU> writes:
> On Tue, 2004-10-12 at 16:11, kfogel@collab.net wrote:
> > $ svn help
> > usage: svn <subcommand> [options] [args]
> > Type 'svn help <subcommand>' for help on a specific subcommand.
> > Type 'svn --version' to see the version number of this software.
>
> If we're spending a command name on the "version" command, why also
> spend a "svn help" line on documenting svn --version, which does the
> same thing?

My goodness. I had totally forgotten about the 'version' subcommand,
and because I just upgraded my box and hadn't yet installed a
development Subversion, when I ran 'svn help', that subcommand wasn't
listed. Sigh.

> (On the other hand, I wouldn't object to spending an "svn help" line on
> spitting out the svn -q --version output direcetly.)

I think that's a good idea anyway.

    $ svn help
    usage: svn <subcommand> [options] [args]
    Subversion command-line client, version 1.1.0.
    Type 'svn help <subcommand>' for help on a specific subcommand.

    Available subcommands:
      [...]

The following patch implements that, and passes 'make check'. And it
actually buys us back a line of vertical space, by rewording one
paragraph *and* removing the extra newline at the end of the help
output.

Comments welcome. I'll commit if there are no objections.

[[[
Make 'svn help' output show the client version number.
Thanks to Greg Hudson for feedback.

* subversion/clients/cmdline/help-cmd.c
  (svn_cl__help_header): Add a line giving the client version.
    Then tweak a wording later on, to save a line, so the total number
    of lines in the help output remains the same. This involved
    reformatting the source so as to make the strings start in an
    earlier column, which in turn makes this change appear more
    drastic than it actually is.
  (svn_cl__help_footer): Make the same start-column adjustment as
    above, for consistency, and remove the extra newline at the end.
    No semantic changes.

* subversion/tests/clients/cmdline/getopt_tests.py
  (rep_lines_res): Add line to compensate for above.

* subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout,
  subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout:
    Adjust for new help output.
]]]

Index: subversion/clients/cmdline/help-cmd.c
===================================================================
--- subversion/clients/cmdline/help-cmd.c (revision 11360)
+++ subversion/clients/cmdline/help-cmd.c (working copy)
@@ -32,20 +32,19 @@
 #include "svn_private_config.h"
 
 const char svn_cl__help_header[] =
- N_("usage: svn <subcommand> [options] [args]\n"
- "Type 'svn help <subcommand>' for help on a specific subcommand.\n"
- "\n"
- "Most subcommands take file and/or directory arguments, recursing\n"
- "on the directories. If no arguments are supplied to such a\n"
- "command, it will recurse on the current directory (inclusive) by\n"
- "default.\n"
- "\n"
- "Available subcommands:\n");
+ N_("usage: svn <subcommand> [options] [args]\n"
+ "Subversion command-line client, version " SVN_VER_NUMBER ".\n"
+ "Type 'svn help <subcommand>' for help on a specific subcommand.\n"
+ "\n"
+ "Most subcommands take file and/or directory arguments, recursing\n"
+ "on the directories. If no arguments are supplied to such a\n"
+ "command, it recurses on the current directory (inclusive) by default.\n"
+ "\n"
+ "Available subcommands:\n");
 
 const char svn_cl__help_footer[] =
- N_("Subversion is a tool for version control.\n"
- "For additional information, see http://subversion.tigris.org/\n"
- "\n");
+ N_("Subversion is a tool for version control.\n"
+ "For additional information, see http://subversion.tigris.org/\n");
 
 
 /*** Code. ***/
Index: subversion/tests/clients/cmdline/getopt_tests.py
===================================================================
--- subversion/tests/clients/cmdline/getopt_tests.py (revision 11360)
+++ subversion/tests/clients/cmdline/getopt_tests.py (working copy)
@@ -73,6 +73,13 @@
                  # In 'svn --version --quiet', we print only the version
                  # number in a single line.
                  (re.compile(r'^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$'), 'X.Y.Z\n'),
+ # 'svn --help' has a line with the version number.
+ # It can vary, for example:
+ # "Subversion command-line client, version 1.1.0."
+ # "Subversion command-line client, version 1.1.0-dev."
+ (re.compile(r'Subversion command-line client, '
+ 'version \d+\.\d+\.\d+(.|-[a-zA-Z0-9]+\.)$'),
+ 'Subversion command-line client, version X.Y.Z.'),
                 ]
 
 def process_lines(lines):
Index: subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout
===================================================================
--- subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout (revision 11360)
+++ subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout (working copy)
@@ -1,10 +1,10 @@
 usage: svn <subcommand> [options] [args]
+Subversion command-line client, version X.Y.Z.
 Type 'svn help <subcommand>' for help on a specific subcommand.
 
 Most subcommands take file and/or directory arguments, recursing
 on the directories. If no arguments are supplied to such a
-command, it will recurse on the current directory (inclusive) by
-default.
+command, it recurses on the current directory (inclusive) by default.
 
 Available subcommands:
    add
@@ -39,4 +39,3 @@
 
 Subversion is a tool for version control.
 For additional information, see http://subversion.tigris.org/
-
Index: subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout
===================================================================
--- subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout (revision 11360)
+++ subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout (working copy)
@@ -1,10 +1,10 @@
 usage: svn <subcommand> [options] [args]
+Subversion command-line client, version X.Y.Z.
 Type 'svn help <subcommand>' for help on a specific subcommand.
 
 Most subcommands take file and/or directory arguments, recursing
 on the directories. If no arguments are supplied to such a
-command, it will recurse on the current directory (inclusive) by
-default.
+command, it recurses on the current directory (inclusive) by default.
 
 Available subcommands:
    add
@@ -39,4 +39,3 @@
 
 Subversion is a tool for version control.
 For additional information, see http://subversion.tigris.org/
-

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 13 21:45:29 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.