Julian Foad <[email protected]> writes:
>
> * "svn mv ^/ ^/" -> "Cannot move path
> 'https:/svn.apache.org/repos/asf' into itself"; should not print the URL
> as if it's a local path.
>
Attached is the patch which improves error message displayed.
Log
[[[
Make 'svn move' display correct error message while moving any
path/URL onto or into itself. 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>
]]]
Thanks and Regards
Noorul
Index: subversion/tests/cmdline/copy_tests.py
===================================================================
--- subversion/tests/cmdline/copy_tests.py (revision 1045067)
+++ subversion/tests/cmdline/copy_tests.py (working copy)
@@ -4942,7 +4942,22 @@
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 @@
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__':
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (revision 1045067)
+++ subversion/libsvn_client/copy.c (working copy)
@@ -983,10 +983,6 @@
}
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));
@@ -2077,7 +2073,7 @@
"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,
@@ -2085,10 +2081,14 @@
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