[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Fix for issue 3620 - relocate command

From: Noorul Islam K M <noorul_at_collab.net>
Date: Thu, 18 Nov 2010 12:24:04 +0530

Log

[[[

Make 'svn relocate' verify that the target working copy root dir is
local.

* 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>

]]]

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_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
 
@@ -247,6 +253,7 @@
               invalid_unlock_targets,
               invalid_status_targets,
               invalid_patch_targets,
+ invalid_relocate_targets,
              ]
 
 if __name__ == '__main__':
Index: subversion/svn/relocate-cmd.c
===================================================================
--- subversion/svn/relocate-cmd.c (revision 1036324)
+++ subversion/svn/relocate-cmd.c (working copy)
@@ -97,8 +97,20 @@
           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_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);
               path = APR_ARRAY_IDX(targets, i, const char *);
               SVN_ERR(svn_client_relocate2(path, from, to, ignore_externals,
Index: subversion/libsvn_client/relocate.c
===================================================================
--- subversion/libsvn_client/relocate.c (revision 1036324)
+++ subversion/libsvn_client/relocate.c (working copy)
@@ -217,6 +217,11 @@
   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_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. */
Received on 2010-11-18 07:56:41 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.