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

svn commit: r1051059 - in /subversion/trunk/subversion: libsvn_client/copy.c tests/cmdline/copy_tests.py

Author: julianfoad
Date: Mon Dec 20 10:55:18 2010
New Revision: 1051059

URL: http://svn.apache.org/viewvc?rev=1051059&view=rev
Log:
Make 'svn move' display the correct error message while moving a URL onto or
into itself. (Instead of 'Cannot move URL', it was displaying 'Cannot move
path' with the URL formatted as if it were a local path.) Add missing tests.

* subversion/libsvn_client/copy.c
  (try_copy): Display error message based on source type.
  (repos_to_repos_copy): Remove redundant code.

* subversion/tests/cmdline/copy_tests.py
  (move_wc_and_repo_dir_to_itself, test_list): New test.

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

Modified:
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/tests/cmdline/copy_tests.py

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1051059&r1=1051058&r2=1051059&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Mon Dec 20 10:55:18 2010
@@ -983,10 +983,6 @@ repos_to_repos_copy(const apr_array_head
         }
       else if (strcmp(pair->src_abspath_or_url, top_url) == 0)
         {
-          if (is_move)
-            return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-                                     _("Cannot move URL '%s' into itself"),
-                                     pair->src_abspath_or_url);
           src_rel = "";
           SVN_ERR(svn_ra_check_path(ra_session, src_rel, pair->src_revnum,
                                     &info->src_kind, pool));
@@ -2078,7 +2074,7 @@ try_copy(const apr_array_header_t *sourc
                "supported"));
         }
 
-      /* Disallow moving any path onto or into itself. */
+      /* Disallow moving any path/URL onto or into itself. */
       for (i = 0; i < copy_pairs->nelts; i++)
         {
           svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
@@ -2086,10 +2082,14 @@ try_copy(const apr_array_header_t *sourc
 
           if (strcmp(pair->src_abspath_or_url,
                      pair->dst_abspath_or_url) == 0)
-            return svn_error_createf
-              (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-               _("Cannot move path '%s' into itself"),
-               svn_dirent_local_style(pair->src_abspath_or_url, pool));
+            return svn_error_createf(
+              SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+              srcs_are_urls ?
+                _("Cannot move URL '%s' into itself") :
+                _("Cannot move path '%s' into itself"),
+              srcs_are_urls ?
+                pair->src_abspath_or_url :
+                svn_dirent_local_style(pair->src_abspath_or_url, pool));
         }
     }
   else

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1051059&r1=1051058&r2=1051059&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Mon Dec 20 10:55:18 2010
@@ -4942,6 +4942,21 @@ def copy_wc_over_deleted_other_kind(sbox
                           Item(status='  ', wc_rev='-', copied='+')})
   svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status)
 
+def move_wc_and_repo_dir_to_itself(sbox):
+  "move wc and repo dir to itself"
+  sbox.build(read_only = True)
+  wc_dir = os.path.join(sbox.wc_dir, 'A')
+  repo_url = sbox.repo_url + '/A'
+
+  # try to move wc dir to itself
+  svntest.actions.run_and_verify_svn(None, [],
+                                     '.*Cannot move path.* into itself.*',
+                                     'move', wc_dir, wc_dir)
+
+  # try to move repo dir to itself
+  svntest.actions.run_and_verify_svn(None, [],
+                                     '.*Cannot move URL.* into itself.*',
+                                     'move', repo_url, repo_url)
 
 ########################################################################
 # Run the tests
@@ -5045,6 +5060,7 @@ test_list = [ None,
               copy_repos_over_deleted_other_kind,
               copy_wc_over_deleted_same_kind,
               copy_wc_over_deleted_other_kind,
+              move_wc_and_repo_dir_to_itself,
              ]
 
 if __name__ == '__main__':