[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-cvs
Subject:    svn commit: r10430 - in trunk/subversion: clients/cmdline tests/clients/cmdline tests/clients/cmdlin
From:       brane () tigris ! org
Date:       2004-07-27 20:17:52
Message-ID: 200407272017.i6RKHqA01278 () morbius ! ch ! collab ! net
[Download RAW message or body]

Author: brane
Date: Tue Jul 27 15:17:51 2004
New Revision: 10430

Added:
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stderr
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stdout
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stderr
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stdout
Modified:
   trunk/subversion/clients/cmdline/cl.h
   trunk/subversion/clients/cmdline/help-cmd.c
   trunk/subversion/clients/cmdline/main.c
   trunk/subversion/tests/clients/cmdline/getopt_tests.py
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout
   trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout
Log:
New command "svn version [--quiet]".

* subversion/clients/cmdline/cl.h (svn_cl__version): Declare command handler.
  (svn_cl__cat): Move to alphabetically correct position in the handler list.

* subversion/clients/cmdline/main.c (svn_cl__cmd_table): Add entry for
   the "version" command.

* subversion/clients/cmdline/help-cmd.c (print_help): New function. Extract
   implementation from svn_cl__help.
  (svn_cl__help) Call print_help to do the actual printing.
  (svn_cl__version): New. Call print_help to print version info.


[in subversion/tests/clients/cmdline]
* getopt_tests.py (getopt_version, getopt_ver__q): New tests.
  (test_list): Add them to the list.

* getopt_tests_data/svn_help_stdout,
  getopt_tests_data/svn--help_stdout: Add "version" command to expected output.

* getopt_tests_data/svn_ver-q_stdout,
  getopt_tests_data/svn_ver-q_stderr,
  getopt_tests_data/svn_version_stdout,
  getopt_tests_data/svn_version_stderr: New files with expected output.


Modified: trunk/subversion/clients/cmdline/cl.h
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/clients/cmdline/cl.h?view=diff \
&rev=10430&p1=trunk/subversion/clients/cmdline/cl.h&r1=10429&p2=trunk/subversion/clients/cmdline/cl.h&r2=10430
 ==============================================================================
--- trunk/subversion/clients/cmdline/cl.h	(original)
+++ trunk/subversion/clients/cmdline/cl.h	Tue Jul 27 15:17:51 2004
@@ -145,6 +145,7 @@
 svn_opt_subcommand_t
   svn_cl__add,
   svn_cl__blame,
+  svn_cl__cat,
   svn_cl__checkout,
   svn_cl__cleanup,
   svn_cl__commit,
@@ -170,7 +171,7 @@
   svn_cl__status,
   svn_cl__switch,
   svn_cl__update,
-  svn_cl__cat;
+  svn_cl__version;
 
 
 /* See definition in main.c for documentation. */

Modified: trunk/subversion/clients/cmdline/help-cmd.c
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/clients/cmdline/help-cmd.c?vie \
w=diff&rev=10430&p1=trunk/subversion/clients/cmdline/help-cmd.c&r1=10429&p2=trunk/subversion/clients/cmdline/help-cmd.c&r2=10430
 ==============================================================================
--- trunk/subversion/clients/cmdline/help-cmd.c	(original)
+++ trunk/subversion/clients/cmdline/help-cmd.c	Tue Jul 27 15:17:51 2004
@@ -50,6 +50,37 @@
 
 /*** Code. ***/
 
+/* Print help or version information. If PRINT_VERSION, print version
+   info rather than help. Be less verbose if QUIET. OS is the
+   command-line options context, do any allocations from POOL. */
+static svn_error_t *
+print_help (apr_getopt_t *os,
+            svn_boolean_t print_version,
+            svn_boolean_t quiet,
+            apr_pool_t *pool)
+{
+  void *ra_baton;
+  const char *ra_desc_start
+    = _("The following repository access (RA) modules are available:\n\n");
+  svn_stringbuf_t *ra_desc_body, *ra_desc_all;
+
+  ra_desc_all = svn_stringbuf_create (ra_desc_start, pool);
+  SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
+  SVN_ERR (svn_ra_print_ra_libraries (&ra_desc_body, ra_baton, pool));
+  svn_stringbuf_appendstr (ra_desc_all, ra_desc_body);
+
+  return svn_opt_print_help (os,
+                             "svn",   /* ### erm, derive somehow? */
+                             print_version,
+                             quiet,
+                             ra_desc_all->data,
+                             gettext (svn_cl__help_header),
+                             svn_cl__cmd_table,
+                             svn_cl__options,
+                             gettext (svn_cl__help_footer),
+                             pool);
+}
+
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
 svn_cl__help (apr_getopt_t *os,
@@ -58,31 +89,31 @@
 {
   svn_cl__opt_state_t *opt_state;
 
-  void *ra_baton;
-  const char *ra_desc_start
-    = _("The following repository access (RA) modules are available:\n\n");
-  svn_stringbuf_t *ra_desc_body, *ra_desc_all;
-
   if (baton)
     opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   else
     opt_state = NULL;
 
-  ra_desc_all = svn_stringbuf_create (ra_desc_start, pool);
-  SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
-  SVN_ERR (svn_ra_print_ra_libraries (&ra_desc_body, ra_baton, pool));
-  svn_stringbuf_appendstr (ra_desc_all, ra_desc_body);
+  return print_help (os,
+                     opt_state ? opt_state->version : FALSE,
+                     opt_state ? opt_state->quiet : FALSE,
+                     pool);
+}
+
+/* This implements the `svn_opt_subcommand_t' interface. */
+svn_error_t *
+svn_cl__version (apr_getopt_t *os,
+                 void *baton,
+                 apr_pool_t *pool)
+{
+  svn_boolean_t quiet = FALSE;
 
-  SVN_ERR (svn_opt_print_help (os,
-                               "svn",   /* ### erm, derive somehow? */
-                               opt_state ? opt_state->version : FALSE,
-                               opt_state ? opt_state->quiet : FALSE,
-                               ra_desc_all->data,
-                               gettext (svn_cl__help_header),
-                               svn_cl__cmd_table,
-                               svn_cl__options,
-                               gettext (svn_cl__help_footer),
-                               pool));
+  if (baton)
+    {
+      const svn_cl__opt_state_t *const opt_state =
+        ((svn_cl__cmd_baton_t *) baton)->opt_state;
+      quiet = opt_state->quiet;
+    }
 
-  return SVN_NO_ERROR;
+  return print_help (os, TRUE, quiet, pool);
 }

Modified: trunk/subversion/clients/cmdline/main.c
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/clients/cmdline/main.c?view=di \
ff&rev=10430&p1=trunk/subversion/clients/cmdline/main.c&r1=10429&p2=trunk/subversion/clients/cmdline/main.c&r2=10430
 ==============================================================================
--- trunk/subversion/clients/cmdline/main.c	(original)
+++ trunk/subversion/clients/cmdline/main.c	Tue Jul 27 15:17:51 2004
@@ -670,6 +670,10 @@
     {'r', 'N', 'q', svn_cl__merge_cmd_opt, SVN_CL__AUTH_OPTIONS, 
      svn_cl__config_dir_opt} },
 
+  { "version", svn_cl__version, {"ver"},
+    N_("Print client version info\n"),
+    {'q', svn_cl__config_dir_opt} },
+
   { NULL, NULL, {0}, NULL, {0} }
 };
 

Modified: trunk/subversion/tests/clients/cmdline/getopt_tests.py
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_t \
ests.py?view=diff&rev=10430&p1=trunk/subversion/tests/clients/cmdline/getopt_tests.py&r1=10429&p2=trunk/subversion/tests/clients/cmdline/getopt_tests.py&r2=10430
 ==============================================================================
--- trunk/subversion/tests/clients/cmdline/getopt_tests.py	(original)
+++ trunk/subversion/tests/clients/cmdline/getopt_tests.py	Tue Jul 27 15:17:51 2004
@@ -176,6 +176,14 @@
   "run svn help bogus-cmd"
   run_one_test(sbox, 'svn_help_bogus-cmd', 'help', 'bogus-cmd')
 
+def getopt_version(sbox):
+  "run svn version"
+  run_one_test(sbox, 'svn_version', 'version')
+
+def getopt_ver__q(sbox):
+  "run svn ver -q"
+  run_one_test(sbox, 'svn_ver-q', 'ver', '-q')
+
 ########################################################################
 # Run the tests
 
@@ -189,7 +197,9 @@
               getopt_help,
               getopt_help__version,
               getopt_help_bogus_cmd,
-              getopt_help_log_switch
+              getopt_help_log_switch,
+              getopt_version,
+              getopt_ver__q
             ]
 
 if __name__ == '__main__':

Modified: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_t \
ests_data/svn--help_stdout?view=diff&rev=10430&p1=trunk/subversion/tests/clients/cmdli \
ne/getopt_tests_data/svn--help_stdout&r1=10429&p2=trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout&r2=10430
 ==============================================================================
--- trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout	(original)
                
+++ trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn--help_stdout	Tue Jul \
27 15:17:51 2004 @@ -35,6 +35,7 @@
    status (stat, st)
    switch (sw)
    update (up)
+   version (ver)
 
 Subversion is a tool for version control.
 For additional information, see http://subversion.tigris.org/

Modified: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_t \
ests_data/svn_help_stdout?view=diff&rev=10430&p1=trunk/subversion/tests/clients/cmdlin \
e/getopt_tests_data/svn_help_stdout&r1=10429&p2=trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout&r2=10430
 ==============================================================================
--- trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout	(original)
                
+++ trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_help_stdout	Tue Jul \
27 15:17:51 2004 @@ -35,6 +35,7 @@
    status (stat, st)
    switch (sw)
    update (up)
+   version (ver)
 
 Subversion is a tool for version control.
 For additional information, see http://subversion.tigris.org/

Added: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stderr
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stderr?view=auto&rev=10430
 ==============================================================================

Added: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stdout
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stdout?view=auto&rev=10430
 ==============================================================================
--- (empty file)
+++ trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_ver-q_stdout	Tue Jul \
27 15:17:51 2004 @@ -0,0 +1 @@
+0.14.0

Added: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stderr
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stderr?view=auto&rev=10430
 ==============================================================================

Added: trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stdout
Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stdout?view=auto&rev=10430
 ==============================================================================
--- (empty file)
+++ trunk/subversion/tests/clients/cmdline/getopt_tests_data/svn_version_stdout	Tue \
Jul 27 15:17:51 2004 @@ -0,0 +1,17 @@
+svn, version 0.16.0 (r3987)
+   compiled Dec  5 2002, 00:02:51
+
+Copyright (C) 2000-2003 CollabNet.
+Subversion is open source software, see http://subversion.tigris.org/
+This product includes software developed by CollabNet (http://www.Collab.Net/).
+
+The following repository access (RA) modules are available:
+
+* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
+  - handles 'http' schema
+  - handles 'https' schema
+* ra_local : Module for accessing a repository on local disk.
+  - handles 'file' schema
+* ra_svn : Module for accessing a repository using the svn network protocol.
+  - handles 'svn' schema
+

---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
For additional commands, e-mail: svn-help@subversion.tigris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic