On Wed, Mar 07, 2001 at 05:25:54AM -0000, fitz@tigris.org wrote:
>...
> --- cl.h 2001/03/04 18:36:00 1.34
> +++ cl.h 2001/03/07 05:25:54 1.35
> @@ -134,6 +134,7 @@
> svn_cl__diff,
> svn_cl__update;
>
> +void push_implicit_dot_target(apr_array_header_t *targets, apr_pool_t *pool);
That should be svn_cl__push_implicit_dot_target(). Well, maybe not that long
:-), but it *does* need namespace protection.
Cheers,
-g
>
>
> /*** Command-line output functions -- printing to the user. ***/
>
>
>
> 1.12 +5 -9 subversion/subversion/client/commit-cmd.c
>
> Index: commit-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/commit-cmd.c,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -r1.11 -r1.12
> --- commit-cmd.c 2001/02/06 00:45:51 1.11
> +++ commit-cmd.c 2001/03/07 05:25:54 1.12
> @@ -37,7 +37,11 @@
> svn_error_t *err;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *target = ((svn_string_t **) (targets->elts))[i];
> @@ -61,14 +65,6 @@
> if (err)
> return err;
> }
> - else
> - {
> - fprintf (stderr, "svn commit: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
> -
>
> return SVN_NO_ERROR;
> }
>
>
>
> 1.2 +5 -9 subversion/subversion/client/diff-cmd.c
>
> Index: diff-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/diff-cmd.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- diff-cmd.c 2001/01/26 14:21:06 1.1
> +++ diff-cmd.c 2001/03/07 05:25:54 1.2
> @@ -37,7 +37,11 @@
> svn_error_t *err;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *target = ((svn_string_t **) (targets->elts))[i];
> @@ -45,14 +49,6 @@
> err = svn_cl__print_file_diff (target, pool);
> if (err) return err;
> }
> - else
> - {
> - fprintf (stderr, "svn diff: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
> -
>
> return SVN_NO_ERROR;
> }
>
>
>
> 1.63 +16 -18 subversion/subversion/client/main.c
>
> Index: main.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/main.c,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -r1.62 -r1.63
> --- main.c 2001/03/04 18:23:38 1.62
> +++ main.c 2001/03/07 05:25:54 1.63
> @@ -19,6 +19,7 @@
> /*** Includes. ***/
>
> #include <string.h>
> +#include <assert.h>
>
> #include <apr_strings.h>
> #include <apr_getopt.h>
> @@ -121,6 +122,18 @@
> };
>
>
> +/* Some commands take an implicit "." string argument when invoked
> + * with no arguments. Those commands make use of this function to
> + * add "." to the target array if the user passes no args */
> +void push_implicit_dot_target(apr_array_header_t *targets, apr_pool_t *pool)
> +{
> + if (targets->nelts == 0) {
> + (*((svn_string_t **) apr_array_push (targets)))
> + = svn_string_create (".", pool);
> + }
> + assert(targets->nelts);
> +}
> +
> /* Return the entry in svn_cl__cmd_table whose name matches CMD_NAME,
> * or null if none. CMD_NAME may be an alias, in which case the alias
> * entry will be returned (so caller may need to canonicalize result). */
> @@ -396,25 +409,10 @@
> const char *this_arg = os->argv[os->ind];
> (*((svn_string_t **) apr_array_push (targets)))
> = svn_string_create (this_arg, pool);
> - }
> -
> - /* Certain commands have an implied `.' as argument, if nothing else
> - is specified. */
> - if ((targets->nelts == 0)
> - && ( (subcommand->cmd_code == svn_cl__commit_command)
> - || (subcommand->cmd_code == svn_cl__proplist_command)
> - || (subcommand->cmd_code == svn_cl__propget_command)
> - || (subcommand->cmd_code == svn_cl__status_command)
> - || (subcommand->cmd_code == svn_cl__update_command)))
> - {
> - (*((svn_string_t **) apr_array_push (targets)))
> - = svn_string_create (".", pool);
> - }
> - else
> - {
> - /* kff todo: need to remove redundancies from targets before
> - passing it to the cmd_func. */
> }
> +
> + /* kff todo: need to remove redundancies from targets before
> + passing it to the cmd_func. */
>
> /* Run the subcommand. */
> err = (*subcommand->cmd_func) (&opt_state, targets, pool);
>
>
>
> 1.9 +5 -8 subversion/subversion/client/propget-cmd.c
>
> Index: propget-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/propget-cmd.c,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- propget-cmd.c 2001/03/04 18:07:45 1.8
> +++ propget-cmd.c 2001/03/07 05:25:54 1.9
> @@ -39,7 +39,11 @@
> svn_error_t *err;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 file arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *value;
> @@ -54,13 +58,6 @@
> value);
> svn_cl__print_prop_hash (prop_hash, pool);
> }
> - else
> - {
> - fprintf (stderr, "svn propget: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
>
> return SVN_NO_ERROR;
> }
>
>
>
> 1.10 +5 -8 subversion/subversion/client/proplist-cmd.c
>
> Index: proplist-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/proplist-cmd.c,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- proplist-cmd.c 2001/02/08 12:32:41 1.9
> +++ proplist-cmd.c 2001/03/07 05:25:54 1.10
> @@ -37,7 +37,11 @@
> svn_error_t *err;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *target = ((svn_string_t **) (targets->elts))[i];
> @@ -49,13 +53,6 @@
>
> svn_cl__print_prop_hash (prop_hash, pool);
> }
> - else
> - {
> - fprintf (stderr, "svn proplist: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
>
> return SVN_NO_ERROR;
> }
>
>
>
> 1.10 +5 -9 subversion/subversion/client/status-cmd.c
>
> Index: status-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/status-cmd.c,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- status-cmd.c 2001/01/08 18:55:39 1.9
> +++ status-cmd.c 2001/03/07 05:25:54 1.10
> @@ -38,7 +38,11 @@
> apr_hash_t *statushash;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *target = ((svn_string_t **) (targets->elts))[i];
> @@ -54,14 +58,6 @@
>
> svn_cl__print_status_list (statushash, pool);
> }
> - else
> - {
> - fprintf (stderr, "svn status: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
> -
>
> return SVN_NO_ERROR;
> }
>
>
>
> 1.12 +5 -8 subversion/subversion/client/update-cmd.c
>
> Index: update-cmd.c
> ===================================================================
> RCS file: /cvs/subversion/subversion/client/update-cmd.c,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -r1.11 -r1.12
> --- update-cmd.c 2001/02/06 00:45:51 1.11
> +++ update-cmd.c 2001/03/07 05:25:54 1.12
> @@ -37,7 +37,11 @@
> svn_error_t *err;
> int i;
>
> - if (targets->nelts)
> + /* Add "." if user passed 0 arguments */
> + push_implicit_dot_target(targets, pool);
> +
> + /* FIXME: reformat block to remove extra spaces */
> +
> for (i = 0; i < targets->nelts; i++)
> {
> svn_string_t *target = ((svn_string_t **) (targets->elts))[i];
> @@ -59,13 +63,6 @@
> if (err)
> return err;
> }
> - else
> - {
> - fprintf (stderr, "svn update: arguments required\n");
> - err = svn_cl__help (opt_state, targets, pool);
> - if (err)
> - return err;
> - }
>
> return SVN_NO_ERROR;
> }
>
>
>
--
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:25 2006