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

Re: [PATCH] Improve svn cat/info error messages.

From: Gavin Beau Baumanis <gavinb_at_thespidernet.com>
Date: Sun, 27 Feb 2011 22:49:49 +1100

Ping. This submission has received no comments.

On 15/02/2011, at 2:42 AM, Noorul Islam K M wrote:

>
> Log
> [[[
>
> Improve error message displayed by info/cat for consistency.
>
> * subversion/svn/info-cmd.c,
> * subversion/svn/cat-cmd.c
> (svn_cl__info, svn_cl__cat): Improve error message. Use meaningful
> variable.
>
> * subversion/tests/cmdline/cat_tests.py
> (cat_skip_uncattable): Modify test
>
> Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
> ]]]
>
> Thanks and Regards
> Noorul
>
> Index: subversion/tests/cmdline/cat_tests.py
> ===================================================================
> --- subversion/tests/cmdline/cat_tests.py (revision 1070514)
> +++ subversion/tests/cmdline/cat_tests.py (working copy)
> @@ -158,8 +158,9 @@
> svntest.actions.run_and_verify_svn2(None, expected_out, expected_err2, 1,
> 'cat', rho_path, new_file_path)
>
> - expected_err3 = expected_err1 + expected_err2 + ".*\n" + \
> - "svn: E200000: A problem occurred; see other errors for details\n"
> + expected_err3 = expected_err1 + expected_err2 + \
> + ".*\nsvn: E200009: Could not cat all targets because some targets " + \
> + "don't exist\n"
> expected_err_re = re.compile(expected_err3)
>
> exit_code, output, error = svntest.main.run_svn(1, 'cat', rho_path, G_path, new_file_path)
> Index: subversion/svn/cat-cmd.c
> ===================================================================
> --- subversion/svn/cat-cmd.c (revision 1070514)
> +++ subversion/svn/cat-cmd.c (working copy)
> @@ -32,6 +32,8 @@
> #include "svn_error.h"
> #include "cl.h"
>
> +#include "svn_private_config.h"
> +
>
> /*** Code. ***/
>
> @@ -47,7 +49,7 @@
> int i;
> svn_stream_t *out;
> apr_pool_t *subpool = svn_pool_create(pool);
> - svn_boolean_t saw_a_problem = FALSE;
> + svn_boolean_t seen_nonexistent_target = FALSE;
>
> SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
> opt_state->targets,
> @@ -83,12 +85,14 @@
> SVN_ERR_FS_NOT_FOUND,
> SVN_NO_ERROR));
> if (! success)
> - saw_a_problem = TRUE;
> + seen_nonexistent_target = TRUE;
> }
> svn_pool_destroy(subpool);
>
> - if (saw_a_problem)
> - return svn_error_create(SVN_ERR_BASE, NULL, NULL);
> + if (seen_nonexistent_target)
> + return svn_error_create(
> + SVN_ERR_ILLEGAL_TARGET, NULL,
> + _("Could not cat all targets because some targets don't exist"));
> else
> return SVN_NO_ERROR;
> }
> Index: subversion/svn/info-cmd.c
> ===================================================================
> --- subversion/svn/info-cmd.c (revision 1070514)
> +++ subversion/svn/info-cmd.c (working copy)
> @@ -494,7 +494,7 @@
> apr_pool_t *subpool = svn_pool_create(pool);
> int i;
> svn_error_t *err;
> - svn_boolean_t saw_a_problem = FALSE;
> + svn_boolean_t seen_nonexistent_target = FALSE;
> svn_opt_revision_t peg_revision;
> svn_info_receiver_t receiver;
> const char *path_prefix;
> @@ -579,7 +579,7 @@
>
> svn_error_clear(err);
> err = NULL;
> - saw_a_problem = TRUE;
> + seen_nonexistent_target = TRUE;
> }
> }
> svn_pool_destroy(subpool);
> @@ -587,8 +587,11 @@
> if (opt_state->xml && (! opt_state->incremental))
> SVN_ERR(svn_cl__xml_print_footer("info", pool));
>
> - if (saw_a_problem)
> - return svn_error_create(SVN_ERR_BASE, NULL, NULL);
> + if (seen_nonexistent_target)
> + return svn_error_create(
> + SVN_ERR_ILLEGAL_TARGET, NULL,
> + _("Could not display info for all targets because some "
> + "targets don't exist"));
> else
> return SVN_NO_ERROR;
> }
Received on 2011-02-27 12:50:30 CET

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