Author: philip
Date: Thu May 26 10:58:22 2011
New Revision: 1127864
URL: http://svn.apache.org/viewvc?rev=1127864&view=rev
Log:
Fix issue 3900, wc delete of presence=absent nodes
* subversion/libsvn_wc/wc_db.c
(op_delete_txn): Check for absent nodes.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_delete4): No need to check for absent node.
* subversion/tests/cmdline/authz_tests.py
(wc_delete): New test.
(test_list): Add new test.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/cmdline/authz_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1127864&r1=1127863&r2=1127864&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu May 26 10:58:22 2011
@@ -632,9 +632,7 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
switch (status)
{
- /* ### Move this check into svn_wc__db_op_delete so that we
- check the whole tree? */
- case svn_wc__db_status_absent:
+ /* svn_wc__db_status_absent handled by svn_wc__db_op_delete */
case svn_wc__db_status_excluded:
case svn_wc__db_status_not_present:
return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1127864&r1=1127863&r2=1127864&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu May 26 10:58:22 2011
@@ -6057,7 +6057,7 @@ op_delete_txn(void *baton,
{
struct op_delete_baton_t *b = baton;
svn_wc__db_status_t status;
- svn_boolean_t op_root;
+ svn_boolean_t have_row, op_root;
svn_boolean_t add_work = FALSE;
svn_sqlite__stmt_t *stmt;
const char *like_arg;
@@ -6078,6 +6078,28 @@ op_delete_txn(void *baton,
|| status == svn_wc__db_status_not_present)
return SVN_NO_ERROR;
+ like_arg = construct_like_arg(local_relpath, scratch_pool);
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_ABSENT_NODES));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ wcroot->wc_id, local_relpath, like_arg));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row)
+ {
+ const char *absent_path
+ = svn_dirent_local_style(svn_sqlite__column_text(stmt, 0,
scratch_pool),
+ scratch_pool);
+
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
+ svn_sqlite__reset(stmt),
+ _("Cannot delete '%s' as '%s'is excluded by
server"),
+ svn_dirent_local_style(local_relpath,
+ scratch_pool),
+ absent_path);
+ }
+ SVN_ERR(svn_sqlite__reset(stmt));
+
if (op_root)
{
svn_boolean_t below_base;
@@ -6104,8 +6126,6 @@ op_delete_txn(void *baton,
SVN_ERR(op_depth_of(&select_depth, wcroot, local_relpath));
}
- like_arg = construct_like_arg(local_relpath, scratch_pool);
-
/* ### Put actual-only nodes into the list? */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_DELETE_LIST));
Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=1127864&r1=1127863&r2=1127864&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Thu May 26
10:58:22 2011
@@ -1206,6 +1206,38 @@ def authz_tree_conflict(sbox):
None, None, None, None, 0,
'-r', '1', wc_dir)
+@Issue(3900)
+@Skip(svntest.main.is_ra_type_file)
+def wc_delete(sbox):
+ "wc delete with absent nodes"
+
+ sbox.build(create_wc = False)
+ local_dir = sbox.wc_dir
+ write_restrictive_svnserve_conf(sbox.repo_dir)
+
+ write_authz_file(sbox, {'/' : '* = r',
+ '/A/B/E' : '* =', })
+
+ expected_output = svntest.main.greek_state.copy()
+ expected_output.wc_dir = local_dir
+ expected_output.tweak(status='A ', contents=None)
+ expected_output.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
+ expected_wc = svntest.main.greek_state.copy()
+ expected_wc.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
+
+ svntest.actions.run_and_verify_checkout(sbox.repo_url, local_dir,
+ expected_output,
+ expected_wc)
+
+ expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
+
+ expected_err = ".*svn: E155035: .*excluded by server*"
+ svntest.actions.run_and_verify_svn(None, None, expected_err,
+ 'rm', sbox.ospath('A/B/E'))
+ svntest.actions.run_and_verify_svn(None, None, expected_err,
+ 'rm', sbox.ospath('A'))
+
+ expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
########################################################################
@@ -1234,6 +1266,7 @@ test_list = [ None,
authz_recursive_ls,
case_sensitive_authz,
authz_tree_conflict,
+ wc_delete,
]
serial_only = True