You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/20 20:41:24 UTC
svn commit: r1448366 - in /subversion/trunk/subversion: libsvn_wc/delete.c
tests/cmdline/input_validation_tests.py
Author: rhuijben
Date: Wed Feb 20 19:41:24 2013
New Revision: 1448366
URL: http://svn.apache.org/r1448366
Log:
Add an early warning on scheduling a delete of the repository root in working
copies. (Some wc-db queries assume that the repository root is not moved,
so this makes it less likely for these invalid cases don't enter the database)
* subversion/libsvn_wc/delete.c
(svn_wc__delete_many,
svn_wc__delete_internal): Don't allow deleting paths that are switched to
the repository root.
* subversion/tests/cmdline/input_validation_tests.py
(delete_repos_root): Remove XFail marker and allow some output before the error.
Modified:
subversion/trunk/subversion/libsvn_wc/delete.c
subversion/trunk/subversion/tests/cmdline/input_validation_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/delete.c?rev=1448366&r1=1448365&r2=1448366&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/delete.c (original)
+++ subversion/trunk/subversion/libsvn_wc/delete.c Wed Feb 20 19:41:24 2013
@@ -198,13 +198,15 @@ svn_wc__delete_many(svn_wc_context_t *wc
for (i = 0; i < targets->nelts; i++)
{
svn_boolean_t conflicted = FALSE;
+ const char *repos_relpath;
svn_pool_clear(iterpool);
local_abspath = APR_ARRAY_IDX(targets, i, const char *);
- err = svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, &conflicted,
+ err = svn_wc__db_read_info(&status, &kind, NULL, &repos_relpath, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, &conflicted,
NULL, NULL, NULL, NULL, NULL, NULL,
db, local_abspath, iterpool, iterpool);
@@ -255,6 +257,12 @@ svn_wc__delete_many(svn_wc_context_t *wc
svn_dirent_local_style(local_abspath,
iterpool));
}
+ if (!repos_relpath[0])
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("'%s' represents the repository root "
+ "and cannot be deleted"),
+ svn_dirent_local_style(local_abspath,
+ iterpool));
/* Verify if we have a write lock on the parent of this node as we might
be changing the childlist of that directory. */
@@ -319,10 +327,11 @@ svn_wc__delete_internal(svn_wc_context_t
svn_kind_t kind;
svn_boolean_t conflicted;
svn_skel_t *work_items = NULL;
+ const char *repos_relpath;
- err = svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
+ err = svn_wc__db_read_info(&status, &kind, NULL, &repos_relpath, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, &conflicted,
+ NULL, NULL, NULL, NULL, NULL, NULL, &conflicted,
NULL, NULL, NULL, NULL, NULL, NULL,
db, local_abspath, pool, pool);
@@ -366,6 +375,11 @@ svn_wc__delete_internal(svn_wc_context_t
"cannot be deleted"),
svn_dirent_local_style(local_abspath, pool));
}
+ if (!repos_relpath[0])
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("'%s' represents the repository root "
+ "and cannot be deleted"),
+ svn_dirent_local_style(local_abspath, pool));
/* Verify if we have a write lock on the parent of this node as we might
be changing the childlist of that directory. */
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=1448366&r1=1448365&r2=1448366&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/input_validation_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/input_validation_tests.py Wed Feb 20 19:41:24 2013
@@ -252,7 +252,6 @@ def invalid_update_targets(sbox):
run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'update',
"^/")
-@XFail()
def delete_repos_root(sbox):
"do stupid things with the repository root"
@@ -285,7 +284,7 @@ def delete_repos_root(sbox):
# This should produce some error, because we can never commit this
expected_error = '.*repository root.*'
- svntest.actions.run_and_verify_svn('Move root', [], expected_error,
+ svntest.actions.run_and_verify_svn('Move root', None, expected_error,
'mv', sbox.ospath('A/D/G'),
sbox.ospath('Z'))