Hi,

This patch makes the "svnrdump's" help to display the
subcommand-specific documentation.
( similar to "svn", "svnlook", "svnadmin" ...)

 Previously, "svnrdump dump --help" does *not* display the
help-documentation corresponding to "dump", but "svnrdump help dump" did
as expected. 

Meanwhile, few other observations in the *current* behaviour are :

1. The "svnrdump" does *not* display the generic documentation as
follows...

" Type 'svn --version' to see the program version and RA modules "

eventhough it supports "svnrdump --version".

2. "svnrdump --version --junk" also displays the version documentation,
which it should *not*.

I am working on these observations to make them behave uniformly and
will come up in further patches.

I have attached the patch and the log file with this mail. 


Thanks and regards
Prabhu
Index: subversion/svnrdump/svnrdump.c
===================================================================
--- subversion/svnrdump/svnrdump.c	(revision 1049536)
+++ subversion/svnrdump/svnrdump.c	(working copy)
@@ -158,6 +158,7 @@
 typedef struct opt_baton_t {
   svn_ra_session_t *session;
   const char *url;
+  svn_boolean_t help;
   svn_opt_revision_t start_revision;
   svn_opt_revision_t end_revision;
   svn_boolean_t quiet;
@@ -750,8 +751,7 @@
           exit(EXIT_SUCCESS);
           break;
         case 'h':
-          SVNRDUMP_ERR(help_cmd(os, opt_baton, pool));
-          exit(EXIT_SUCCESS);
+          opt_baton->help = TRUE;
           break;
         case opt_auth_username:
           SVNRDUMP_ERR(svn_utf_cstring_to_utf8(&username, opt_arg, pool));
@@ -780,34 +780,42 @@
         }
     }
 
-  if (os->ind >= os->argc)
+  if (opt_baton->help)
+    subcommand = svn_opt_get_canonical_subcommand2(svnrdump__cmd_table,
+                                                 "help");
+
+  if (subcommand == NULL)
     {
-      svn_error_clear(svn_cmdline_fprintf(stderr, pool,
-                                          _("Subcommand argument required\n")));
-      SVNRDUMP_ERR(help_cmd(NULL, NULL, pool));
-      svn_pool_destroy(pool);
-      exit(EXIT_FAILURE);
-    }
+      if (os->ind >= os->argc)
+        {
+          svn_error_clear(svn_cmdline_fprintf(stderr, pool,
+                                              _("Subcommand argument required\n")));
+          SVNRDUMP_ERR(help_cmd(NULL, NULL, pool));
+          svn_pool_destroy(pool);
+          exit(EXIT_FAILURE);
+        }
 
-  first_arg = os->argv[os->ind++];
+      else
+        {
+          first_arg = os->argv[os->ind++];
+          subcommand = svn_opt_get_canonical_subcommand2(svnrdump__cmd_table,
+                                                         first_arg);
 
-  subcommand = svn_opt_get_canonical_subcommand2(svnrdump__cmd_table,
-                                                 first_arg);
-
-  if (subcommand == NULL)
-    {
-      const char *first_arg_utf8;
-      err = svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg, pool);
-      if (err)
-        return svn_cmdline_handle_exit_error(err, pool, "svnrdump: ");
-      svn_error_clear(svn_cmdline_fprintf(stderr, pool,
-                                          _("Unknown command: '%s'\n"),
-                                          first_arg_utf8));
-      SVNRDUMP_ERR(help_cmd(NULL, NULL, pool));
-      svn_pool_destroy(pool);
-      exit(EXIT_FAILURE);
+          if (subcommand == NULL)
+            {
+              const char *first_arg_utf8;
+              err = svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg, pool);
+              if (err)
+                return svn_cmdline_handle_exit_error(err, pool, "svnrdump: ");
+              svn_error_clear(svn_cmdline_fprintf(stderr, pool,
+                                                  _("Unknown command: '%s'\n"),
+                                                  first_arg_utf8));
+              SVNRDUMP_ERR(help_cmd(NULL, NULL, pool));
+              svn_pool_destroy(pool);
+              exit(EXIT_FAILURE);
+            }
+         }
     }
-
   /* Check that the subcommand wasn't passed any inappropriate options. */
   for (i = 0; i < received_opts->nelts; i++)
     {
[[[
Make svnrdump display the help manual correctly.

* subversion/svnrdump/svnrdump.c
  main(): set the option baton and display the help manual for the corresponding
          subcommand.

Patch by: Prabhu Gnana Sundar <prabh...@collab.net>
Suggested by: Kamesh Jayachandran <kam...@collab.net>
]]]

Reply via email to