Author: rinrab
Date: Wed Nov 27 14:09:31 2024
New Revision: 1922163
URL: http://svn.apache.org/viewvc?rev=1922163&view=rev
Log:
On the 'apply-processor' branch: Add cb_table->adjust_merge_source() callback
whose implementations may adjust the source for tree conflict.
* subversion/libsvn_client/client.h
(svn_client__apply_processor_callbacks_t): Add adjust_merge_source method.
* subversion/libsvn_client/merge.c
(apply_processor_adjust_merge_source): Implement function.
(do_merge): Initialize cb_table.adjust_merge_source with a pointer to the
apply_processor_adjust_merge_source function.
* subversion/libsvn_client/merge_processor.c
(record_tree_conflict): Move code disabled by TODO_FILTER_MERGEINFO to
merge.c::apply_processor_adjust_merge_source(), but call it instead, do
a little rearrangement of the local variables, invoke
make_conflict_versions()
once, but use the adjusted source.
Modified:
subversion/branches/apply-processor/subversion/libsvn_client/client.h
subversion/branches/apply-processor/subversion/libsvn_client/merge.c
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
Modified: subversion/branches/apply-processor/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_client/client.h?rev=1922163&r1=1922162&r2=1922163&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/client.h
(original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/client.h Wed
Nov 27 14:09:31 2024
@@ -1293,6 +1293,13 @@ typedef struct svn_client__apply_process
const char *local_abspath,
apr_pool_t *scratch_pool,
apr_pool_t *result_pool);
+
+ svn_error_t *(*adjust_merge_source)(void *baton,
+ svn_client__merge_source_t **source_p,
+ const char *local_abspath,
+ svn_wc_conflict_action_t action,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool);
} svn_client__apply_processor_callbacks_t;
/* Return a diff processor that will apply the merge to the WC.
Modified: subversion/branches/apply-processor/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_client/merge.c?rev=1922163&r1=1922162&r2=1922163&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/merge.c
(original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/merge.c Wed
Nov 27 14:09:31 2024
@@ -7365,6 +7365,50 @@ apply_processor_adjust_mergeinfo(void *b
return SVN_NO_ERROR;
}
+/* Implements svn_client__apply_processor_callbacks_t::adjust_merge_source */
+static svn_error_t *
+apply_processor_adjust_merge_source(void *baton,
+ svn_client__merge_source_t **source_p,
+ const char *local_abspath,
+ svn_wc_conflict_action_t action,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
+{
+ merge_cmd_baton_t *merge_b = baton;
+ svn_client__merge_source_t *source = *source_p;
+
+ if (HONOR_MERGEINFO(merge_b) && source->ancestral)
+ {
+ svn_client__pathrev_t *loc1;
+ svn_client__pathrev_t *loc2;
+ svn_revnum_t start_rev;
+ svn_revnum_t end_rev;
+
+ /* We are honoring mergeinfo so do not blindly record
+ * a conflict describing the merge of
+ * SOURCE->LOC1->URL@SOURCE->LOC1->REV through
+ * SOURCE->LOC2->URL@SOURCE->LOC2->REV
+ * but figure out the actual revision range merged. */
+ (void)find_nearest_ancestor_with_intersecting_ranges(
+ &start_rev, &end_rev,
+ merge_b->children_with_mergeinfo,
+ action != svn_wc_conflict_action_delete,
+ local_abspath);
+
+ loc1 = svn_client__pathrev_dup(source->loc1, scratch_pool);
+ loc2 = svn_client__pathrev_dup(source->loc2, scratch_pool);
+ loc1->rev = start_rev;
+ loc2->rev = end_rev;
+
+ source = svn_client__merge_source_create(loc1, loc2,
+ source->ancestral,
+ result_pool);
+ }
+
+ *source_p = source;
+ return SVN_NO_ERROR;
+}
+
/* Drive a merge of MERGE_SOURCES into working copy node TARGET
and possibly record mergeinfo describing the merge -- see
RECORD_MERGEINFO().
@@ -7583,6 +7627,7 @@ do_merge(apr_hash_t **modified_subtrees,
cb_table.mergeinfo_changed = apply_processor_mergeinfo_changed;
cb_table.adjust_mergeinfo = apply_processor_adjust_mergeinfo;
+ cb_table.adjust_merge_source = apply_processor_adjust_merge_source;
svn_pool_clear(iterpool);
Modified:
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
URL:
http://svn.apache.org/viewvc/subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c?rev=1922163&r1=1922162&r2=1922163&view=diff
==============================================================================
---
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
(original)
+++
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c
Wed Nov 27 14:09:31 2024
@@ -587,6 +587,7 @@ record_tree_conflict(merge_apply_process
const svn_wc_conflict_version_t *right;
apr_pool_t *result_pool = parent_baton ? parent_baton->pool
: scratch_pool;
+ svn_client__merge_source_t *source;
if (reason == svn_wc_conflict_reason_deleted)
{
@@ -613,49 +614,21 @@ record_tree_conflict(merge_apply_process
reason = svn_wc_conflict_reason_moved_here;
}
-#if TODO_FILTER_MERGEINFO
- if (HONOR_MERGEINFO(merge_b) && merge_b->merge_source.ancestral)
+ source = &merge_b->merge_source;
+
+ if (merge_b->cb_table && merge_b->cb_table->adjust_merge_source)
{
- svn_client__merge_source_t *source;
- svn_client__pathrev_t *loc1;
- svn_client__pathrev_t *loc2;
- svn_revnum_t start_rev;
- svn_revnum_t end_rev;
-
- /* We are honoring mergeinfo so do not blindly record
- * a conflict describing the merge of
- * SOURCE->LOC1->URL@SOURCE->LOC1->REV through
- * SOURCE->LOC2->URL@SOURCE->LOC2->REV
- * but figure out the actual revision range merged. */
- (void)find_nearest_ancestor_with_intersecting_ranges(
- &start_rev, &end_rev,
- merge_b->children_with_mergeinfo,
- action != svn_wc_conflict_action_delete,
- local_abspath);
-
- loc1 = svn_client__pathrev_dup(merge_b->merge_source.loc1,
- scratch_pool);
- loc2 = svn_client__pathrev_dup(merge_b->merge_source.loc2,
- scratch_pool);
- loc1->rev = start_rev;
- loc2->rev = end_rev;
- source = svn_client__merge_source_create(loc1, loc2,
-
merge_b->merge_source.ancestral,
- scratch_pool);
-
- SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
- merge_left_node_kind,
- merge_right_node_kind,
- source, merge_b->target,
- result_pool, scratch_pool));
- }
- else
-#endif
- SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
- merge_left_node_kind,
- merge_right_node_kind,
- &merge_b->merge_source, merge_b->target,
- result_pool, scratch_pool));
+ SVN_ERR(merge_b->cb_table->adjust_merge_source(
+ merge_b->cb_baton, &source,
+ local_abspath, action,
+ scratch_pool, scratch_pool));
+ }
+
+ SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
+ merge_left_node_kind,
+ merge_right_node_kind,
+ source, merge_b->target,
+ result_pool, scratch_pool));
/* Fix up delete of file, add of dir replacement (or other way around) */
if (existing_conflict != NULL && existing_conflict->src_left_version)