subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1772053 - in /subversion/trunk/subversion: libsvn_wc/wc_db_update_move.c tests/libsvn_client/conflicts-test.c
Date Wed, 30 Nov 2016 15:30:02 GMT
Author: stsp
Date: Wed Nov 30 15:30:02 2016
New Revision: 1772053

URL: http://svn.apache.org/viewvc?rev=1772053&view=rev
Log:
Second attempt to preserve local changes for files which become victims of
a nested incoming move during an update (same problem as in r1771924).

This time, we make sure the file is copied to the move destination before
the move source is deleted. The file becomes the victim of a new tree conflict
at the move destination, which the resolver could resolve later on.
Information about the file's original location is preserved in conflict data.

* subversion/libsvn_wc/wc_db_update_move.c
  (tc_editor_update_incoming_moved_file): If the file cannot be found at the
   move destination, copy it there and raise a new tree conflict.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_update_incoming_dir_move_with_nested_file_move): Update test
   expectations accordingly. And verify that expected file content is present.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
    subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1772053&r1=1772052&r2=1772053&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Wed Nov 30 15:30:02 2016
@@ -1461,14 +1461,27 @@ tc_editor_update_incoming_moved_file(nod
     {
       const char *dst_parent_relpath;
       const char *dst_parent_repos_relpath;
+      const char *src_abspath;
+
+      /* If the file cannot be found, it was either deleted at the
+       * move destination, or it was moved after its parent was moved.
+       * We cannot deal with this problem right now. Instead, we will
+       * raise a new tree conflict at the location where this file should
+       * have been, and let another run of the resolver deal with the
+       * new conflict later on. */
 
       svn_error_clear(err);
 
+      /* Create a WORKING node for this file at the move destination. */
+      SVN_ERR(copy_working_node(src_relpath, dst_relpath, b->wcroot,
+                                scratch_pool));
+
+      /* Raise a tree conflict at the new WORKING node. */
       dst_db_kind = svn_node_none;
       SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
                                         svn_node_file, dst_db_kind,
-                                        svn_wc_conflict_reason_missing,
-                                        svn_wc_conflict_action_edit,
+                                        svn_wc_conflict_reason_edited,
+                                        svn_wc_conflict_action_delete,
                                         NULL, scratch_pool, scratch_pool));
       dst_parent_relpath = svn_relpath_dirname(dst_relpath, scratch_pool);
       SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
@@ -1483,6 +1496,17 @@ tc_editor_update_incoming_moved_file(nod
                                                                 scratch_pool),
                                            scratch_pool);
       tree_conflict = TRUE;
+
+      /* Schedule a copy of the victim's file content to the new node's path. */
+      src_abspath = svn_dirent_join(b->wcroot->abspath, src_relpath,
+                                    scratch_pool);
+      SVN_ERR(svn_wc__wq_build_file_install(&work_item, b->db,
+                                            dst_abspath,
+                                            src_abspath,
+                                            FALSE /*FIXME: use_commit_times?*/,
+                                            TRUE  /* record_file_info */,
+                                            scratch_pool, scratch_pool));
+      work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
     }
   else
     SVN_ERR(err);

Modified: subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c?rev=1772053&r1=1772052&r2=1772053&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Wed Nov 30 15:30:02 2016
@@ -3208,6 +3208,7 @@ test_update_incoming_dir_move_with_neste
   svn_boolean_t text_conflicted;
   apr_array_header_t *props_conflicted;
   svn_boolean_t tree_conflicted;
+  svn_stringbuf_t *buf;
 
   SVN_ERR(svn_test__sandbox_create(
             b, "update_incoming_dir_move_with_moved_file", opts, pool));
@@ -3290,9 +3291,13 @@ test_update_incoming_dir_move_with_neste
   SVN_TEST_INT_ASSERT(props_conflicted->nelts, 0);
   SVN_TEST_ASSERT(tree_conflicted);
   SVN_TEST_ASSERT(svn_client_conflict_get_local_change(conflict) ==
-                  svn_wc_conflict_reason_missing);
+                  svn_wc_conflict_reason_edited);
   SVN_TEST_ASSERT(svn_client_conflict_get_incoming_change(conflict) ==
-                  svn_wc_conflict_action_edit);
+                  svn_wc_conflict_action_delete);
+
+  /* Make sure the file has the expected content. */
+  SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, deleted_file), pool));
+  SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
 
   return SVN_NO_ERROR;
 }



Mime
View raw message