Log
[[[
Make 'svn switch' verify that the target path is local.
* subversion/libsvn_client/switch.c,
subversion/svn/switch-cmd.c
(svn_client_switch2, svn_cl__switch): Raise an error if target path is
not local.
* subversion/tests/cmdline/input_validation_tests.py
(invalid_switch_targets, test_list): New test.
Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]
Thanks and Regards
Noorul
Index: subversion/tests/cmdline/input_validation_tests.py
===================================================================
--- subversion/tests/cmdline/input_validation_tests.py (revision 1036324)
+++ subversion/tests/cmdline/input_validation_tests.py (working copy)
@@ -222,6 +222,12 @@
run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'patch',
target1, target2)
+def invalid_switch_targets(sbox):
+ "non-working copy paths for 'switch'"
+ sbox.build(read_only=True)
+ run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'switch',
+ "^/", "^/")
+
########################################################################
# Run the tests
@@ -247,6 +253,7 @@
invalid_unlock_targets,
invalid_status_targets,
invalid_patch_targets,
+ invalid_switch_targets,
]
if __name__ == '__main__':
Index: subversion/svn/switch-cmd.c
===================================================================
--- subversion/svn/switch-cmd.c (revision 1036324)
+++ subversion/svn/switch-cmd.c (working copy)
@@ -144,6 +144,13 @@
(SVN_ERR_BAD_URL, NULL,
_("'%s' does not appear to be a URL"), switch_url);
+ /* Target path cannot be URL */
+ if (svn_path_is_url(target))
+ return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+ NULL,
+ _("'%s' is not a local path"),
+ target));
+
/* Canonicalize the URL. */
switch_url = svn_uri_canonicalize(switch_url, scratch_pool);
Index: subversion/libsvn_client/switch.c
===================================================================
--- subversion/libsvn_client/switch.c (revision 1036324)
+++ subversion/libsvn_client/switch.c (working copy)
@@ -329,6 +329,11 @@
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
+ if (svn_path_is_url(path))
+ return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"),
+ path));
+
return svn_client__switch_internal(result_rev, path, switch_url,
peg_revision, revision, depth,
depth_is_sticky, NULL, ignore_externals,
Received on 2010-11-18 06:55:03 CET