Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/merge.c?rev=1922345&r1=1922344&r2=1922345&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/merge.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/merge.c 
Fri Dec  6 13:59:05 2024
@@ -232,29 +232,41 @@ struct notify_begin_state_t
 };
 
 typedef struct merge_cmd_baton_t {
-  svn_boolean_t force_delete;         /* Delete a file/dir even if modified */
+  /* Delete a file/dir even if modified */
+  svn_boolean_t force_delete;
+
   svn_boolean_t dry_run;
-  svn_boolean_t record_only;          /* Whether to merge only mergeinfo
-                                         differences. */
-  svn_boolean_t same_repos;           /* Whether the merge source repository
-                                         is the same repository as the
-                                         target.  Defaults to FALSE if DRY_RUN
-                                         is TRUE.*/
-  svn_boolean_t mergeinfo_capable;    /* Whether the merge source server
-                                         is capable of Merge Tracking. */
-  svn_boolean_t ignore_mergeinfo;     /* Don't honor mergeinfo; see
-                                         doc string of do_merge().  FALSE if
-                                         MERGE_SOURCE->ancestral is FALSE. */
-  svn_boolean_t diff_ignore_ancestry; /* Diff unrelated nodes as if related; 
see
-                                         doc string of do_merge().  FALSE if
-                                         MERGE_SOURCE->ancestral is FALSE. */
-  svn_boolean_t reintegrate_merge;    /* Whether this is a --reintegrate
-                                         merge or not. */
-  const merge_target_t *target;       /* Description of merge target node */
+
+  /* Whether to merge only mergeinfo differences. */
+  svn_boolean_t record_only;
+
+  /* Whether the merge source repository is the same repository as the target.
+     Defaults to FALSE if DRY_RUN is TRUE.*/
+  svn_boolean_t same_repos;
+
+  /* Whether the merge source server is capable of Merge Tracking. */
+  svn_boolean_t mergeinfo_capable;
+
+  /* Don't honor mergeinfo; see doc string of do_merge().  FALSE if
+     MERGE_SOURCE->ancestral is FALSE. */
+  svn_boolean_t ignore_mergeinfo;
+
+  /* Diff unrelated nodes as if related; see doc string of do_merge().  FALSE
+     if MERGE_SOURCE->ancestral is FALSE. */
+  svn_boolean_t diff_ignore_ancestry;
+
+  /* Whether this is a --reintegrate merge or not. */
+  svn_boolean_t reintegrate_merge;
+
+  /* Description of merge target node */
+  const svn_client__merge_target_t *target;
+
+  /* Directory baton for the root of the operation's target */
+  struct merge_dir_baton_t *target_dir_baton;
 
   /* The left and right URLs and revs.  The value of this field changes to
      reflect the merge_source_t *currently* being merged by do_merge(). */
-  merge_source_t merge_source;
+  svn_client__merge_source_t merge_source;
 
   /* Rangelist containing single range which describes the gap, if any,
      in the natural history of the merge source currently being processed.
@@ -267,7 +279,8 @@ typedef struct merge_cmd_baton_t {
      comment) or a similar list for single-file-merges */
   apr_array_header_t *children_with_mergeinfo;
 
-  svn_client_ctx_t *ctx;              /* Client context for callbacks, etc. */
+  /* Client context for callbacks, etc. */
+  svn_client_ctx_t *ctx;
 
   /* The list of any paths which remained in conflict after a
      resolution attempt was made.  We track this in-memory, rather
@@ -393,35 +406,6 @@ session_url_is(svn_ra_session_t *ra_sess
   return strcmp(url, session_url) == 0;
 }
 
-/* Return a new merge_source_t structure, allocated in RESULT_POOL,
- * initialized with deep copies of LOC1 and LOC2 and ANCESTRAL. */
-static merge_source_t *
-merge_source_create(const svn_client__pathrev_t *loc1,
-                    const svn_client__pathrev_t *loc2,
-                    svn_boolean_t ancestral,
-                    apr_pool_t *result_pool)
-{
-  merge_source_t *s
-    = apr_palloc(result_pool, sizeof(*s));
-
-  s->loc1 = svn_client__pathrev_dup(loc1, result_pool);
-  s->loc2 = svn_client__pathrev_dup(loc2, result_pool);
-  s->ancestral = ancestral;
-  return s;
-}
-
-/* Return a deep copy of SOURCE, allocated in RESULT_POOL. */
-static merge_source_t *
-merge_source_dup(const merge_source_t *source,
-                 apr_pool_t *result_pool)
-{
-  merge_source_t *s = apr_palloc(result_pool, sizeof(*s));
-
-  s->loc1 = svn_client__pathrev_dup(source->loc1, result_pool);
-  s->loc2 = svn_client__pathrev_dup(source->loc2, result_pool);
-  s->ancestral = source->ancestral;
-  return s;
-}
 
 /* Decide whether ambiguous foreign merge should be a warning or an error */
 #define WITH_AMBIGUOUS_FOREIGN_MERGE_WARNING \
@@ -457,7 +441,7 @@ notify_pre_1_16_warning(svn_error_t *war
 /* Return SVN_ERR_UNSUPPORTED_FEATURE if URL is not inside the repository
    of LOCAL_ABSPATH.  Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-check_repos_match(const merge_target_t *target,
+check_repos_match(const svn_client__merge_target_t *target,
                   const char *local_abspath,
                   const char *url,
                   apr_pool_t *scratch_pool)
@@ -637,8 +621,8 @@ make_conflict_versions(const svn_wc_conf
                        const char *victim_abspath,
                        svn_node_kind_t merge_left_node_kind,
                        svn_node_kind_t merge_right_node_kind,
-                       const merge_source_t *merge_source,
-                       const merge_target_t *target,
+                       const svn_client__merge_source_t *merge_source,
+                       const svn_client__merge_target_t *target,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
@@ -1209,7 +1193,7 @@ struct dir_delete_baton_t
 };
 
 /* Baton for the merge_dir_*() functions. Initialized in merge_dir_opened() */
-struct merge_dir_baton_t
+typedef struct merge_dir_baton_t
 {
   /* Reference to the parent baton, unless the parent is the anchor, in which
      case PARENT_BATON is NULL */
@@ -1274,14 +1258,29 @@ struct merge_dir_baton_t
      currently in progress. Allocated in the root-directory baton, referenced
      from all descendants */
   struct dir_delete_baton_t *delete_state;
-};
+} merge_dir_baton_t;
+
+/* Allocate new #merge_dir_baton_t structure in @a result_pool */
+static merge_dir_baton_t *
+create_dir_baton(apr_pool_t *result_pool)
+{
+  merge_dir_baton_t *db;
+
+  db = apr_pcalloc(result_pool, sizeof(*db));
+  db->pool = result_pool;
+  db->tree_conflict_reason = CONFLICT_REASON_NONE;
+  db->tree_conflict_action = svn_wc_conflict_action_edit;
+  db->skip_reason = svn_wc_notify_state_unknown;
+
+  return db;
+}
 
 /* Baton for the merge_dir_*() functions. Initialized in merge_file_opened() */
-struct merge_file_baton_t
+typedef struct merge_file_baton_t
 {
   /* Reference to the parent baton, unless the parent is the anchor, in which
      case PARENT_BATON is NULL */
-  struct merge_dir_baton_t *parent_baton;
+  merge_dir_baton_t *parent_baton;
 
   /* This file doesn't have a representation in the working copy, so any
      operation on it will be skipped and possibly cause a tree conflict
@@ -1308,7 +1307,21 @@ struct merge_file_baton_t
   /* TRUE if the node was added by this merge. Otherwise FALSE */
   svn_boolean_t added;
   svn_boolean_t add_is_replace; /* Add is second part of replace */
-};
+} merge_file_baton_t;
+
+/* Allocate new #merge_file_baton_t structure in @a result_pool */
+static merge_file_baton_t *
+create_file_baton(apr_pool_t *result_pool)
+{
+  merge_file_baton_t *fb;
+
+  fb = apr_pcalloc(result_pool, sizeof(*fb));
+  fb->tree_conflict_reason = CONFLICT_REASON_NONE;
+  fb->tree_conflict_action = svn_wc_conflict_action_edit;
+  fb->skip_reason = svn_wc_notify_state_unknown;
+
+  return fb;
+}
 
 /* Record the skip for future processing and (later) produce the
    skip notification */
@@ -1318,14 +1331,14 @@ record_skip(merge_cmd_baton_t *merge_b,
             svn_node_kind_t kind,
             svn_wc_notify_action_t action,
             svn_wc_notify_state_t state,
-            struct merge_dir_baton_t *pdb,
+            merge_dir_baton_t *pdb,
             apr_pool_t *scratch_pool)
 {
   if (merge_b->record_only)
     return SVN_NO_ERROR; /* ### Why? - Legacy compatibility */
 
   if ((merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      && !(pdb && pdb->shadowed))
+      && !pdb->shadowed)
     {
       store_path(merge_b->skipped_abspaths, local_abspath);
     }
@@ -1367,7 +1380,7 @@ find_nearest_ancestor_with_intersecting_
 static svn_error_t *
 record_tree_conflict(merge_cmd_baton_t *merge_b,
                      const char *local_abspath,
-                     struct merge_dir_baton_t *parent_baton,
+                     merge_dir_baton_t *parent_baton,
                      svn_node_kind_t local_node_kind,
                      svn_node_kind_t merge_left_node_kind,
                      svn_node_kind_t merge_right_node_kind,
@@ -1393,11 +1406,10 @@ record_tree_conflict(merge_cmd_baton_t *
 
   if (!merge_b->dry_run)
     {
-       svn_wc_conflict_description2_t *conflict;
-       const svn_wc_conflict_version_t *left;
-       const svn_wc_conflict_version_t *right;
-       apr_pool_t *result_pool = parent_baton ? parent_baton->pool
-                                              : scratch_pool;
+      svn_wc_conflict_description2_t *conflict;
+      const svn_wc_conflict_version_t *left;
+      const svn_wc_conflict_version_t *right;
+      apr_pool_t *result_pool = parent_baton->pool;
 
       if (reason == svn_wc_conflict_reason_deleted)
         {
@@ -1426,11 +1438,11 @@ record_tree_conflict(merge_cmd_baton_t *
 
       if (HONOR_MERGEINFO(merge_b) && merge_b->merge_source.ancestral)
         {
-          struct merge_source_t *source;
+          svn_client__merge_source_t *source;
           svn_client__pathrev_t *loc1;
           svn_client__pathrev_t *loc2;
-          svn_merge_range_t range =
-            {SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, TRUE};
+          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
@@ -1438,19 +1450,21 @@ record_tree_conflict(merge_cmd_baton_t *
            * SOURCE->LOC2->URL@SOURCE->LOC2->REV
            * but figure out the actual revision range merged. */
           (void)find_nearest_ancestor_with_intersecting_ranges(
-            &(range.start), &(range.end),
+            &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 = range.start;
-          loc2->rev = range.end;
-          source = merge_source_create(loc1, loc2,
-                                       merge_b->merge_source.ancestral,
-                                       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,
@@ -1484,15 +1498,12 @@ record_tree_conflict(merge_cmd_baton_t *
       SVN_ERR(svn_wc__add_tree_conflict(merge_b->ctx->wc_ctx, conflict,
                                         scratch_pool));
 
-      if (parent_baton)
-        {
-          if (! parent_baton->new_tree_conflicts)
-            parent_baton->new_tree_conflicts = apr_hash_make(result_pool);
+      if (! parent_baton->new_tree_conflicts)
+        parent_baton->new_tree_conflicts = apr_hash_make(result_pool);
 
-          svn_hash_sets(parent_baton->new_tree_conflicts,
-                        apr_pstrdup(result_pool, local_abspath),
-                        conflict);
-        }
+      svn_hash_sets(parent_baton->new_tree_conflicts,
+                    apr_pstrdup(result_pool, local_abspath),
+                    conflict);
 
       /* ### TODO: Store in parent baton */
     }
@@ -1582,7 +1593,7 @@ record_update_update(merge_cmd_baton_t *
    update_delete notification */
 static svn_error_t *
 record_update_delete(merge_cmd_baton_t *merge_b,
-                     struct merge_dir_baton_t *parent_db,
+                     merge_dir_baton_t *parent_db,
                      const char *local_abspath,
                      svn_node_kind_t kind,
                      apr_pool_t *scratch_pool)
@@ -1635,7 +1646,7 @@ record_update_delete(merge_cmd_baton_t *
    might make them a 'R'eplace. */
 static svn_error_t *
 handle_pending_notifications(merge_cmd_baton_t *merge_b,
-                             struct merge_dir_baton_t *db,
+                             merge_dir_baton_t *db,
                              apr_pool_t *scratch_pool)
 {
   if (merge_b->notify_func && db->pending_deletes)
@@ -1671,7 +1682,7 @@ handle_pending_notifications(merge_cmd_b
  */
 static svn_error_t *
 mark_dir_edited(merge_cmd_baton_t *merge_b,
-                struct merge_dir_baton_t *db,
+                merge_dir_baton_t *db,
                 const char *local_abspath,
                 apr_pool_t *scratch_pool)
 {
@@ -1754,7 +1765,7 @@ mark_dir_edited(merge_cmd_baton_t *merge
  */
 static svn_error_t *
 mark_file_edited(merge_cmd_baton_t *merge_b,
-                 struct merge_file_baton_t *fb,
+                 merge_file_baton_t *fb,
                  const char *local_abspath,
                  apr_pool_t *scratch_pool)
 {
@@ -1847,16 +1858,11 @@ merge_file_opened(void **new_file_baton,
                   apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *pdb = dir_baton;
-  struct merge_file_baton_t *fb;
+  merge_dir_baton_t *pdb = dir_baton ? dir_baton : merge_b->target_dir_baton;
+  merge_file_baton_t *fb = create_file_baton(result_pool);
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
 
-  fb = apr_pcalloc(result_pool, sizeof(*fb));
-  fb->tree_conflict_reason = CONFLICT_REASON_NONE;
-  fb->tree_conflict_action = svn_wc_conflict_action_edit;
-  fb->skip_reason = svn_wc_notify_state_unknown;
-
   if (left_source)
     fb->tree_conflict_merge_left_node_kind = svn_node_file;
   else
@@ -1869,12 +1875,9 @@ merge_file_opened(void **new_file_baton,
 
   *new_file_baton = fb;
 
-  if (pdb)
-    {
-      fb->parent_baton = pdb;
-      fb->shadowed = pdb->shadowed;
-      fb->skip_reason = pdb->skip_reason;
-    }
+  fb->parent_baton = pdb;
+  fb->shadowed = pdb->shadowed;
+  fb->skip_reason = pdb->skip_reason;
 
   if (fb->shadowed)
     {
@@ -1923,9 +1926,8 @@ merge_file_opened(void **new_file_baton,
              Non-inheritable mergeinfo will be recorded, allowing
              future merges into non-shallow working copies to merge
              changes we missed this time around. */
-          if (pdb && (excluded
-                      || (parent_depth != svn_depth_unknown &&
-                          parent_depth < svn_depth_files)))
+          if (excluded || (parent_depth != svn_depth_unknown &&
+                           parent_depth < svn_depth_files))
             {
                 fb->shadowed = TRUE;
 
@@ -1975,8 +1977,7 @@ merge_file_opened(void **new_file_baton,
             }
 
           /* Comparison mode to verify for delete tree conflicts? */
-          if (pdb && pdb->delete_state
-              && pdb->delete_state->found_edit)
+          if (pdb->delete_state && pdb->delete_state->found_edit)
             {
               /* Earlier nodes found a conflict. Done. */
               *skip = TRUE;
@@ -1991,7 +1992,7 @@ merge_file_opened(void **new_file_baton,
       fb->added = TRUE;
       fb->tree_conflict_action = svn_wc_conflict_action_add;
 
-      if (pdb && pdb->pending_deletes
+      if (pdb->pending_deletes
           && svn_hash_gets(pdb->pending_deletes, local_abspath))
         {
           fb->add_is_replace = TRUE;
@@ -2000,8 +2001,7 @@ merge_file_opened(void **new_file_baton,
           svn_hash_sets(pdb->pending_deletes, local_abspath, NULL);
         }
 
-      if (pdb
-          && pdb->new_tree_conflicts
+      if (pdb->new_tree_conflicts
           && (old_tc = svn_hash_gets(pdb->new_tree_conflicts, local_abspath)))
         {
           fb->tree_conflict_action = svn_wc_conflict_action_replace;
@@ -2033,8 +2033,7 @@ merge_file_opened(void **new_file_baton,
               return SVN_NO_ERROR;
             }
         }
-      else if (! (merge_b->dry_run
-                  && ((pdb && pdb->added) || fb->add_is_replace)))
+      else if (! (merge_b->dry_run && (pdb->added || fb->add_is_replace)))
         {
           svn_wc_notify_state_t obstr_state;
           svn_boolean_t is_deleted;
@@ -2096,7 +2095,7 @@ merge_file_changed(const char *relpath,
                   apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_file_baton_t *fb = file_baton;
+  merge_file_baton_t *fb = file_baton;
   svn_client_ctx_t *ctx = merge_b->ctx;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
@@ -2272,7 +2271,7 @@ merge_file_added(const char *relpath,
                  apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_file_baton_t *fb = file_baton;
+  merge_file_baton_t *fb = file_baton;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
   apr_hash_t *pristine_props;
@@ -2303,7 +2302,7 @@ merge_file_added(const char *relpath,
     }
 
   if ((merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      && ( !fb->parent_baton || !fb->parent_baton->added))
+      && !fb->parent_baton->added)
     {
       /* Store the roots of added subtrees */
       store_path(merge_b->added_abspaths, local_abspath);
@@ -2513,7 +2512,7 @@ merge_file_deleted(const char *relpath,
                    apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_file_baton_t *fb = file_baton;
+  merge_file_baton_t *fb = file_baton;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
   svn_boolean_t same;
@@ -2548,8 +2547,7 @@ merge_file_deleted(const char *relpath,
                          local_abspath, merge_b->ctx->wc_ctx,
                          scratch_pool));
 
-  if (fb->parent_baton
-      && fb->parent_baton->delete_state)
+  if (fb->parent_baton->delete_state)
     {
       if (same)
         {
@@ -2630,18 +2628,13 @@ merge_dir_opened(void **new_dir_baton,
                  apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db;
-  struct merge_dir_baton_t *pdb = parent_dir_baton;
+  merge_dir_baton_t *db = create_dir_baton(result_pool);
+  merge_dir_baton_t *pdb =
+    parent_dir_baton ? parent_dir_baton : merge_b->target_dir_baton;
 
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
 
-  db = apr_pcalloc(result_pool, sizeof(*db));
-  db->pool = result_pool;
-  db->tree_conflict_reason = CONFLICT_REASON_NONE;
-  db->tree_conflict_action = svn_wc_conflict_action_edit;
-  db->skip_reason = svn_wc_notify_state_unknown;
-
   *new_dir_baton = db;
 
   if (left_source)
@@ -2654,12 +2647,9 @@ merge_dir_opened(void **new_dir_baton,
   else
     db->tree_conflict_merge_right_node_kind = svn_node_none;
 
-  if (pdb)
-    {
-      db->parent_baton = pdb;
-      db->shadowed = pdb->shadowed;
-      db->skip_reason = pdb->skip_reason;
-    }
+  db->parent_baton = pdb;
+  db->shadowed = pdb->shadowed;
+  db->skip_reason = pdb->skip_reason;
 
   if (db->shadowed)
     {
@@ -2733,9 +2723,8 @@ merge_dir_opened(void **new_dir_baton,
              Non-inheritable mergeinfo will be recorded, allowing
              future merges into non-shallow working copies to merge
              changes we missed this time around. */
-          if (pdb && (excluded
-                      || (parent_depth != svn_depth_unknown &&
-                          parent_depth < svn_depth_immediates)))
+          if (excluded || (parent_depth != svn_depth_unknown &&
+                           parent_depth < svn_depth_immediates))
             {
               db->shadowed = TRUE;
 
@@ -2789,7 +2778,7 @@ merge_dir_opened(void **new_dir_baton,
               return SVN_NO_ERROR; /* Already set a tree conflict */
             }
 
-          db->delete_state = (pdb != NULL) ? pdb->delete_state : NULL;
+          db->delete_state = pdb->delete_state;
 
           if (db->delete_state && db->delete_state->found_edit)
             {
@@ -2821,7 +2810,7 @@ merge_dir_opened(void **new_dir_baton,
       db->added = TRUE;
       db->tree_conflict_action = svn_wc_conflict_action_add;
 
-      if (pdb && pdb->pending_deletes
+      if (pdb->pending_deletes
           && svn_hash_gets(pdb->pending_deletes, local_abspath))
         {
           db->add_is_replace = TRUE;
@@ -2830,8 +2819,7 @@ merge_dir_opened(void **new_dir_baton,
           svn_hash_sets(pdb->pending_deletes, local_abspath, NULL);
         }
 
-      if (pdb
-          && pdb->new_tree_conflicts
+      if (pdb->new_tree_conflicts
           && (old_tc = svn_hash_gets(pdb->new_tree_conflicts, local_abspath)))
         {
           db->tree_conflict_action = svn_wc_conflict_action_replace;
@@ -2865,8 +2853,7 @@ merge_dir_opened(void **new_dir_baton,
             }
         }
 
-      if (! (merge_b->dry_run
-             && ((pdb && pdb->added) || db->add_is_replace)))
+      if (! (merge_b->dry_run && (pdb->added || db->add_is_replace)))
         {
           svn_wc_notify_state_t obstr_state;
           svn_boolean_t is_deleted;
@@ -3028,7 +3015,7 @@ merge_dir_changed(const char *relpath,
                   apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db = dir_baton;
+  merge_dir_baton_t *db = dir_baton;
   const apr_array_header_t *props;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
@@ -3115,7 +3102,7 @@ merge_dir_added(const char *relpath,
                 apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db = dir_baton;
+  merge_dir_baton_t *db = dir_baton;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
 
@@ -3143,7 +3130,7 @@ merge_dir_added(const char *relpath,
                  );
 
   if ((merge_b->merge_source.ancestral || merge_b->reintegrate_merge)
-      && ( !db->parent_baton || !db->parent_baton->added))
+      && !db->parent_baton->added)
     {
       /* Store the roots of added subtrees */
       store_path(merge_b->added_abspaths, local_abspath);
@@ -3282,7 +3269,7 @@ merge_dir_deleted(const char *relpath,
                   apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db = dir_baton;
+  merge_dir_baton_t *db = dir_baton;
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
   svn_boolean_t same;
@@ -3454,7 +3441,7 @@ merge_dir_closed(const char *relpath,
                  apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db = dir_baton;
+  merge_dir_baton_t *db = dir_baton;
 
   SVN_ERR(handle_pending_notifications(merge_b, db, scratch_pool));
 
@@ -3481,7 +3468,7 @@ merge_node_absent(const char *relpath,
                   apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = processor->baton;
-  struct merge_dir_baton_t *db = dir_baton;
+  merge_dir_baton_t *db = dir_baton;
 
   const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
                                               relpath, scratch_pool);
@@ -3521,21 +3508,6 @@ merge_apply_processor(merge_cmd_baton_t
   return merge_processor;
 }
 
-/* Initialize minimal dir baton to allow calculating 'R'eplace
-   from 'D'elete + 'A'dd. */
-static void *
-open_dir_for_replace_single_file(apr_pool_t *result_pool)
-{
-  struct merge_dir_baton_t *dir_baton = apr_pcalloc(result_pool, 
sizeof(*dir_baton));
-
-  dir_baton->pool = result_pool;
-  dir_baton->tree_conflict_reason = CONFLICT_REASON_NONE;
-  dir_baton->tree_conflict_action = svn_wc_conflict_action_edit;
-  dir_baton->skip_reason = svn_wc_notify_state_unknown;
-
-  return dir_baton;
-}
-
 /*-----------------------------------------------------------------------*/
 
 /*** Merge Notification ***/
@@ -4200,8 +4172,8 @@ adjust_deleted_subtree_ranges(svn_client
    CHILDREN_WITH_MERGEINFO are allocated in RESULT_POOL.
 */
 static svn_error_t *
-fix_deleted_subtree_ranges(const merge_source_t *source,
-                           const merge_target_t *target,
+fix_deleted_subtree_ranges(const svn_client__merge_source_t *source,
+                           const svn_client__merge_target_t *target,
                            svn_ra_session_t *ra_session,
                            apr_array_header_t *children_with_mergeinfo,
                            svn_client_ctx_t *ctx,
@@ -4819,7 +4791,7 @@ filter_merged_revisions(svn_client__merg
 static svn_error_t *
 calculate_remaining_ranges(svn_client__merge_path_t *parent,
                            svn_client__merge_path_t *child,
-                           const merge_source_t *source,
+                           const svn_client__merge_source_t *source,
                            svn_mergeinfo_t target_mergeinfo,
                            const apr_array_header_t *implicit_src_gap,
                            svn_boolean_t child_inherits_implicit,
@@ -4980,7 +4952,7 @@ calculate_remaining_ranges(svn_client__m
 static svn_error_t *
 find_gaps_in_merge_source_history(svn_revnum_t *gap_start,
                                   svn_revnum_t *gap_end,
-                                  const merge_source_t *source,
+                                  const svn_client__merge_source_t *source,
                                   svn_ra_session_t *ra_session,
                                   svn_client_ctx_t *ctx,
                                   apr_pool_t *scratch_pool)
@@ -5119,7 +5091,7 @@ find_gaps_in_merge_source_history(svn_re
 */
 static svn_error_t *
 populate_remaining_ranges(apr_array_header_t *children_with_mergeinfo,
-                          const merge_source_t *source,
+                          const svn_client__merge_source_t *source,
                           svn_ra_session_t *ra_session,
                           merge_cmd_baton_t *merge_b,
                           apr_pool_t *result_pool,
@@ -5221,7 +5193,7 @@ populate_remaining_ranges(apr_array_head
         APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *);
       const char *child_repos_path
         = svn_dirent_skip_ancestor(merge_b->target->abspath, child->abspath);
-      merge_source_t child_source;
+      svn_client__merge_source_t child_source;
       svn_client__merge_path_t *parent = NULL;
       svn_boolean_t child_inherits_implicit;
 
@@ -5594,18 +5566,18 @@ typedef struct single_range_conflict_rep
 {
   /* What sub-range of the requested source raised conflicts?
    * The 'inheritable' flag is ignored. */
-  merge_source_t *conflicted_range;
+  svn_client__merge_source_t *conflicted_range;
   /* What sub-range of the requested source remains to be merged?
    * NULL if no more.  The 'inheritable' flag is ignored. */
-  merge_source_t *remaining_source;
+  svn_client__merge_source_t *remaining_source;
 
 } single_range_conflict_report_t;
 
 /* Create a single_range_conflict_report_t, containing deep copies of
  * CONFLICTED_RANGE and REMAINING_SOURCE, allocated in RESULT_POOL. */
 static single_range_conflict_report_t *
-single_range_conflict_report_create(const merge_source_t *conflicted_range,
-                                    const merge_source_t *remaining_source,
+single_range_conflict_report_create(const svn_client__merge_source_t 
*conflicted_range,
+                                    const svn_client__merge_source_t 
*remaining_source,
                                     apr_pool_t *result_pool)
 {
   single_range_conflict_report_t *report
@@ -5613,9 +5585,11 @@ single_range_conflict_report_create(cons
 
   assert(conflicted_range != NULL);
 
-  report->conflicted_range = merge_source_dup(conflicted_range, result_pool);
+  report->conflicted_range =
+    svn_client__merge_source_dup(conflicted_range, result_pool);
   report->remaining_source
-    = remaining_source ? merge_source_dup(remaining_source, result_pool)
+    = remaining_source ? svn_client__merge_source_dup(remaining_source,
+                                                      result_pool)
                        : NULL;
   return report;
 }
@@ -5624,7 +5598,7 @@ single_range_conflict_report_create(cons
  * parameters, allocated in RESULT_POOL. */
 static svn_client__conflict_report_t *
 conflict_report_create(const char *target_abspath,
-                       const merge_source_t *conflicted_range,
+                       const svn_client__merge_source_t *conflicted_range,
                        svn_boolean_t was_last_range,
                        apr_pool_t *result_pool)
 {
@@ -5632,7 +5606,8 @@ conflict_report_create(const char *targe
                                                      sizeof(*report));
 
   report->target_abspath = apr_pstrdup(result_pool, target_abspath);
-  report->conflicted_range = merge_source_dup(conflicted_range, result_pool);
+  report->conflicted_range =
+    svn_client__merge_source_dup(conflicted_range, result_pool);
   report->was_last_range = was_last_range;
   return report;
 }
@@ -5646,8 +5621,8 @@ conflict_report_dup(const svn_client__co
                                                    sizeof(*new));
 
   new->target_abspath = apr_pstrdup(result_pool, report->target_abspath);
-  new->conflicted_range = merge_source_dup(report->conflicted_range,
-                                           result_pool);
+  new->conflicted_range =
+    svn_client__merge_source_dup(report->conflicted_range, result_pool);
   return new;
 }
 
@@ -5806,7 +5781,7 @@ remove_children_with_deleted_mergeinfo(m
 */
 static svn_error_t *
 drive_merge_report_editor(const char *target_abspath,
-                          const merge_source_t *source,
+                          const svn_client__merge_source_t *source,
                           const apr_array_header_t *children_with_mergeinfo,
                           const svn_diff_tree_processor_t *processor,
                           svn_depth_t depth,
@@ -6262,7 +6237,7 @@ insert_child_to_merge(apr_array_header_t
 static svn_error_t *
 insert_parent_and_sibs_of_sw_absent_del_subtree(
                                    apr_array_header_t *children_with_mergeinfo,
-                                   const merge_target_t *target,
+                                   const svn_client__merge_target_t *target,
                                    int *curr_index,
                                    svn_client__merge_path_t *child,
                                    svn_depth_t depth,
@@ -6544,7 +6519,7 @@ get_wc_explicit_mergeinfo_catalog(apr_ha
 */
 static svn_error_t *
 get_mergeinfo_paths(apr_array_header_t *children_with_mergeinfo,
-                    const merge_target_t *target,
+                    const svn_client__merge_target_t *target,
                     svn_depth_t depth,
                     svn_boolean_t dry_run,
                     svn_boolean_t same_repos,
@@ -7112,8 +7087,8 @@ static int
 compare_merge_source_ts(const void *a,
                         const void *b)
 {
-  svn_revnum_t a_rev = (*(const merge_source_t *const *)a)->loc1->rev;
-  svn_revnum_t b_rev = (*(const merge_source_t *const *)b)->loc1->rev;
+  svn_revnum_t a_rev = (*(const svn_client__merge_source_t *const 
*)a)->loc1->rev;
+  svn_revnum_t b_rev = (*(const svn_client__merge_source_t *const 
*)b)->loc1->rev;
   if (a_rev == b_rev)
     return 0;
   return a_rev < b_rev ? 1 : -1;
@@ -7133,7 +7108,7 @@ combine_range_with_segments(apr_array_he
                             apr_pool_t *pool)
 {
   apr_array_header_t *merge_source_ts =
-    apr_array_make(pool, 1, sizeof(merge_source_t *));
+    apr_array_make(pool, 1, sizeof(svn_client__merge_source_t *));
   svn_revnum_t minrev = MIN(range->start, range->end) + 1;
   svn_revnum_t maxrev = MAX(range->start, range->end);
   svn_boolean_t subtractive = (range->start > range->end);
@@ -7144,7 +7119,7 @@ combine_range_with_segments(apr_array_he
       svn_location_segment_t *segment =
         APR_ARRAY_IDX(segments, i, svn_location_segment_t *);
       svn_client__pathrev_t *loc1, *loc2;
-      merge_source_t *merge_source;
+      svn_client__merge_source_t *merge_source;
       const char *path1 = NULL;
       svn_revnum_t rev1;
 
@@ -7199,13 +7174,16 @@ combine_range_with_segments(apr_array_he
                MIN(segment->range_end, maxrev), segment->path, pool);
       /* If this is subtractive, reverse the whole calculation. */
       if (subtractive)
-        merge_source = merge_source_create(loc2, loc1, TRUE /* ancestral */,
-                                           pool);
+        merge_source = svn_client__merge_source_create(loc2, loc1,
+                                                       TRUE /* ancestral */,
+                                                       pool);
       else
-        merge_source = merge_source_create(loc1, loc2, TRUE /* ancestral */,
-                                           pool);
+        merge_source = svn_client__merge_source_create(loc1, loc2,
+                                                       TRUE /* ancestral */,
+                                                       pool);
 
-      APR_ARRAY_PUSH(merge_source_ts, merge_source_t *) = merge_source;
+      APR_ARRAY_PUSH(merge_source_ts, svn_client__merge_source_t *)
+        = merge_source;
     }
 
   /* If this was a subtractive merge, and we created more than one
@@ -7236,7 +7214,8 @@ normalize_merge_sources_internal(apr_arr
   int i;
 
   /* Initialize our return variable. */
-  *merge_sources_p = apr_array_make(result_pool, 1, sizeof(merge_source_t *));
+  *merge_sources_p = apr_array_make(result_pool, 1,
+                                    sizeof(svn_client__merge_source_t *));
 
   /* No ranges to merge?  No problem. */
   if (merge_range_ts->nelts == 0)
@@ -7529,8 +7508,8 @@ filter_natural_history_from_mergeinfo(sv
    Allocate the result structure in POOL but leave the URLs in it as shallow
    copies of the URLs in SOURCE.
 */
-static merge_source_t *
-subrange_source(const merge_source_t *source,
+static svn_client__merge_source_t *
+subrange_source(const svn_client__merge_source_t *source,
                 svn_revnum_t start_rev,
                 svn_revnum_t end_rev,
                 apr_pool_t *pool)
@@ -7557,7 +7536,7 @@ subrange_source(const merge_source_t *so
           loc1.url = source->loc2->url;
         }
     }
-  return merge_source_create(&loc1, &loc2, source->ancestral, pool);
+  return svn_client__merge_source_create(&loc1, &loc2, source->ancestral, 
pool);
 }
 
 /* The single-file, simplified version of do_directory_merge(), which see for
@@ -7584,7 +7563,7 @@ subrange_source(const merge_source_t *so
 static svn_error_t *
 do_file_merge(svn_mergeinfo_catalog_t result_catalog,
               single_range_conflict_report_t **conflict_report,
-              const merge_source_t *source,
+              const svn_client__merge_source_t *source,
               const char *target_abspath,
               const svn_diff_tree_processor_t *processor,
               svn_boolean_t sources_related,
@@ -7744,7 +7723,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
         {
           svn_merge_range_t *r = APR_ARRAY_IDX(ranges_to_merge, 0,
                                                svn_merge_range_t *);
-          const merge_source_t *real_source;
+          const svn_client__merge_source_t *real_source;
           const char *left_file, *right_file;
           apr_hash_t *left_props, *right_props;
           const svn_diff_source_t *left_source;
@@ -7780,7 +7759,6 @@ do_file_merge(svn_mergeinfo_catalog_t re
              do a text-n-props merge; otherwise, do a delete-n-add merge. */
           if (! (merge_b->diff_ignore_ancestry || sources_related))
             {
-              void *dir_baton = open_dir_for_replace_single_file(iterpool);
               void *file_baton;
               svn_boolean_t skip;
 
@@ -7791,7 +7769,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
                                              left_source,
                                              NULL /* right_source */,
                                              NULL /* copyfrom_source */,
-                                             dir_baton,
+                                             NULL /* dir_baton */,
                                              processor,
                                              iterpool, iterpool));
               if (! skip)
@@ -7810,7 +7788,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
                                              NULL /* left_source */,
                                              right_source,
                                              NULL /* copyfrom_source */,
-                                             dir_baton,
+                                             NULL /* dir_baton */,
                                              processor,
                                              iterpool, iterpool));
               if (! skip)
@@ -7861,7 +7839,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
 
           if (is_path_conflicted_by_merge(merge_b))
             {
-              merge_source_t *remaining_range = NULL;
+              svn_client__merge_source_t *remaining_range = NULL;
 
               if (real_source->loc2->rev != source->loc2->rev)
                 remaining_range = subrange_source(source,
@@ -8141,7 +8119,7 @@ subtree_touched_by_merge(const char *loc
 */
 static svn_error_t *
 do_mergeinfo_unaware_dir_merge(single_range_conflict_report_t 
**conflict_report,
-                               const merge_source_t *source,
+                               const svn_client__merge_source_t *source,
                                const char *target_dir_wcpath,
                                apr_array_header_t *children_with_mergeinfo,
                                const svn_diff_tree_processor_t *processor,
@@ -9014,7 +8992,7 @@ typedef struct log_noop_baton_t
   const char *source_fspath;
 
   /* The merge target. */
-  const merge_target_t *target;
+  const svn_client__merge_target_t *target;
 
   /* Initially empty rangelists allocated in POOL. The rangelists are
    * populated across multiple invocations of log_noop_revs(). */
@@ -9207,8 +9185,8 @@ log_noop_revs(void *baton,
    forward merges (i.e. SOURCE->rev1 < SOURCE->rev2).
 */
 static svn_error_t *
-remove_noop_subtree_ranges(const merge_source_t *source,
-                           const merge_target_t *target,
+remove_noop_subtree_ranges(const svn_client__merge_source_t *source,
+                           const svn_client__merge_target_t *target,
                            svn_ra_session_t *ra_session,
                            apr_array_header_t *children_with_mergeinfo,
                            apr_pool_t *result_pool,
@@ -9427,7 +9405,7 @@ remove_noop_subtree_ranges(const merge_s
 static svn_error_t *
 do_mergeinfo_aware_dir_merge(svn_mergeinfo_catalog_t result_catalog,
                              single_range_conflict_report_t **conflict_report,
-                             const merge_source_t *source,
+                             const svn_client__merge_source_t *source,
                              const char *target_abspath,
                              apr_array_header_t *children_with_mergeinfo,
                              const svn_diff_tree_processor_t *processor,
@@ -9573,7 +9551,7 @@ do_mergeinfo_aware_dir_merge(svn_mergein
 
           while (end_rev != SVN_INVALID_REVNUM)
             {
-              merge_source_t *real_source;
+              svn_client__merge_source_t *real_source;
               svn_merge_range_t *first_target_range
                 = (target_merge_path->remaining_ranges->nelts == 0 ? NULL
                    : APR_ARRAY_IDX(target_merge_path->remaining_ranges, 0,
@@ -9648,7 +9626,7 @@ do_mergeinfo_aware_dir_merge(svn_mergein
                  we have merged. */
               if (is_path_conflicted_by_merge(merge_b))
                 {
-                  merge_source_t *remaining_range = NULL;
+                  svn_client__merge_source_t *remaining_range = NULL;
 
                   if (real_source->loc2->rev != source->loc2->rev)
                     remaining_range = subrange_source(source,
@@ -9747,7 +9725,7 @@ do_mergeinfo_aware_dir_merge(svn_mergein
 static svn_error_t *
 do_directory_merge(svn_mergeinfo_catalog_t result_catalog,
                    single_range_conflict_report_t **conflict_report,
-                   const merge_source_t *source,
+                   const svn_client__merge_source_t *source,
                    const char *target_abspath,
                    const svn_diff_tree_processor_t *processor,
                    svn_depth_t depth,
@@ -9899,7 +9877,7 @@ do_merge(apr_hash_t **modified_subtrees,
          svn_client__conflict_report_t **conflict_report,
          svn_boolean_t *use_sleep,
          const apr_array_header_t *merge_sources,
-         const merge_target_t *target,
+         const svn_client__merge_target_t *target,
          svn_ra_session_t *src_session,
          svn_boolean_t sources_related,
          svn_boolean_t same_repos,
@@ -9941,7 +9919,8 @@ do_merge(apr_hash_t **modified_subtrees,
 
       /* Find out whether all of the sources are 'ancestral'. */
       for (j = 0; j < merge_sources->nelts; j++)
-        if (! APR_ARRAY_IDX(merge_sources, j, merge_source_t *)->ancestral)
+        if (! APR_ARRAY_IDX(merge_sources, j,
+                            svn_client__merge_source_t *)->ancestral)
           {
             sources_ancestral = FALSE;
             break;
@@ -9998,6 +9977,7 @@ do_merge(apr_hash_t **modified_subtrees,
   merge_cmd_baton.ctx = ctx;
   merge_cmd_baton.reintegrate_merge = reintegrate_merge;
   merge_cmd_baton.target = target;
+  merge_cmd_baton.target_dir_baton = create_dir_baton(result_pool);
   merge_cmd_baton.pool = iterpool;
   merge_cmd_baton.merge_options = merge_options;
   merge_cmd_baton.diff3_cmd = diff3_cmd;
@@ -10037,8 +10017,8 @@ do_merge(apr_hash_t **modified_subtrees,
   for (i = 0; i < merge_sources->nelts; i++)
     {
       svn_node_kind_t src1_kind;
-      merge_source_t *source =
-        APR_ARRAY_IDX(merge_sources, i, merge_source_t *);
+      svn_client__merge_source_t *source =
+        APR_ARRAY_IDX(merge_sources, i, svn_client__merge_source_t *);
       single_range_conflict_report_t *conflicted_range_report;
 
       svn_pool_clear(iterpool);
@@ -10207,10 +10187,10 @@ static svn_error_t *
 merge_cousins_and_supplement_mergeinfo(
   svn_client__conflict_report_t **conflict_report,
   svn_boolean_t *use_sleep,
-  const merge_target_t *target,
+  const svn_client__merge_target_t *target,
   svn_ra_session_t *URL1_ra_session,
   svn_ra_session_t *URL2_ra_session,
-  const merge_source_t *source,
+  const svn_client__merge_source_t *source,
   const svn_client__pathrev_t *yca,
   svn_boolean_t same_repos,
   svn_depth_t depth,
@@ -10257,10 +10237,10 @@ merge_cousins_and_supplement_mergeinfo(
   if (! record_only)
     {
       apr_array_header_t *faux_sources =
-        apr_array_make(scratch_pool, 1, sizeof(merge_source_t *));
+        apr_array_make(scratch_pool, 1, sizeof(svn_client__merge_source_t *));
 
       modified_subtrees = apr_hash_make(scratch_pool);
-      APR_ARRAY_PUSH(faux_sources, const merge_source_t *) = source;
+      APR_ARRAY_PUSH(faux_sources, const svn_client__merge_source_t *) = 
source;
       SVN_ERR(do_merge(&modified_subtrees, NULL, conflict_report, use_sleep,
                        faux_sources, target,
                        URL1_ra_session, TRUE, same_repos,
@@ -10471,7 +10451,7 @@ ensure_wc_path_has_repo_revision(const c
  * kinds of merge can use such a target; others can't.
  */
 static svn_error_t *
-open_target_wc(merge_target_t **target_p,
+open_target_wc(svn_client__merge_target_t **target_p,
                const char *wc_abspath,
                svn_boolean_t allow_mixed_rev,
                svn_boolean_t allow_local_mods,
@@ -10480,7 +10460,7 @@ open_target_wc(merge_target_t **target_p
                apr_pool_t *result_pool,
                apr_pool_t *scratch_pool)
 {
-  merge_target_t *target = apr_palloc(result_pool, sizeof(*target));
+  svn_client__merge_target_t *target = apr_palloc(result_pool, 
sizeof(*target));
   svn_client__pathrev_t *origin;
 
   target->abspath = apr_pstrdup(result_pool, wc_abspath);
@@ -10564,7 +10544,7 @@ svn_client__merge_locked(svn_client__con
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
   svn_client__pathrev_t *source1_loc, *source2_loc;
   svn_boolean_t sources_related = FALSE;
   svn_ra_session_t *ra_session1, *ra_session2;
@@ -10678,7 +10658,7 @@ svn_client__merge_locked(svn_client__con
          side, and merge the right. */
       else
         {
-          merge_source_t source;
+          svn_client__merge_source_t source;
 
           source.loc1 = source1_loc;
           source.loc2 = source2_loc;
@@ -10715,9 +10695,11 @@ svn_client__merge_locked(svn_client__con
   else
     {
       /* Build a single-item merge_source_t array. */
-      merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t 
*));
-      APR_ARRAY_PUSH(merge_sources, merge_source_t *)
-        = merge_source_create(source1_loc, source2_loc, FALSE, scratch_pool);
+      merge_sources = apr_array_make(scratch_pool, 1,
+                                     sizeof(svn_client__merge_source_t *));
+      APR_ARRAY_PUSH(merge_sources, svn_client__merge_source_t *)
+        = svn_client__merge_source_create(source1_loc, source2_loc,
+                                          FALSE, scratch_pool);
     }
 
   err = do_merge(NULL, NULL, conflict_report, &use_sleep,
@@ -11258,7 +11240,7 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
                         svn_mergeinfo_catalog_t source_catalog,
                         apr_hash_t *target_history_hash,
                         const svn_client__pathrev_t *source_loc,
-                        const merge_target_t *target,
+                        const svn_client__merge_target_t *target,
                         svn_ra_session_t *source_ra_session,
                         svn_ra_session_t *target_ra_session,
                         svn_client_ctx_t *ctx,
@@ -11485,7 +11467,7 @@ static svn_error_t *
 calculate_left_hand_side(svn_client__pathrev_t **left_p,
                          svn_mergeinfo_catalog_t *merged_to_source_catalog,
                          svn_mergeinfo_catalog_t *unmerged_to_source_catalog,
-                         const merge_target_t *target,
+                         const svn_client__merge_target_t *target,
                          apr_hash_t *subtrees_with_mergeinfo,
                          const svn_client__pathrev_t *source_loc,
                          svn_ra_session_t *source_ra_session,
@@ -11638,19 +11620,19 @@ calculate_left_hand_side(svn_client__pat
  * See svn_client_find_reintegrate_merge() for other details.
  */
 static svn_error_t *
-find_reintegrate_merge(merge_source_t **source_p,
+find_reintegrate_merge(svn_client__merge_source_t **source_p,
                        svn_client__pathrev_t **yc_ancestor_p,
                        svn_ra_session_t *source_ra_session,
                        const svn_client__pathrev_t *source_loc,
                        svn_ra_session_t *target_ra_session,
-                       const merge_target_t *target,
+                       const svn_client__merge_target_t *target,
                        svn_client_ctx_t *ctx,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
   svn_client__pathrev_t *yc_ancestor;
   svn_client__pathrev_t *loc1;
-  merge_source_t source;
+  svn_client__merge_source_t source;
   svn_mergeinfo_catalog_t unmerged_to_source_mergeinfo_catalog;
   svn_mergeinfo_catalog_t merged_to_source_mergeinfo_catalog;
   svn_error_t *err;
@@ -11766,7 +11748,7 @@ find_reintegrate_merge(merge_source_t **
   /* Left side: trunk@youngest-trunk-rev-merged-to-branch-at-specified-peg-rev
    * Right side: branch@specified-peg-revision */
   if (source_p)
-    *source_p = merge_source_dup(&source, result_pool);
+    *source_p = svn_client__merge_source_dup(&source, result_pool);
 
   if (yc_ancestor_p)
     *yc_ancestor_p = svn_client__pathrev_dup(yc_ancestor, result_pool);
@@ -11793,7 +11775,7 @@ static svn_error_t *
 open_reintegrate_source_and_target(svn_ra_session_t **source_ra_session_p,
                                    svn_client__pathrev_t **source_loc_p,
                                    svn_ra_session_t **target_ra_session_p,
-                                   merge_target_t **target_p,
+                                   svn_client__merge_target_t **target_p,
                                    const char *source_path_or_url,
                                    const svn_opt_revision_t 
*source_peg_revision,
                                    const char *target_abspath,
@@ -11802,7 +11784,7 @@ open_reintegrate_source_and_target(svn_r
                                    apr_pool_t *scratch_pool)
 {
   svn_client__pathrev_t *source_loc;
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
 
   /* Open the target WC.  A reintegrate merge requires the merge target to
    * reflect a subtree of the repository as found at a single revision. */
@@ -11854,9 +11836,9 @@ merge_reintegrate_locked(svn_client__con
                          apr_pool_t *scratch_pool)
 {
   svn_ra_session_t *target_ra_session, *source_ra_session;
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
   svn_client__pathrev_t *source_loc;
-  merge_source_t *source;
+  svn_client__merge_source_t *source;
   svn_client__pathrev_t *yc_ancestor;
   svn_boolean_t use_sleep = FALSE;
   svn_error_t *err;
@@ -11964,7 +11946,7 @@ merge_peg_locked(svn_client__conflict_re
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
   svn_client__pathrev_t *source_loc;
   apr_array_header_t *merge_sources;
   svn_ra_session_t *ra_session;
@@ -12016,21 +11998,6 @@ merge_peg_locked(svn_client__conflict_re
 
   /* Do the real merge!  (We say with confidence that our merge
      sources are both ancestral and related.) */
-  if (getenv("SVN_ELEMENT_MERGE")
-      && same_repos
-      && (depth == svn_depth_infinity || depth == svn_depth_unknown)
-      && ignore_mergeinfo
-      && !record_only)
-    {
-      err = svn_client__merge_elements(&use_sleep,
-                                       merge_sources, target, ra_session,
-                                       diff_ignore_ancestry, force_delete,
-                                       dry_run, merge_options,
-                                       ctx, result_pool, scratch_pool);
-      /* ### Currently this merge just errors out on any conflicts */
-      *conflict_report = NULL;
-    }
-  else
   err = do_merge(NULL, NULL, conflict_report, &use_sleep,
                  merge_sources, target, ra_session,
                  TRUE /*sources_related*/, same_repos, ignore_mergeinfo,
@@ -12228,7 +12195,7 @@ typedef struct source_and_target_t
   svn_ra_session_t *source_ra_session;
   branch_history_t source_branch;
 
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
   svn_ra_session_t *target_ra_session;
   branch_history_t target_branch;
 
@@ -12865,7 +12832,7 @@ do_automatic_merge_locked(svn_client__co
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
 {
-  merge_target_t *target;
+  svn_client__merge_target_t *target;
   svn_boolean_t reintegrate_like = merge->is_reintegrate_like;
   svn_boolean_t use_sleep = FALSE;
   svn_error_t *err;
@@ -12878,7 +12845,7 @@ do_automatic_merge_locked(svn_client__co
 
   if (reintegrate_like)
     {
-      merge_source_t source;
+      svn_client__merge_source_t source;
       svn_ra_session_t *base_ra_session = NULL;
       svn_ra_session_t *right_ra_session = NULL;
       svn_ra_session_t *target_ra_session = NULL;
@@ -12912,7 +12879,7 @@ do_automatic_merge_locked(svn_client__co
        * have not yet been merged in the opposite direction -- that a
        * 'reintegrate' merge would have rejected. */
       {
-        merge_source_t *source2;
+        svn_client__merge_source_t *source2;
 
         SVN_ERR(find_reintegrate_merge(&source2, NULL,
                                        right_ra_session, merge->right,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/util.c?rev=1922345&r1=1922344&r2=1922345&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/util.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/util.c 
Fri Dec  6 13:59:05 2024
@@ -136,6 +136,34 @@ svn_client__pathrev_fspath(const svn_cli
 }
 
 
+svn_client__merge_source_t *
+svn_client__merge_source_create(const svn_client__pathrev_t *loc1,
+                                const svn_client__pathrev_t *loc2,
+                                svn_boolean_t ancestral,
+                                apr_pool_t *result_pool)
+{
+  svn_client__merge_source_t *s
+    = apr_palloc(result_pool, sizeof(*s));
+
+  s->loc1 = svn_client__pathrev_dup(loc1, result_pool);
+  s->loc2 = svn_client__pathrev_dup(loc2, result_pool);
+  s->ancestral = ancestral;
+  return s;
+}
+
+svn_client__merge_source_t *
+svn_client__merge_source_dup(const svn_client__merge_source_t *source,
+                             apr_pool_t *result_pool)
+{
+  svn_client__merge_source_t *s = apr_palloc(result_pool, sizeof(*s));
+
+  s->loc1 = svn_client__pathrev_dup(source->loc1, result_pool);
+  s->loc2 = svn_client__pathrev_dup(source->loc2, result_pool);
+  s->ancestral = source->ancestral;
+  return s;
+}
+
+
 svn_client_commit_item3_t *
 svn_client_commit_item3_create(apr_pool_t *pool)
 {


Reply via email to