Author: rinrab
Date: Tue Nov 26 18:29:02 2024
New Revision: 1922129

URL: http://svn.apache.org/viewvc?rev=1922129&view=rev
Log:
On the 'apply-processor' branch: Allow merge.c to adjust mergeinfo properties
by adding adjust_mergeinfo callback to cb_table.

This will apply several mergeinfo adjustments onto the properties.

### Can we make this function to return and work with only the mergeinfo
### property instead of interacting with the entire list of properties?

* subversion/libsvn_client/client.h
  (svn_client__apply_processor_callbacks_t): Add adjust_mergeinfo method.
* subversion/libsvn_client/merge.c
  (apply_processor_adjust_mergeinfo): Implement function, find the previous
   code near merge_processor.c@1922128:321.
  (do_merge): Setup cb_table.adjust_mergeinfo with pointer to the
   apply_processor_adjust_mergeinfo function.
* subversion/libsvn_client/merge_processor.c
  (prepare_merge_props_changed): Invoke cb_table->adjust_mergeinfo() to let
   them do the work.

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=1922129&r1=1922128&r2=1922129&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/client.h 
(original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/client.h Tue 
Nov 26 18:29:02 2024
@@ -1301,6 +1301,12 @@ typedef struct svn_client__apply_process
                                     const svn_string_t *old_mergeinfo,
                                     const svn_string_t *new_mergeinfo,
                                     apr_pool_t *pool);
+
+  svn_error_t* (*adjust_mergeinfo)(void *baton,
+                                   apr_array_header_t **props_changes_p,
+                                   const char *local_abspath,
+                                   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=1922129&r1=1922128&r2=1922129&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/merge.c 
(original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/merge.c Tue 
Nov 26 18:29:02 2024
@@ -7353,6 +7353,36 @@ apply_processor_mergeinfo_changed(void *
   return SVN_NO_ERROR;
 }
 
+/* Implements svn_client__apply_processor_callbacks_t::adjust_mergeinfo */
+static svn_error_t *
+apply_processor_adjust_mergeinfo(void *baton,
+                                 apr_array_header_t **props_changes_p,
+                                 const char *local_abspath,
+                                 apr_pool_t *scratch_pool,
+                                 apr_pool_t *result_pool)
+
+{
+  merge_cmd_baton_t *merge_b = baton;
+
+  /* If this is a forward merge then don't add new mergeinfo to
+     PATH that is already part of PATH's own history, see
+     http://svn.haxx.se/dev/archive-2008-09/0006.shtml.  If the
+     merge sources are not ancestral then there is no concept of a
+     'forward' or 'reverse' merge and we filter unconditionally. */
+  if (merge_b->merge_source.loc1->rev < merge_b->merge_source.loc2->rev
+      || !merge_b->merge_source.ancestral)
+    {
+      if (HONOR_MERGEINFO(merge_b) || merge_b->reintegrate_merge)
+        SVN_ERR(filter_self_referential_mergeinfo(props_changes_p,
+                                                  local_abspath,
+                                                  merge_b->ra_session2,
+                                                  merge_b->ctx,
+                                                  result_pool));
+    }
+
+  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().
@@ -7573,6 +7603,7 @@ do_merge(apr_hash_t **modified_subtrees,
       cb_table.skipped_path = apply_processor_skipped_path;
       cb_table.updated_path = apply_processor_updated_path;
       cb_table.mergeinfo_changed = apply_processor_mergeinfo_changed;
+      cb_table.adjust_mergeinfo = apply_processor_adjust_mergeinfo;
 
       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=1922129&r1=1922128&r2=1922129&view=diff
==============================================================================
--- 
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c 
(original)
+++ 
subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c 
Tue Nov 26 18:29:02 2024
@@ -321,22 +321,13 @@ prepare_merge_props_changed(const apr_ar
       if (! merge_b->same_repos)
         SVN_ERR(omit_mergeinfo_changes(&props, props, result_pool));
 
-      /* If this is a forward merge then don't add new mergeinfo to
-         PATH that is already part of PATH's own history, see
-         http://svn.haxx.se/dev/archive-2008-09/0006.shtml.  If the
-         merge sources are not ancestral then there is no concept of a
-         'forward' or 'reverse' merge and we filter unconditionally. */
-      if (merge_b->merge_source.loc1->rev < merge_b->merge_source.loc2->rev
-          || !merge_b->merge_source.ancestral)
+      if (merge_b->cb_table && merge_b->cb_table->adjust_mergeinfo)
         {
-#if TODO_FILTER_MERGEINFO
-          if (HONOR_MERGEINFO(merge_b) || merge_b->reintegrate_merge)
-            SVN_ERR(filter_self_referential_mergeinfo(&props,
+          SVN_ERR(merge_b->cb_table->adjust_mergeinfo(merge_b->cb_baton,
+                                                      &props,
                                                       local_abspath,
-                                                      merge_b->ra_session2,
-                                                      merge_b->ctx,
+                                                      scratch_pool,
                                                       result_pool));
-#endif
         }
     }
   *prop_updates = props;


Reply via email to