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/31 23:32:27 UTC
svn commit: r1441232 - /subversion/trunk/subversion/libsvn_client/merge.c
Author: rhuijben
Date: Thu Jan 31 22:32:26 2013
New Revision: 1441232
URL: http://svn.apache.org/viewvc?rev=1441232&view=rev
Log:
Following up on r1441186, reinstate the old header per merge-child behavior
for ancestrical merges.
* subversion/libsvn_client/merge.c
(mark_dir_edited,
mark_file_edited): Call notify_merge_begin before producing skip.
(find_nearest_ancestor): Go through the list backwards to allow directly
returning when we have the best match.
(notify_merge_begin): Don't set the notified_merge_begin variable in the
case when we detect different targets based on the mergeinfo children.
Reverse some variables to implement a quick exit without allocating
when we don't have a new start.
Modified:
subversion/trunk/subversion/libsvn_client/merge.c
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1441232&r1=1441231&r2=1441232&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Jan 31 22:32:26 2013
@@ -1750,6 +1750,9 @@ mark_dir_edited(merge_cmd_baton_t *merge
{
svn_wc_notify_t *notify;
+ SVN_ERR(notify_merge_begin(merge_b, local_abspath, FALSE,
+ scratch_pool));
+
notify = svn_wc_create_notify(
local_abspath,
(db->tree_conflict_reason == CONFLICT_REASON_SKIP)
@@ -1798,9 +1801,7 @@ mark_dir_edited(merge_cmd_baton_t *merge
tree conflict on the obstructing op-root.
If only a descendant is moved away, we call the node itself
- deleted.
- */
-
+ deleted. */
db->tree_conflict_reason = svn_wc_conflict_reason_moved_away;
moved_away_abspath = local_abspath;
}
@@ -1856,6 +1857,9 @@ mark_file_edited(merge_cmd_baton_t *merg
{
svn_wc_notify_t *notify;
+ SVN_ERR(notify_merge_begin(merge_b, local_abspath, FALSE,
+ scratch_pool));
+
notify = svn_wc_create_notify(local_abspath, svn_wc_notify_skip,
scratch_pool);
notify->kind = svn_node_file;
@@ -1890,9 +1894,7 @@ mark_file_edited(merge_cmd_baton_t *merg
tree conflict on the obstructing op-root.
If only a descendant is moved away, we call the node itself
- deleted.
- */
-
+ deleted. */
fb->tree_conflict_reason = svn_wc_conflict_reason_moved_away;
moved_away_abspath = local_abspath;
}
@@ -3266,16 +3268,17 @@ find_nearest_ancestor(const apr_array_he
SVN_ERR_ASSERT_NO_RETURN(children_with_mergeinfo != NULL);
- for (i = 0; i < children_with_mergeinfo->nelts; i++)
+ for (i = children_with_mergeinfo->nelts - 1; i >= 0 ; i--)
{
svn_client__merge_path_t *child =
APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *);
+
if (svn_dirent_is_ancestor(child->abspath, local_abspath)
&& (path_is_own_ancestor
|| strcmp(child->abspath, local_abspath) != 0))
- ancestor = child;
+ return child;
}
- return ancestor;
+ return NULL;
}
/* Notify that we're starting to record mergeinfo for the merge of the
@@ -3332,9 +3335,7 @@ notify_merge_completed(const char *targe
|| notify->action == svn_wc_notify_tree_conflict)
-/* Notify that we're starting to record the merge of the
- * revision range RANGE into TARGET_ABSPATH. RANGE should be null if the
- * merge sources are not from the same URL.
+/* Notify that we're starting a merge
*
* This calls the client's notification receiver (as found in the client
* context), with a WC abspath.
@@ -3346,20 +3347,14 @@ notify_merge_begin(merge_cmd_baton_t *me
apr_pool_t *scratch_pool)
{
svn_wc_notify_t *notify;
+ svn_merge_range_t *n_range = NULL;
+ const char *notify_abspath;
- if (merge_b->notified_merge_begin)
+ if (merge_b->notified_merge_begin
+ || ! merge_b->ctx->notify_func2)
return SVN_NO_ERROR;
- merge_b->notified_merge_begin = TRUE;
-
- if (! merge_b->ctx->notify_func2)
- return SVN_NO_ERROR;
-
- notify = svn_wc_create_notify(merge_b->target->abspath,
- merge_b->same_repos
- ? svn_wc_notify_merge_begin
- : svn_wc_notify_foreign_merge_begin,
- scratch_pool);
+ notify_abspath = merge_b->target->abspath;
/* If our merge sources are ancestors of one another... */
/* single file merge updates current_range */
@@ -3387,23 +3382,38 @@ notify_merge_begin(merge_cmd_baton_t *me
! delete_action,
local_abspath);
- if (merge_b->cur_ancestor_abspath == NULL
- || strcmp(child->abspath, merge_b->cur_ancestor_abspath) != 0)
+ if (merge_b->cur_ancestor_abspath != NULL
+ && strcmp(child->abspath, merge_b->cur_ancestor_abspath))
{
- merge_b->cur_ancestor_abspath = child->abspath;
- if (!child->absent && child->remaining_ranges->nelts > 0)
- {
- notify->path = child->abspath;
- notify->merge_range = svn_merge_range_dup(
- APR_ARRAY_IDX(child->remaining_ranges,
- 0, svn_merge_range_t *),
- scratch_pool);
- }
+ /* Don't notify the same merge again */
+ return SVN_NO_ERROR;
+ }
+
+ merge_b->cur_ancestor_abspath = child->abspath;
+
+ if (child->absent || child->remaining_ranges->nelts == 0)
+ {
+ /* No valid information for an header */
+ return SVN_NO_ERROR;
}
+
+ notify_abspath = child->abspath;
+ n_range = APR_ARRAY_IDX(child->remaining_ranges, 0, svn_merge_range_t *);
}
- else if (merge_b->current_range && merge_b->merge_source.ancestral)
- notify->merge_range = svn_merge_range_dup(merge_b->current_range,
- scratch_pool);
+ else if (merge_b->merge_source.ancestral)
+ {
+ merge_b->notified_merge_begin = TRUE;
+
+ if (merge_b->current_range)
+ n_range = svn_merge_range_dup(merge_b->current_range, scratch_pool);
+ }
+
+ notify = svn_wc_create_notify(notify_abspath,
+ merge_b->same_repos
+ ? svn_wc_notify_merge_begin
+ : svn_wc_notify_foreign_merge_begin,
+ scratch_pool);
+ notify->merge_range = n_range;
(*merge_b->ctx->notify_func2)(merge_b->ctx->notify_baton2, notify,
scratch_pool);