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/01/15 13:20:29 UTC
svn commit: r1433372 - in /subversion/trunk/subversion:
libsvn_wc/update_editor.c tests/cmdline/update_tests.py
Author: rhuijben
Date: Tue Jan 15 12:20:28 2013
New Revision: 1433372
URL: http://svn.apache.org/viewvc?rev=1433372&view=rev
Log:
Properly detect whether the anchor of an update is shadowed to avoid applying
local changes to an unrelated node.
* subversion/libsvn_wc/update_editor.c
(open_root): Use a read_info() call instead of directly reading base to
detect shadowing of the anchor. Add TODO comment.
* subversion/tests/cmdline/update_tests.py
(update_deleted): New test. Triggering a failure on updating before
this patch.
(test_list): Add test.
Found by: philip
me
(Philip found the testcase where we used the wrong data)
Modified:
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/tests/cmdline/update_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1433372&r1=1433371&r2=1433372&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Jan 15 12:20:28 2013
@@ -1175,6 +1175,8 @@ open_root(void *edit_baton,
svn_boolean_t already_conflicted;
svn_error_t *err;
svn_wc__db_status_t status;
+ svn_kind_t kind;
+ svn_boolean_t have_work;
/* Note that something interesting is actually happening in this
edit run. */
@@ -1207,19 +1209,48 @@ open_root(void *edit_baton,
return SVN_NO_ERROR;
}
+
+ SVN_ERR(svn_wc__db_read_info(&status, &kind, &db->old_revision,
+ &db->old_repos_relpath, NULL, NULL,
+ &db->changed_rev, &db->changed_date,
+ &db->changed_author, &db->ambient_depth,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &have_work,
+ eb->db, db->local_abspath,
+ db->pool, pool));
+
+ if (have_work)
+ db->shadowed = TRUE; /* Needed for the close_directory() on the root, to
+ make sure it doesn't use the ACTUAL tree */
+
if (*eb->target_basename == '\0')
{
+ svn_wc__db_status_t base_status;
/* For an update with a NULL target, this is equivalent to open_dir(): */
- /* Read the depth from the entry. */
- SVN_ERR(svn_wc__db_base_get_info(&status, NULL, &db->old_revision,
- &db->old_repos_relpath, NULL, NULL,
- &db->changed_rev, &db->changed_date,
- &db->changed_author, &db->ambient_depth,
- NULL, NULL, NULL, NULL, NULL, NULL,
- eb->db, db->local_abspath,
- db->pool, pool));
- db->was_incomplete = (status == svn_wc__db_status_incomplete);
+ if (! have_work)
+ base_status = status;
+ else
+ {
+ SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, &db->old_revision,
+ &db->old_repos_relpath, NULL, NULL,
+ &db->changed_rev, &db->changed_date,
+ &db->changed_author, &db->ambient_depth,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ eb->db, db->local_abspath,
+ db->pool, pool));
+ }
+ db->was_incomplete = (base_status == svn_wc__db_status_incomplete);
+
+ /* ### TODO: Add some tree conflict and obstruction detection, etc. like
+ open_directory() does.
+ (or find a way to reuse that code here)
+
+ ### BH 2013: I don't think we need all of the detection here, as the
+ user explicitly asked to update this node. So we don't
+ have to tell that it is a local replacement/delete.
+ */
SVN_ERR(svn_wc__db_temp_op_start_directory_update(eb->db,
db->local_abspath,
Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1433372&r1=1433371&r2=1433372&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Tue Jan 15 12:20:28 2013
@@ -5954,6 +5954,29 @@ def update_edit_delete_obstruction(sbox)
None, None, 1,
'-r', '3', wc_dir)
+def update_deleted(sbox):
+ "update a deleted tree"
+
+ sbox.build(read_only = True)
+ wc_dir = sbox.wc_dir
+ sbox.simple_rm('A')
+
+ expected_output = svntest.wc.State(wc_dir, {
+ })
+
+ expected_status = svntest.wc.State(wc_dir, {
+ })
+
+ # This runs an update anchored on A, which is deleted. The update editor
+ # shouldn't look at the ACTUAL/WORKING data in this case, but in 1.7 it did.
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ None,
+ None,
+ None, None, None,
+ None, None, 1,
+ sbox.ospath('A/B'))
+
#######################################################################
# Run the tests
@@ -6030,6 +6053,7 @@ test_list = [ None,
update_nested_move_text_mod,
update_with_parents_and_exclude,
update_edit_delete_obstruction,
+ update_deleted,
]
if __name__ == '__main__':