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/18 11:11:11 UTC

svn commit: r1036383 - in /subversion/trunk/subversion: libsvn_client/relocate.c svn/relocate-cmd.c tests/cmdline/input_validation_tests.py

Author: julianfoad
Date: Thu Nov 18 10:11:10 2010
New Revision: 1036383

URL: http://svn.apache.org/viewvc?rev=1036383&view=rev
Log:
Make 'svn relocate' verify that the target working copy root dir is
local.  Part of issue #3620.

* subversion/libsvn_client/relocate.c,
  subversion/svn/relocate-cmd.c
  (svn_client_relocate2, svn_cl__relocate): Raise an error if target
    working copy dir is not local.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_relocate_targets, test_list): New test.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
(tweaked by me)

Modified:
    subversion/trunk/subversion/libsvn_client/relocate.c
    subversion/trunk/subversion/svn/relocate-cmd.c
    subversion/trunk/subversion/tests/cmdline/input_validation_tests.py

Modified: subversion/trunk/subversion/libsvn_client/relocate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/relocate.c?rev=1036383&r1=1036382&r2=1036383&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/relocate.c (original)
+++ subversion/trunk/subversion/libsvn_client/relocate.c Thu Nov 18 10:11:10 2010
@@ -217,6 +217,11 @@ svn_client_relocate2(const char *wcroot_
   vb.url_uuids = apr_array_make(pool, 1, sizeof(struct url_uuid_t));
   vb.pool = pool;
 
+  if (svn_path_is_url(wcroot_dir))
+    return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+                             _("'%s' is not a local path"),
+                             wcroot_dir);
+
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, wcroot_dir, pool));
 
   /* If we're ignoring externals, just relocate and get outta here. */

Modified: subversion/trunk/subversion/svn/relocate-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/relocate-cmd.c?rev=1036383&r1=1036382&r2=1036383&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/relocate-cmd.c (original)
+++ subversion/trunk/subversion/svn/relocate-cmd.c Thu Nov 18 10:11:10 2010
@@ -97,6 +97,16 @@ svn_cl__relocate(apr_getopt_t *os,
           apr_pool_t *subpool = svn_pool_create(scratch_pool);
           int i;
 
+          /* Target working copy root dir must be local. */
+          for (i = 2; i < targets->nelts; i++)
+            {
+              path = APR_ARRAY_IDX(targets, i, const char *);
+              if (svn_path_is_url(path))
+                return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                         _("'%s' is not a local path"),
+                                         path);
+            }
+
           for (i = 2; i < targets->nelts; i++)
             {
               svn_pool_clear(subpool);

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=1036383&r1=1036382&r2=1036383&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Thu Nov 18 10:11:10 2010
@@ -228,6 +228,12 @@ def invalid_switch_targets(sbox):
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'switch',
                            "^/", "^/")
 
+def invalid_relocate_targets(sbox):
+  "non-working copy paths for 'relocate'"
+  sbox.build(read_only=True)
+  run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'relocate',
+                           "^/", "^/", "^/")
+
 ########################################################################
 # Run the tests
 
@@ -254,6 +260,7 @@ test_list = [ None,
               invalid_status_targets,
               invalid_patch_targets,
               invalid_switch_targets,
+              invalid_relocate_targets,
              ]
 
 if __name__ == '__main__':