svn commit: r1922198 - in /subversion/branches/apply-processor/subversion/libsvn_client: client.h merge.c merge_processor.c

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Thu Nov 28 20:43:23 2024
New Revision: 1922198

URL: http://svn.apache.org/viewvc?rev=1922198&view=rev
Log:
On the 'apply-processor' branch: Revert revisions, where some callbacks were
inlined into notify func; Unfortunately, this wouldn't work :(

Reverted revisions: 1922141, 1922142, 1922143, 1922144, 1922195

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=1922198&r1=1922197&r2=1922198&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/client.h (original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/client.h Thu Nov 28 20:43:23 2024
@@ -1282,6 +1282,20 @@ svn_client__compatible_wc_version_option
 
 typedef struct svn_client__apply_processor_callbacks_t
 {
+  svn_error_t *(*conflicted_path)(void *baton,
+                                  const char *path,
+                                  svn_boolean_t tree_conflict,
+                                  apr_pool_t *pool);
+
+  svn_error_t *(*skipped_path)(void *baton,
+                               const char *path,
+                               apr_pool_t *pool);
+
+  svn_error_t *(*updated_path)(void *baton,
+                               const char *local_abspath,
+                               svn_wc_notify_action_t action,
+                               apr_pool_t *pool);
+
   svn_error_t *(*mergeinfo_changed)(void *baton,
                                     const char *local_abspath,
                                     const svn_string_t *old_mergeinfo,

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=1922198&r1=1922197&r2=1922198&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/merge.c Thu Nov 28 20:43:23 2024
@@ -1283,81 +1283,6 @@ notify_merging(void *baton,
                apr_pool_t *pool)
 {
   struct notify_begin_state_t *b = baton;
-  merge_cmd_baton_t *merge_b = b->merge_b;
-
-  switch (notify->action)
-  {
-  case svn_wc_notify_update_update:
-    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      {
-        store_path(merge_b->merged_abspaths, notify->path);
-      }
-    break;
-
-  case svn_wc_notify_update_delete:
-    /* Update the lists of merged, skipped, tree-conflicted and added paths. */
-    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      {
-        /* Issue #4166: If a previous merge added NOTIFY_ABSPATH, but we
-           are now deleting it, then remove it from the list of added
-           paths. */
-        svn_hash_sets(merge_b->added_abspaths, notify->path, NULL);
-        store_path(merge_b->merged_abspaths, notify->path);
-      }
-
-    /* Note in children_with_mergeinfo that all paths in this subtree are
-     * being deleted, to avoid trying to set mergeinfo on them later. */
-    if (merge_b->children_with_mergeinfo)
-      {
-        int i;
-
-        for (i = 0; i < merge_b->children_with_mergeinfo->nelts; i++)
-          {
-            svn_client__merge_path_t *child
-              = APR_ARRAY_IDX(merge_b->children_with_mergeinfo, i,
-                  svn_client__merge_path_t *);
-
-            if (svn_dirent_is_ancestor(notify->path, child->abspath))
-              {
-                SVN_ERR(svn_sort__array_delete2(merge_b->children_with_mergeinfo, i--, 1));
-              }
-          }
-      }
-
-    break;
-
-  case svn_wc_notify_update_add:
-    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      {
-        store_path(merge_b->added_abspaths, notify->path);
-      }
-    break;
-
-  case svn_wc_notify_skip:
-    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      {
-        store_path(merge_b->skipped_abspaths, notify->path);
-      }
-    break;
-
-  case svn_wc_notify_tree_conflict:
-    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      {
-        alloc_and_store_path(&merge_b->tree_conflicted_abspaths, notify->path,
-                             merge_b->pool);
-      }
-
-    alloc_and_store_path(&merge_b->conflicted_paths, notify->path,
-                         merge_b->pool);
-    break;
-  }
-
-  if (notify->content_state == svn_wc_notify_state_conflicted ||
-      notify->prop_state == svn_wc_notify_state_conflicted)
-    {
-      alloc_and_store_path(&merge_b->conflicted_paths, notify->path,
-                           merge_b->pool);
-    }
 
   notify_merge_begin(b, notify->path,
                      notify->action == svn_wc_notify_update_delete,
@@ -7316,6 +7241,98 @@ ensure_ra_session_url(svn_ra_session_t *
   return SVN_NO_ERROR;
 }
 
+/* Implements svn_client__apply_processor_callbacks_t::conflicted_path */
+static svn_error_t *
+apply_processor_conflicted_path(void *baton, const char *local_abspath,
+                                svn_boolean_t tree_conflict, apr_pool_t *pool)
+{
+  merge_cmd_baton_t *merge_b = baton;
+
+  alloc_and_store_path(&merge_b->conflicted_paths, local_abspath,
+                       merge_b->pool);
+
+  if (tree_conflict)
+    alloc_and_store_path(&merge_b->tree_conflicted_abspaths, 
+                         local_abspath,
+                         merge_b->pool);
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_client__apply_processor_callbacks_t::skipped_path */
+static svn_error_t *
+apply_processor_skipped_path(void *baton, const char *local_abspath,
+                             apr_pool_t *pool)
+{
+  merge_cmd_baton_t *merge_b = baton;
+
+  if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
+    {
+      store_path(merge_b->skipped_abspaths, local_abspath);
+    }
+
+  return SVN_NO_ERROR;
+}
+
+/* Implements svn_client__apply_processor_callbacks_t::updated_path */
+static svn_error_t *
+apply_processor_updated_path(void *baton, const char *local_abspath,
+                             svn_wc_notify_action_t action, apr_pool_t *pool)
+{
+  merge_cmd_baton_t *merge_b = baton;
+
+  switch (action)
+  {
+  case svn_wc_notify_update_update:
+    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
+      {
+        store_path(merge_b->merged_abspaths, local_abspath);
+      }
+    break;
+
+  case svn_wc_notify_update_delete:
+    /* Update the lists of merged, skipped, tree-conflicted and added paths. */
+    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
+      {
+        /* Issue #4166: If a previous merge added NOTIFY_ABSPATH, but we
+           are now deleting it, then remove it from the list of added
+           paths. */
+        svn_hash_sets(merge_b->added_abspaths, local_abspath, NULL);
+        store_path(merge_b->merged_abspaths, local_abspath);
+      }
+
+    /* Note in children_with_mergeinfo that all paths in this subtree are
+     * being deleted, to avoid trying to set mergeinfo on them later. */
+    if (merge_b->children_with_mergeinfo)
+      {
+        int i;
+
+        for (i = 0; i < merge_b->children_with_mergeinfo->nelts; i++)
+          {
+            svn_client__merge_path_t *child
+              = APR_ARRAY_IDX(merge_b->children_with_mergeinfo, i,
+                  svn_client__merge_path_t *);
+
+            if (svn_dirent_is_ancestor(local_abspath, child->abspath))
+              {
+                SVN_ERR(svn_sort__array_delete2(merge_b->children_with_mergeinfo, i--, 1));
+              }
+          }
+      }
+
+    break;
+
+  case svn_wc_notify_update_add:
+    if (merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
+      {
+        store_path(merge_b->added_abspaths, local_abspath);
+      }
+    break;
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* Implements svn_client__apply_processor_callbacks_t::mergeinfo_changed */
 static svn_error_t *
 apply_processor_mergeinfo_changed(void *baton, const char *local_abspath,
@@ -7629,6 +7646,9 @@ do_merge(apr_hash_t **modified_subtrees,
       const svn_diff_tree_processor_t *processor;
       svn_client__apply_processor_callbacks_t cb_table = { 0 };
 
+      cb_table.conflicted_path = apply_processor_conflicted_path;
+      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;
       cb_table.adjust_merge_source = apply_processor_adjust_merge_source;

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=1922198&r1=1922197&r2=1922198&view=diff
==============================================================================
--- subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c (original)
+++ subversion/branches/apply-processor/subversion/libsvn_client/merge_processor.c Thu Nov 28 20:43:23 2024
@@ -537,6 +537,13 @@ record_skip(merge_apply_processor_baton_
   if (merge_b->record_only)
     return SVN_NO_ERROR; /* ### Why? - Legacy compatibility */
 
+  if (merge_b->cb_table && merge_b->cb_table->skipped_path
+      && !(pdb && pdb->shadowed))
+    {
+      SVN_ERR(merge_b->cb_table->skipped_path(merge_b->cb_baton, local_abspath,
+                                              scratch_pool));
+    }
+
   if (merge_b->notify_func)
     {
       svn_wc_notify_t *notify;
@@ -580,6 +587,12 @@ record_tree_conflict(merge_apply_process
   if (merge_b->record_only)
     return SVN_NO_ERROR;
 
+  if (merge_b->cb_table && merge_b->cb_table->conflicted_path)
+    {
+      SVN_ERR(merge_b->cb_table->conflicted_path(
+          merge_b->cb_baton, local_abspath, TRUE, scratch_pool));
+    }
+
   if (!merge_b->dry_run)
     {
        svn_wc_conflict_description2_t *conflict;
@@ -689,6 +702,13 @@ record_update_add(merge_apply_processor_
                   svn_boolean_t notify_replaced,
                   apr_pool_t *scratch_pool)
 {
+  if (merge_b->cb_table && merge_b->cb_table->updated_path)
+    {
+      SVN_ERR(merge_b->cb_table->updated_path(merge_b->cb_baton, local_abspath,
+                                              svn_wc_notify_update_add,
+                                              scratch_pool));
+    }
+
   if (merge_b->notify_func)
     {
       svn_wc_notify_t *notify;
@@ -717,6 +737,13 @@ record_update_update(merge_apply_process
                      svn_wc_notify_state_t prop_state,
                      apr_pool_t *scratch_pool)
 {
+  if (merge_b->cb_table && merge_b->cb_table->updated_path)
+    {
+      SVN_ERR(merge_b->cb_table->updated_path(merge_b->cb_baton, local_abspath,
+                                              svn_wc_notify_update_update,
+                                              scratch_pool));
+    }
+
   if (merge_b->notify_func)
     {
       svn_wc_notify_t *notify;
@@ -743,6 +770,13 @@ record_update_delete(merge_apply_process
                      svn_node_kind_t kind,
                      apr_pool_t *scratch_pool)
 {
+  if (merge_b->cb_table && merge_b->cb_table->updated_path)
+    {
+      SVN_ERR(merge_b->cb_table->updated_path(merge_b->cb_baton, local_abspath,
+                                              svn_wc_notify_update_delete,
+                                              scratch_pool));
+    }
+
   if (parent_db)
     {
       const char *dup_abspath = apr_pstrdup(parent_db->pool, local_abspath);
@@ -849,6 +883,12 @@ mark_dir_edited(merge_apply_processor_ba
                                notify,
                                scratch_pool);
         }
+
+      if (merge_b->cb_table && merge_b->cb_table->skipped_path)
+        {
+          SVN_ERR(merge_b->cb_table->skipped_path(
+              merge_b->cb_baton, local_abspath, scratch_pool));
+        }
     }
   else if (db->tree_conflict_reason != CONFLICT_REASON_NONE)
     {
@@ -922,6 +962,12 @@ mark_file_edited(merge_apply_processor_b
                                notify,
                                scratch_pool);
         }
+
+      if (merge_b->cb_table && merge_b->cb_table->skipped_path)
+        {
+          SVN_ERR(merge_b->cb_table->skipped_path(
+              merge_b->cb_baton, local_abspath, scratch_pool));
+        }
     }
   else if (fb->tree_conflict_reason != CONFLICT_REASON_NONE)
     {
@@ -1261,6 +1307,12 @@ merge_file_changed(const char *relpath,
                                   NULL, NULL,
                                   ctx->cancel_func, ctx->cancel_baton,
                                   scratch_pool));
+      if (merge_b->cb_table && merge_b->cb_table->conflicted_path
+          && property_state == svn_wc_notify_state_conflicted)
+        {
+          SVN_ERR(merge_b->cb_table->conflicted_path(
+              merge_b->cb_baton, local_abspath, FALSE, scratch_pool));
+        }
     }
 
   /* Easy out: We are only applying mergeinfo differences. */
@@ -1320,6 +1372,16 @@ merge_file_changed(const char *relpath,
                             ctx->cancel_baton,
                             scratch_pool));
 
+      if (content_outcome == svn_wc_merge_conflict
+          || property_state == svn_wc_notify_state_conflicted)
+        {
+          if (merge_b->cb_table && merge_b->cb_table->conflicted_path)
+            {
+              SVN_ERR(merge_b->cb_table->conflicted_path(
+                  merge_b->cb_baton, local_abspath, FALSE, scratch_pool));
+            }
+        }
+
       if (content_outcome == svn_wc_merge_conflict)
         text_state = svn_wc_notify_state_conflicted;
       else if (has_local_mods
@@ -1399,6 +1461,14 @@ merge_file_added(const char *relpath,
       return SVN_NO_ERROR;
     }
 
+  if (merge_b->cb_table && merge_b->cb_table->updated_path
+      && ( !fb->parent_baton || !fb->parent_baton->added))
+    {
+      SVN_ERR(merge_b->cb_table->updated_path(merge_b->cb_baton, local_abspath,
+                                              svn_wc_notify_update_add,
+                                              scratch_pool));
+    }
+
   if (!merge_b->dry_run)
     {
       const char *copyfrom_url;
@@ -2187,6 +2257,13 @@ merge_dir_changed(const char *relpath,
                                   ctx->cancel_func, ctx->cancel_baton,
                                   scratch_pool));
 
+      if (merge_b->cb_table && merge_b->cb_table->conflicted_path &&
+          prop_state == svn_wc_notify_state_conflicted)
+        {
+          SVN_ERR(merge_b->cb_table->conflicted_path(
+              merge_b->cb_baton, local_abspath, FALSE, scratch_pool));
+        }
+
       if (prop_state == svn_wc_notify_state_conflicted
           || prop_state == svn_wc_notify_state_merged
           || prop_state == svn_wc_notify_state_changed)
@@ -2248,6 +2325,14 @@ merge_dir_added(const char *relpath,
                  && ! merge_b->record_only /* Skip details from merge_open_dir() */
                  );
 
+  if (merge_b->cb_table && merge_b->cb_table->updated_path
+      && ( !db->parent_baton || !db->parent_baton->added))
+    {
+          SVN_ERR(merge_b->cb_table->updated_path(
+              merge_b->cb_baton, local_abspath, svn_wc_notify_update_add,
+              scratch_pool));
+    }
+
   if (merge_b->same_repos)
     {
       /* When the directory was added in merge_dir_added() we didn't update its
@@ -2333,6 +2418,12 @@ merge_dir_added(const char *relpath,
                                   merge_b->ctx->cancel_func,
                                   merge_b->ctx->cancel_baton,
                                   scratch_pool));
+      if (merge_b->cb_table && merge_b->cb_table->conflicted_path &&
+          prop_state == svn_wc_notify_state_conflicted)
+        {
+          SVN_ERR(merge_b->cb_table->conflicted_path(
+              merge_b->cb_baton, local_abspath, FALSE, scratch_pool));
+        }
     }
 
   return SVN_NO_ERROR;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.