[[[
Fix for issue 1797 case two. A non-recursive commit of a deleted
directory fails post-commit.
Patch from <makl@tigris.org>
* subversion/libsvn_client/commit.c
(svn_client_commit): Always lock deleted directories recursive.
(commit_deleted_directory_tree_non_recursive_1): New
regression test for case one. Currently XFail.
(commit_deleted_directory_tree_non_recursive_2_1): New
regression test for case two with one deleted directory.
(commit_deleted_directory_tree_non_recursive_2_1): New
regression test for case two with three independent deleted
directories.
]]]
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c (revision 9145)
+++ subversion/libsvn_client/commit.c (working copy)
@@ -1097,8 +1097,25 @@
/* If the final target is a dir, we want to recursively lock it */
if (kind == svn_node_dir)
{
+
if (nonrecursive)
- APR_ARRAY_PUSH (dirs_to_lock, const char *) = target;
+ {
+ const svn_wc_entry_t *tmp_entry;
+ svn_wc_adm_access_t *tmp_adm_access;
+
+ SVN_ERR (svn_wc_adm_open2 (&tmp_adm_access, NULL, target,
+ FALSE, 0, pool));
+ SVN_ERR (svn_wc_entry (&tmp_entry, target, tmp_adm_access,
+ TRUE, pool));
+ if (!tmp_entry
+ || (tmp_entry->schedule == svn_wc_schedule_delete))
+ APR_ARRAY_PUSH (dirs_to_lock_recursive,
+ const char *) = target;
+ else
+ APR_ARRAY_PUSH (dirs_to_lock, const char *) = target;
+
+ SVN_ERR (svn_wc_adm_close (tmp_adm_access));
+ }
else
APR_ARRAY_PUSH (dirs_to_lock_recursive, const char *) = target;
}
@@ -1141,8 +1158,26 @@
if (kind == svn_node_dir)
{
if (nonrecursive)
- APR_ARRAY_PUSH (dirs_to_lock,
- const char *) = apr_pstrdup (pool, target);
+ {
+ const svn_wc_entry_t *tmp_entry;
+ svn_wc_adm_access_t *tmp_adm_access;
+
+ SVN_ERR (svn_wc_adm_open2 (&tmp_adm_access, NULL, target,
+ FALSE, 0, subpool));
+ SVN_ERR (svn_wc_entry (&tmp_entry, target, tmp_adm_access,
+ TRUE, subpool));
+ if (!tmp_entry
+ || (tmp_entry->schedule == svn_wc_schedule_delete))
+ APR_ARRAY_PUSH (dirs_to_lock_recursive,
+ const char *) = apr_pstrdup (pool,
+ target);
+ else
+ APR_ARRAY_PUSH (dirs_to_lock,
+ const char *) = apr_pstrdup (pool,
+ target);
+
+ SVN_ERR (svn_wc_adm_close (tmp_adm_access));
+ }
else
APR_ARRAY_PUSH (dirs_to_lock_recursive,
const char *) = apr_pstrdup (pool, target);
@@ -1859,6 +1863,113 @@
+#----------------------------------------------------------------------
+# Regression test for issue 1797 case 2 part 1
+# Committing a single deleted directory
+
+def commit_deleted_directory_tree_non_recursive_2_1(sbox):
+ "non-recursively commit a deleted tree case 2-1"
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ dir_path = os.path.join(sbox.wc_dir, 'A')
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'rm', dir_path)
+ # Created expected output tree for 'svn ci'
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A' : Item(verb='Deleting'),
+ })
+
+ # Create expected status tree
+ expected_status = svntest.wc.State(wc_dir, {
+ '' : Item(status=' ', wc_rev=1, repos_rev=2),
+ 'iota' : Item(status=' ', wc_rev=1, repos_rev=2) ,
+ })
+
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, '-N',
+ dir_path)
+
+
+
+#----------------------------------------------------------------------
+# Regression test for issue 1797 case 2 part 2
+# Committing three independent deleted directories
+
+def commit_deleted_directory_tree_non_recursive_2_2(sbox):
+ "non-recursively commit a deleted tree case 2-2"
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ dir_path1 = os.path.join(sbox.wc_dir, 'A/B')
+ dir_path2 = os.path.join(sbox.wc_dir, 'A/C')
+ dir_path3 = os.path.join(sbox.wc_dir, 'A/D')
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'rm', dir_path1, dir_path2, dir_path3)
+ # Created expected output tree for 'svn ci'
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/B' : Item(verb='Deleting'),
+ 'A/C' : Item(verb='Deleting'),
+ 'A/D' : Item(verb='Deleting'),
+ })
+
+ # Create expected status tree
+ expected_status = svntest.wc.State(wc_dir, {
+ '' : Item(status=' ', wc_rev=1, repos_rev=2),
+ 'iota' : Item(status=' ', wc_rev=1, repos_rev=2) ,
+ 'A' : Item(status=' ', wc_rev=1, repos_rev=2) ,
+ 'A/mu' : Item(status=' ', wc_rev=1, repos_rev=2) ,
+ })
+
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, '-N',
+ dir_path1, dir_path2, dir_path3)
+
+
+
+#----------------------------------------------------------------------
+# Regression test for issue 1797 case 1
+# Committing multiple directories in the same directory tree
+
+def commit_deleted_directory_tree_non_recursive_1(sbox):
+ "non-recursively commit a deleted tree case 1"
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ dir_path1 = os.path.join(sbox.wc_dir, 'A')
+ dir_path2 = os.path.join(sbox.wc_dir, 'A/B')
+ dir_path3 = os.path.join(sbox.wc_dir, 'A/C')
+ dir_path4 = os.path.join(sbox.wc_dir, 'A/D')
+ dir_path5 = os.path.join(sbox.wc_dir, 'A/B/E')
+ dir_path6 = os.path.join(sbox.wc_dir, 'A/B/F')
+ dir_path7 = os.path.join(sbox.wc_dir, 'A/D/G')
+ dir_path8 = os.path.join(sbox.wc_dir, 'A/D/H')
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'rm', dir_path1)
+ # Created expected output tree for 'svn ci'
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A' : Item(verb='Deleting'),
+ })
+
+ # Create expected status tree
+ expected_status = svntest.wc.State(wc_dir, {
+ '' : Item(status=' ', wc_rev=1, repos_rev=2),
+ 'iota' : Item(status=' ', wc_rev=1, repos_rev=2) ,
+ })
+
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, '-N',
+ dir_path1, dir_path2, dir_path3,
+ dir_path4, dir_path5, dir_path6,
+ dir_path7, dir_path8)
+
+
########################################################################
# Run the tests
@@ -1896,6 +2007,9 @@
commit_out_of_date_deletions,
commit_with_bad_log_message,
from_wc_top_with_bad_editor,
+ XFail(commit_deleted_directory_tree_non_recursive_1),
+ commit_deleted_directory_tree_non_recursive_2_1,
+ commit_deleted_directory_tree_non_recursive_2_2,
]
if __name__ == '__main__':
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Mar 21 16:41:49 2004