Ping. Anything ever happen with this change?
On Wed, 30 Aug 2006, Mathias Weinert wrote:
> Hi there,
>
> please find enclosed a new version of the patch (thanks for the
> comments, Julian). Although it's no big thing, no new functionality
> and no real bug I like to see this patch (or anything similar)
> committed.
>
> Anyone willing to commit or modify it? Thanks in advance!
>
> Mathias
>
> [[[
>
> * subversion/svn/main.c
> Make svn always show the help for a given command when --help (or any
> equivalent) is set no matter what other (valid) options are given by
> replacing the given command line with a new and simple one.
>
> ]]]
>
> --- subversion/svn/main.c.orig 2006-08-14 22:47:44.000000000 +0200
> +++ subversion/svn/main.c 2006-08-24 07:46:04.763897500 +0200
> @@ -1217,62 +1217,71 @@
> if (err)
> return svn_cmdline_handle_exit_error(err, pool, "svn: ");
>
> - /* If the user asked for help, then the rest of the arguments are
> - the names of subcommands to get help on (if any), or else they're
> - just typos/mistakes. Whatever the case, the subcommand to
> - actually run is svn_cl__help(). */
> - if (opt_state.help)
> - subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table, "help");
> -
> - /* If we're not running the `help' subcommand, then look for a
> - subcommand in the first argument. */
> - if (subcommand == NULL)
> + /* Look for a subcommand in the first argument. */
> + if (os->ind >= os->argc)
> {
> - if (os->ind >= os->argc)
> + if (opt_state.version)
> {
> - if (opt_state.version)
> - {
> - /* Use the "help" subcommand to handle the "--version" option. */
> - static const svn_opt_subcommand_desc2_t pseudo_cmd =
> - { "--version", svn_cl__help, {0}, "",
> - {svn_cl__version_opt, /* must accept its own option */
> - 'q', /* brief output */
> - svn_cl__config_dir_opt /* all commands accept this */
> - } };
> + /* Use the "help" subcommand to handle the "--version" option. */
> + static const svn_opt_subcommand_desc2_t pseudo_cmd =
> + { "--version", svn_cl__help, {0}, "",
> + {svn_cl__version_opt, /* must accept its own option */
> + 'q', /* brief output */
> + svn_cl__config_dir_opt /* all commands accept this */
> + } };
>
> - subcommand = &pseudo_cmd;
> - }
> - else
> - {
> - svn_error_clear
> - (svn_cmdline_fprintf(stderr, pool,
> - _("Subcommand argument required\n")));
> - svn_cl__help(NULL, NULL, pool);
> - svn_pool_destroy(pool);
> - return EXIT_FAILURE;
> - }
> + subcommand = &pseudo_cmd;
> }
> else
> {
> - const char *first_arg = os->argv[os->ind++];
> - subcommand = svn_opt_get_canonical_subcommand2(svn_cl__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, "svn: ");
> - svn_error_clear
> - (svn_cmdline_fprintf(stderr, pool,
> - _("Unknown command: '%s'\n"),
> - first_arg_utf8));
> - svn_cl__help(NULL, NULL, pool);
> - svn_pool_destroy(pool);
> - return EXIT_FAILURE;
> - }
> + svn_error_clear
> + (svn_cmdline_fprintf(stderr, pool,
> + _("Subcommand argument required\n")));
> + svn_cl__help(NULL, NULL, pool);
> + svn_pool_destroy(pool);
> + return EXIT_FAILURE;
> }
> }
> + else
> + {
> + const char *first_arg = os->argv[os->ind++];
> + subcommand = svn_opt_get_canonical_subcommand2(svn_cl__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, "svn: ");
> + svn_error_clear
> + (svn_cmdline_fprintf(stderr, pool,
> + _("Unknown command: '%s'\n"),
> + first_arg_utf8));
> + svn_cl__help(NULL, NULL, pool);
> + svn_pool_destroy(pool);
> + return EXIT_FAILURE;
> + }
> + }
> +
> + /* If the user asked for help by setting the --help (or equivalent)
> + option we define a new dummy command line to use which only
> + specifies the subcommand and the --help option.
> + With this it doesn't matter which other options are set, the user
> + will always get help. */
> + if (opt_state.help)
> + {
> + /* Define a new command line for further use */
> + char* new_argv[2];
> + new_argv[0] = (char*) argv[0];
> + new_argv[1] = (char*) subcommand->name;
> + err = svn_cmdline__getopt_init(&os, 2, (const char**) new_argv, pool);
> + if (err)
> + return svn_cmdline_handle_exit_error(err, pool, "svn: ");
> + /* Set 'help' as subcommand. */
> + subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table, "help");
> + /* Reset all saved options. */
> + received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
> + }
>
> /* Check that the subcommand wasn't passed any inappropriate options. */
> for (i = 0; i < received_opts->nelts; i++)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
- application/pgp-signature attachment: stored
Received on Wed Sep 20 03:04:18 2006