You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/06/13 12:02:59 UTC
svn commit: r1748187 - /subversion/trunk/subversion/libsvn_wc/conflicts.c
Author: stsp
Date: Mon Jun 13 12:02:59 2016
New Revision: 1748187
URL: http://svn.apache.org/viewvc?rev=1748187&view=rev
Log:
* subversion/libsvn_wc/conflicts.c
(svn_wc__guess_incoming_move_target_node): Prefer candidates with a shorter
path-wise distance to the conflict victim. This helps in cases where both
the merge source and target branches are part of the same working copy.
Without taking path-wise distance into account, we could easily end up
modifying a file which is on the merge source branch, while we're looking
for a file which is part of the target branch.
Modified:
subversion/trunk/subversion/libsvn_wc/conflicts.c
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1748187&r1=1748186&r2=1748187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Mon Jun 13 12:02:59 2016
@@ -3697,6 +3697,7 @@ svn_wc__guess_incoming_move_target_node(
apr_array_header_t *candidates;
apr_pool_t *iterpool;
int i;
+ apr_size_t longest_ancestor_len = 0;
*moved_to_abspath = NULL;
SVN_ERR(svn_wc__find_repos_node_in_wc(&candidates, wc_ctx->db, victim_abspath,
@@ -3710,11 +3711,15 @@ svn_wc__guess_incoming_move_target_node(
* cannot be modified (e.g. replaced or deleted nodes) don't count.
* Ignore switched nodes as well, since that is an unlikely case during
* update/swtich/merge conflict resolution. And externals shouldn't even
- * be on our candidate list in the first place. */
+ * be on our candidate list in the first place.
+ * If multiple candidates match these criteria, choose the one which
+ * shares the longest common ancestor with the victim. */
iterpool = svn_pool_create(scratch_pool);
for (i = 0; i < candidates->nelts; i++)
{
const char *local_abspath;
+ const char *ancestor_abspath;
+ apr_size_t ancestor_len;
svn_boolean_t tree_conflicted;
svn_wc__db_status_t status;
svn_boolean_t is_wcroot;
@@ -3746,9 +3751,17 @@ svn_wc__guess_incoming_move_target_node(
if (is_wcroot || is_switched)
continue;
- /* This might be a move target. Fingers crossed ;-) */
- *moved_to_abspath = apr_pstrdup(result_pool, local_abspath);
- break;
+ ancestor_abspath = svn_dirent_get_longest_ancestor(local_abspath,
+ victim_abspath,
+ iterpool);
+ ancestor_len = strlen(ancestor_abspath);
+ if (ancestor_len > longest_ancestor_len)
+ {
+ longest_ancestor_len = ancestor_len;
+
+ /* This might be a move target. Fingers crossed ;-) */
+ *moved_to_abspath = apr_pstrdup(result_pool, local_abspath);
+ }
}
svn_pool_destroy(iterpool);