Author: brane
Date: Wed Feb 25 14:34:55 2015
New Revision: 1662227
URL: http://svn.apache.org/r1662227
Log:
On the svn-inf-detail branch: Make error messages more concise
and consistent with other subcommands.
* subversion/svn/info-cmd.c
(svn_cl__info): Change the texts of the parsing error messages to show
the complete offending option names. Do not allow --no-newline with
multiple targets.
* subversion/tests/cmdline/info_tests.py
(info_item_simple, info_item_failures): Update test cases.
Modified:
subversion/branches/svn-info-detail/subversion/svn/info-cmd.c
subversion/branches/svn-info-detail/subversion/tests/cmdline/info_tests.py
Modified: subversion/branches/svn-info-detail/subversion/svn/info-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/branches/svn-info-detail/subversion/svn/info-cmd.c?rev=1662227&r1=1662226&r2=1662227&view=diff
==============================================================================
--- subversion/branches/svn-info-detail/subversion/svn/info-cmd.c (original)
+++ subversion/branches/svn-info-detail/subversion/svn/info-cmd.c Wed Feb 25
14:34:55 2015
@@ -878,13 +878,13 @@ svn_cl__info(apr_getopt_t *os,
receiver = print_info_xml;
if (opt_state->show_item)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("the 'show-item' option is not valid"
- " in XML mode"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--show-item is not valid in --xml mode"));
if (opt_state->no_newline)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("the 'no-newline' option is only valid"
- " with the 'show-item' option"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline' is only valid with --show-item"));
/* If output is not incremental, output the XML header and wrap
everything in a top-level element. This makes the output in
@@ -897,13 +897,19 @@ svn_cl__info(apr_getopt_t *os,
receiver = print_info_item;
if (opt_state->incremental)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("the 'incremental' option is only valid"
- " in XML mode"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--incremental is only valid in --xml mode"));
- SVN_ERR(find_print_what(opt_state->show_item, &receiver_baton, pool));
receiver_baton.multiple_targets = (opt_state->depth > svn_depth_empty
|| targets->nelts > 1);
+ if (receiver_baton.multiple_targets && opt_state->no_newline)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline is only available for single-target,"
+ " non-recursive info operations"));
+
+ SVN_ERR(find_print_what(opt_state->show_item, &receiver_baton, pool));
receiver_baton.start_new_line = FALSE;
}
else
@@ -911,13 +917,13 @@ svn_cl__info(apr_getopt_t *os,
receiver = print_info;
if (opt_state->incremental)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("the 'incremental' option is only valid"
- " in XML mode"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--incremental is only valid in --xml mode"));
if (opt_state->no_newline)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("the 'no-newline' option is only valid"
- " with the 'show-item' option"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline' is only valid with --show-item"));
}
if (opt_state->depth == svn_depth_unknown)
Modified:
subversion/branches/svn-info-detail/subversion/tests/cmdline/info_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/svn-info-detail/subversion/tests/cmdline/info_tests.py?rev=1662227&r1=1662226&r2=1662227&view=diff
==============================================================================
--- subversion/branches/svn-info-detail/subversion/tests/cmdline/info_tests.py
(original)
+++ subversion/branches/svn-info-detail/subversion/tests/cmdline/info_tests.py
Wed Feb 25 14:34:55 2015
@@ -642,8 +642,8 @@ def info_item_simple(sbox):
sbox.build(read_only=True)
svntest.actions.run_and_verify_svn(
'1', [],
- 'info', '--show-item=revision',
- '--no-newline', sbox.ospath(''))
+ 'info', '--show-item=revision', '--no-newline',
+ sbox.ospath(''))
def info_item_simple_multiple(sbox):
@@ -722,14 +722,29 @@ def info_item_failures(sbox):
sbox.build(read_only=True)
svntest.actions.run_and_verify_svn(
- None, r".*E205000: .*('svn help info'|; did you mean 'wc-root'\?).*",
+ None, r'.*E200009:.*',
+ 'info', '--show-item=revision',
+ sbox.ospath('not-there'))
+
+ svntest.actions.run_and_verify_svn(
+ None, r".*E205000: .*; did you mean 'wc-root'\?",
'info', '--show-item=root',
sbox.ospath(''))
svntest.actions.run_and_verify_svn(
- None, r'.*(W155010|E200009):.*',
- 'info', '--show-item=revision',
- sbox.ospath('not-there'))
+ None, (r".*E205000: --show-item is not valid in --xml mode"),
+ 'info', '--show-item=revision', '--xml',
+ sbox.ospath(''))
+
+ svntest.actions.run_and_verify_svn(
+ None, (r".*E205000: --incremental is only valid in --xml mode"),
+ 'info', '--show-item=revision', '--incremental',
+ sbox.ospath(''))
+
+ svntest.actions.run_and_verify_svn(
+ None, (r".*E205000: --no-newline is only available.*"),
+ 'info', '--show-item=revision', '--no-newline',
+ sbox.ospath('A'), sbox.ospath('iota'))
########################################################################