You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/11/15 11:20:11 UTC
svn commit: r1035208 - in /subversion/trunk/subversion: svn/unlock-cmd.c
tests/cmdline/input_validation_tests.py
Author: julianfoad
Date: Mon Nov 15 10:20:10 2010
New Revision: 1035208
URL: http://svn.apache.org/viewvc?rev=1035208&view=rev
Log:
Make 'svn unlock' verify that both working copy paths and URLs are not
passed.
* subversion/tests/cmdline/input_validation_tests.py
(invalid_unlock_targets): New test, verifying that svn unlock copes well
with invalid target combinations.
* subversion/svn/unlock-cmd.c
(svn_cl__unlock): For consistency with other sub-commands, raise the
SVN_ERR_CL_ARG_PARSING_ERROR if both working copy paths and URLs are
passed, and use the same error message also used elsewhere.
Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
Modified:
subversion/trunk/subversion/svn/unlock-cmd.c
subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
Modified: subversion/trunk/subversion/svn/unlock-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/unlock-cmd.c?rev=1035208&r1=1035207&r2=1035208&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/unlock-cmd.c (original)
+++ subversion/trunk/subversion/svn/unlock-cmd.c Mon Nov 15 10:20:10 2010
@@ -27,6 +27,7 @@
/*** Includes. ***/
+#include "svn_path.h"
#include "svn_pools.h"
#include "svn_client.h"
#include "svn_error_codes.h"
@@ -48,6 +49,8 @@ svn_cl__unlock(apr_getopt_t *os,
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
+ svn_boolean_t wc_present = FALSE, url_present = FALSE;
+ int i;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -59,6 +62,23 @@ svn_cl__unlock(apr_getopt_t *os,
SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, scratch_pool));
+ /* Check to see if at least one of our paths is a working copy
+ * path or a repository url. */
+ for (i = 0; i < targets->nelts; ++i)
+ {
+ const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+ if (! svn_path_is_url(target))
+ wc_present = TRUE;
+ else
+ url_present = TRUE;
+ }
+
+ if (url_present && wc_present)
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Cannot mix repository and working copy "
+ "targets"));
+
return svn_error_return(
svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
}
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=1035208&r1=1035207&r2=1035208&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Mon Nov 15 10:20:10 2010
@@ -201,6 +201,13 @@ def invalid_lock_targets(sbox):
run_and_verify_svn_in_wc(sbox, "svn: Cannot mix repository and working "
"copy targets", 'lock', target1, target2)
+def invalid_unlock_targets(sbox):
+ "wc paths and repo URL target mixture for 'unlock'"
+ 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", 'unlock', target1, target2)
+
def invalid_status_targets(sbox):
"non-working copy paths for 'status'"
sbox.build(read_only=True)
@@ -230,6 +237,7 @@ test_list = [ None,
invalid_resolved_targets,
invalid_revert_targets,
invalid_lock_targets,
+ invalid_unlock_targets,
invalid_status_targets,
]