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

Re: PATCH: Reject a revision range rather than ignoring part of it

From: <kfogel_at_collab.net>
Date: 2003-11-24 04:43:18 CET

Julian Foad <julianfoad@btopenworld.com> writes:
> I assume we want this better input validation. Any comments, or is
> it OK to commit it?

+1 all *over* that stuff

(W/ Philip's comment about error message capitalization, of course).

Nice,
-Karl

> [[[
> Subcommands that cannot use a revision range will now reject a revision range
> rather than ignoring part of it.
>
> * subversion/clients/cmdline/cat-cmd.c
> (svn_cl__cat): Move the check for a revision range out to "main.c",
> because many subcommands should check this.
>
> * subversion/clients/cmdline/main.c
> (main): Disallow a revision range except for the few commands that can
> accept one.
> ]]]
>
> - Julian
>
>
> Subcommands that cannot use a revision range will now reject a revision range
> rather than ignoring part of it.
>
> * subversion/clients/cmdline/cat-cmd.c
> (svn_cl__cat): Move the check for a revision range out to "main.c",
> because many subcommands should check this.
>
> * subversion/clients/cmdline/main.c
> (main): Disallow a revision range except for the few commands that can
> accept one.
>
> Index: subversion/clients/cmdline/cat-cmd.c
> ===================================================================
> --- subversion/clients/cmdline/cat-cmd.c (revision 7831)
> +++ subversion/clients/cmdline/cat-cmd.c (working copy)
> @@ -44,10 +44,6 @@ svn_cl__cat (apr_getopt_t *os,
> svn_stream_t *out;
> apr_pool_t *subpool = svn_pool_create (pool);
>
> - if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
> - return svn_error_createf (SVN_ERR_CLIENT_REVISION_RANGE, NULL,
> - "cat only accepts a single revision");
> -
> SVN_ERR (svn_opt_args_to_target_array (&targets, os,
> opt_state->targets,
> &(opt_state->start_revision),
> Index: subversion/clients/cmdline/main.c
> ===================================================================
> --- subversion/clients/cmdline/main.c (revision 7831)
> +++ subversion/clients/cmdline/main.c (working copy)
> @@ -1071,6 +1071,24 @@ main (int argc, const char * const *argv
> }
> }
>
> + /* Only a few commands can accept a revision range; the rest can take at
> + most one revision number. */
> + if (subcommand->cmd_func != svn_cl__blame
> + && subcommand->cmd_func != svn_cl__diff
> + && subcommand->cmd_func != svn_cl__log
> + && subcommand->cmd_func != svn_cl__merge)
> + {
> + if (opt_state.end_revision.kind != svn_opt_revision_unspecified)
> + {
> + svn_handle_error
> + (svn_error_create (SVN_ERR_CLIENT_REVISION_RANGE, NULL,
> + "this command only accepts a single revision"),
> + stderr, FALSE);
> + svn_pool_destroy (pool);
> + return EXIT_FAILURE;
> + }
> + }
> +
> /* Create a client context object. */
> command_baton.opt_state = &opt_state;
> command_baton.ctx = &ctx;
>
> ---------------------------------------------------------------------
> 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 Mon Nov 24 05:27:55 2003

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