Author: kotkov Date: Tue Oct 11 15:47:07 2016 New Revision: 1764273 URL: http://svn.apache.org/viewvc?rev=1764273&view=rev Log: Fix tracing of the chained incoming moves in the tree conflict resolver.
We only need to take the last-changed revision of the deleted node into account while mapping a delete+copy pair to a move, instead of also doing this when chaining moves. * subversion/libsvn_client/conflicts.c (check_move_ancestry): Accept new argument that makes the last-changed revision check conditional. (find_moves_in_revision): Update the calling sites of check_move_ancestry(). Check the last-changed revision when resolving moves within a single revision, and don't do that when gluing moves that happened in different revisions. * subversion/tests/libsvn_client/conflicts-test.c (test_funcs): The test_merge_incoming_chained_move_local_edit() test now passes. Modified: subversion/trunk/subversion/libsvn_client/conflicts.c subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Modified: subversion/trunk/subversion/libsvn_client/conflicts.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1764273&r1=1764272&r2=1764273&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/conflicts.c (original) +++ subversion/trunk/subversion/libsvn_client/conflicts.c Tue Oct 11 15:47:07 2016 @@ -274,9 +274,10 @@ struct repos_move_info { }; /* Set *RELATED to true if the deleted node DELETED_REPOS_RELPATH@DELETED_REV - * is an ancestor of the copied node COPYFROM_PATH@COPYFROM_REV, and if the - * copied node is a copy of the deleted node's last-changed revision's content, - * rather than a copy of some older content. */ + * is an ancestor of the copied node COPYFROM_PATH@COPYFROM_REV. + * If CHECK_LAST_CHANGED_REV is non-zero, also ensure that the copied node + * is a copy of the deleted node's last-changed revision's content, rather + * than a copy of some older content. If it's not, set *RELATED to false. */ static svn_error_t * check_move_ancestry(svn_boolean_t *related, const char *repos_root_url, @@ -284,6 +285,7 @@ check_move_ancestry(svn_boolean_t *relat svn_revnum_t deleted_rev, const char *copyfrom_path, svn_revnum_t copyfrom_rev, + svn_boolean_t check_last_changed_rev, svn_client_ctx_t *ctx, apr_pool_t *scratch_pool) { @@ -293,7 +295,6 @@ check_move_ancestry(svn_boolean_t *relat svn_ra_session_t *ra_session; const char *corrected_url; apr_array_header_t *location_revisions; - svn_dirent_t *dirent; location_revisions = apr_array_make(scratch_pool, 1, sizeof(svn_revnum_t)); APR_ARRAY_PUSH(location_revisions, svn_revnum_t) = copyfrom_rev; @@ -329,13 +330,20 @@ check_move_ancestry(svn_boolean_t *relat return SVN_NO_ERROR; } - /* Verify that copyfrom_rev >= last-changed revision of the deleted node. */ - SVN_ERR(svn_ra_stat(ra_session, "", deleted_rev - 1, &dirent, scratch_pool)); - if (dirent == NULL || copyfrom_rev < dirent->created_rev) - { - *related = FALSE; - return SVN_NO_ERROR; - } + if (check_last_changed_rev) + { + svn_dirent_t *dirent; + + /* Verify that copyfrom_rev >= last-changed revision of the + * deleted node. */ + SVN_ERR(svn_ra_stat(ra_session, "", deleted_rev - 1, &dirent, + scratch_pool)); + if (dirent == NULL || copyfrom_rev < dirent->created_rev) + { + *related = FALSE; + return SVN_NO_ERROR; + } + } *related = TRUE; return SVN_NO_ERROR; @@ -403,7 +411,7 @@ find_moves_in_revision(apr_hash_t *moves log_entry->revision, copy->copyfrom_path, copy->copyfrom_rev, - ctx, iterpool)); + TRUE, ctx, iterpool)); if (!related) continue; @@ -432,7 +440,7 @@ find_moves_in_revision(apr_hash_t *moves next_move->rev, move->moved_from_repos_relpath, move->copyfrom_rev, - ctx, iterpool)); + FALSE, ctx, iterpool)); if (related) { SVN_ERR_ASSERT(move->rev < next_move->rev); 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=1764273&r1=1764272&r2=1764273&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Tue Oct 11 15:47:07 2016 @@ -3604,8 +3604,8 @@ static struct svn_test_descriptor_t test "merge incoming move file merge with text conflict"), SVN_TEST_OPTS_XFAIL(test_merge_incoming_edit_file_moved_away, "merge incoming edit for a moved-away working file"), - SVN_TEST_OPTS_XFAIL(test_merge_incoming_chained_move_local_edit, - "merge incoming chained move vs local edit"), + SVN_TEST_OPTS_PASS(test_merge_incoming_chained_move_local_edit, + "merge incoming chained move vs local edit"), SVN_TEST_OPTS_XFAIL(test_merge_incoming_move_dir_with_moved_file, "merge incoming moved dir with moved file"), SVN_TEST_OPTS_PASS(test_merge_incoming_file_move_new_line_of_history,