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 2017/02/06 10:13:17 UTC
svn commit: r1781862 - /subversion/trunk/subversion/libsvn_client/conflicts.c
Author: stsp
Date: Mon Feb 6 10:13:17 2017
New Revision: 1781862
URL: http://svn.apache.org/viewvc?rev=1781862&view=rev
Log:
Introduce another helper function in the conflict resolver.
* subversion/libsvn_client/conflicts.c
(select_default_move_target_abspath): New helper function which selects
a default move target path from the set of candidates in the working copy.
(configure_option_incoming_move_file_merge,
configure_option_incoming_dir_merge): Use the new helper function instead
of inlining its implementation.
Modified:
subversion/trunk/subversion/libsvn_client/conflicts.c
Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1781862&r1=1781861&r2=1781862&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Mon Feb 6 10:13:17 2017
@@ -2670,6 +2670,25 @@ get_moved_to_repos_relpath(
return move->moved_to_repos_relpath;
}
+/* Return a default working copy move target path. */
+static const char *
+select_default_move_target_abspath(
+ struct conflict_tree_incoming_delete_details *details,
+ apr_pool_t *scratch_pool)
+{
+ apr_array_header_t *repos_relpaths;
+ svn_sort__item_t item;
+
+ if (apr_hash_count(details->wc_move_targets) == 0)
+ return NULL;
+
+ repos_relpaths = svn_sort__hash(details->wc_move_targets,
+ svn_sort_compare_items_as_paths,
+ scratch_pool);
+ item = APR_ARRAY_IDX(repos_relpaths, 0, svn_sort__item_t);
+ return (const char *)item.key;
+}
+
static const char *
describe_incoming_deletion_upon_update(
struct conflict_tree_incoming_delete_details *details,
@@ -9122,7 +9141,6 @@ configure_option_incoming_move_file_merg
incoming_change == svn_wc_conflict_action_delete)
{
const char *victim_abspath;
- apr_array_header_t *move_target_repos_relpaths;
const char *description;
victim_abspath = svn_client_conflict_get_local_abspath(conflict);
@@ -9142,27 +9160,12 @@ configure_option_incoming_move_file_merg
incoming_new_pegrev,
conflict->pool, scratch_pool));
}
- if (apr_hash_count(details->wc_move_targets) > 0)
- {
- svn_sort__item_t item;
- /* Initialize to the first possible move target. Hopefully,
- * in most cases there will only be one candidate anyway. */
- move_target_repos_relpaths =
- svn_sort__hash(details->wc_move_targets,
- svn_sort_compare_items_as_paths,
- scratch_pool);
- item = APR_ARRAY_IDX(move_target_repos_relpaths, 0,
- svn_sort__item_t);
- details->move_target_repos_relpath = item.key;
- details->wc_move_target_idx = 0;
- }
- else
- {
- details->move_target_repos_relpath = NULL;
- details->wc_move_target_idx = 0;
- return SVN_NO_ERROR;
- }
+ /* Initialize to the first possible move target. Hopefully,
+ * in most cases there will only be one candidate anyway. */
+ details->move_target_repos_relpath =
+ select_default_move_target_abspath(details, scratch_pool);
+ details->wc_move_target_idx = 0;
}
if (apr_hash_count(details->wc_move_targets) == 0)
@@ -9226,7 +9229,6 @@ configure_option_incoming_dir_merge(svn_
const char *description;
const char *wcroot_abspath;
const char *victim_abspath;
- apr_array_header_t *move_target_repos_relpaths;
victim_abspath = svn_client_conflict_get_local_abspath(conflict);
SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, ctx->wc_ctx,
@@ -9249,27 +9251,12 @@ configure_option_incoming_dir_merge(svn_
incoming_new_pegrev,
conflict->pool, scratch_pool));
}
- if (apr_hash_count(details->wc_move_targets) > 0)
- {
- svn_sort__item_t item;
- /* Initialize to the first possible move target. Hopefully,
- * in most cases there will only be one candidate anyway. */
- move_target_repos_relpaths =
- svn_sort__hash(details->wc_move_targets,
- svn_sort_compare_items_as_paths,
- scratch_pool);
- item = APR_ARRAY_IDX(move_target_repos_relpaths, 0,
- svn_sort__item_t);
- details->move_target_repos_relpath = item.key;
- details->wc_move_target_idx = 0;
- }
- else
- {
- details->move_target_repos_relpath = NULL;
- details->wc_move_target_idx = 0;
- return SVN_NO_ERROR;
- }
+ /* Initialize to the first possible move target. Hopefully,
+ * in most cases there will only be one candidate anyway. */
+ details->move_target_repos_relpath =
+ select_default_move_target_abspath(details, scratch_pool);
+ details->wc_move_target_idx = 0;
}
if (apr_hash_count(details->wc_move_targets) == 0)