You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/08/02 17:27:04 UTC
svn commit: r981559 - in /subversion/trunk/subversion:
libsvn_client/delete.c svn/delete-cmd.c
tests/cmdline/input_validation_tests.py
Author: stsp
Date: Mon Aug 2 15:27:03 2010
New Revision: 981559
URL: http://svn.apache.org/viewvc?rev=981559&view=rev
Log:
* subversion/svn/delete-cmd.c,
subversion/libsvn_client/delete.c
(svn_cl__delete, svn_client_delete4): Raise an error if mixed URL and
working copy targets are passed. Fixes a user-triggerable assertion.
* subversion/tests/cmdline/input_validation_tests.py
(invalid_delete_targets): New test, verify that svn delete errors out
in a desirable way if mixed URL and working copy targets are passed.
Modified:
subversion/trunk/subversion/libsvn_client/delete.c
subversion/trunk/subversion/svn/delete-cmd.c
subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=981559&r1=981558&r2=981559&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Mon Aug 2 15:27:03 2010
@@ -318,17 +318,31 @@ svn_client_delete4(const apr_array_heade
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
+ svn_boolean_t is_url;
+ int i;
+
if (! paths->nelts)
return SVN_NO_ERROR;
- if (svn_path_is_url(APR_ARRAY_IDX(paths, 0, const char *)))
+ /* Check that all targets are of the same type. */
+ is_url = svn_path_is_url(APR_ARRAY_IDX(paths, 0, const char *));
+ for (i = 1; i < paths->nelts; i++)
+ {
+ const char *path = APR_ARRAY_IDX(paths, i, const char *);
+ if (is_url != svn_path_is_url(path))
+ return svn_error_return(
+ svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Cannot mix repository and working copy "
+ "targets")));
+ }
+
+ if (is_url)
{
SVN_ERR(delete_urls(paths, revprop_table, ctx, pool));
}
else
{
apr_pool_t *subpool = svn_pool_create(pool);
- int i;
for (i = 0; i < paths->nelts; i++)
{
Modified: subversion/trunk/subversion/svn/delete-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/delete-cmd.c?rev=981559&r1=981558&r2=981559&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/delete-cmd.c (original)
+++ subversion/trunk/subversion/svn/delete-cmd.c Mon Aug 2 15:27:03 2010
@@ -47,6 +47,8 @@ svn_cl__delete(apr_getopt_t *os,
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
svn_error_t *err;
+ svn_boolean_t is_url;
+ int i;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -55,7 +57,19 @@ svn_cl__delete(apr_getopt_t *os,
if (! targets->nelts)
return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
- if (! svn_path_is_url(APR_ARRAY_IDX(targets, 0, const char *)))
+ /* Check that all targets are of the same type. */
+ is_url = svn_path_is_url(APR_ARRAY_IDX(targets, 0, const char *));
+ for (i = 1; i < targets->nelts; i++)
+ {
+ const char *target = APR_ARRAY_IDX(targets, i, const char *);
+ if (is_url != svn_path_is_url(target))
+ return svn_error_return(
+ svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Cannot mix repository and working copy "
+ "targets")));
+ }
+
+ if (! is_url)
{
ctx->log_msg_func3 = NULL;
if (opt_state->message || opt_state->filedata || opt_state->revprop_table)
Modified: subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/input_validation_tests.py?rev=981559&r1=981558&r2=981559&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Mon Aug 2 15:27:03 2010
@@ -105,6 +105,12 @@ def invalid_copy_target(sbox):
run_and_verify_svn_in_wc(sbox, "svn: Path '.*' is not a directory",
'copy', mu_path, C_path, "iota")
+def invalid_delete_targets(sbox):
+ "invalid targets for 'delete'"
+ sbox.build(read_only=True)
+ for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
+ run_and_verify_svn_in_wc(sbox, "svn: Cannot mix repository and working "
+ "copy targets", 'delete', target1, target2)
########################################################################
# Run the tests
@@ -117,6 +123,7 @@ test_list = [ None,
invalid_wcpath_commit,
invalid_copy_sources,
invalid_copy_target,
+ invalid_delete_targets,
]
if __name__ == '__main__':