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

Re: PATCH: client shows help instead of certain specific error messages

From: Sander Roobol <phy_at_wanadoo.nl>
Date: 2003-04-25 14:37:59 CEST

FWIW, filed as issue #1265.

Sander

On Wed, Apr 09, 2003 at 12:30:21AM +0100, Julian Foad wrote:
> For certain argument parsing errors, "svn diff" and other commands show
> help text even though a specific error message has been set up by the code
> that detected the error.
>
> Reproduction transcript:
>
> >~/src/subversion> svn diff http://any.url/
> >diff (di): display the differences between two paths.
> >usage: 1. diff [-r N[:M]] [TARGET [TARGET ... ]]
> > 2. diff URL1[@N] URL2[@M]
> >
> > 1. Each TARGET can be either a working copy path or URL. If no
> > TARGET is specified, a value of '.' is assumed.
> >
> > If TARGET is a URL, then revs N and M must be given via -r.
> ...[blah blah]...
>
> This is what it wanted to display (the code in diff-cmd.c sets up this
> error message):
>
> >~/src/subversion> svn diff http://any.url/
> >subversion/clients/cmdline/diff-cmd.c:92: (apr_err=205000)
> >svn: Client error in parsing arguments
> >svn: Second URL is required.
>
> The current behaviour was introduced in revision 1882 to ensure that
> something useful would be displayed for argument parsing errors, rather
> than nothing at all. Presumably at that time specific error messages were
> not being created, but now in some cases they are.
>
> Here is a log message for the attached patch to improve the behaviour:
>
> For argument parsing errors, do not just show the help message, because
> useful
> information is thrown away. Instead, show an explicit error message if one
> is
> available, otherwise show the help.
>
> * subversion/clients/cmdline/main.c:
> (main) If an argument parsing error has a non-empty message, display that
> message instead of the help.
>
>
> This patch assumes that null error messages are represented by an empty
> string rather than by a null pointer, which is the case throughout the
> command-line client at present. I do not know whether this policy is or
> should be written down anywhere - perhaps it should be in the documentation
> of svn_error_create.
>
> - Julian
>

> Index: subversion/clients/cmdline/main.c
> ===================================================================
> --- subversion/clients/cmdline/main.c (revision 5577)
> +++ subversion/clients/cmdline/main.c (working copy)
> @@ -1093,7 +1093,7 @@
> {
> svn_error_t *tmp_err;
>
> - if (err->apr_err == SVN_ERR_CL_ARG_PARSING_ERROR)
> + if (err->apr_err == SVN_ERR_CL_ARG_PARSING_ERROR && *err->message == '\0')
> svn_opt_subcommand_help (subcommand->name, svn_cl__cmd_table,
> svn_cl__options, pool);
> else
>

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 25 14:38:44 2003

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.