Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Tue Dec 13 09:49:29 
2022
@@ -6411,6 +6411,55 @@ resolve_postpone(svn_client_conflict_opt
   return SVN_NO_ERROR; /* Nothing to do. */
 }
 
+static svn_error_t *
+begin_resolve(const char **root_abspath_p,
+              const char *local_abspath,
+              svn_client_ctx_t *ctx,
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
+{
+  const char *lock_abspath;
+  svn_error_t *err;
+
+  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
+                                                 local_abspath,
+                                                 result_pool, scratch_pool));
+
+  /* This will open the RA session internally if needed. */
+  err = svn_client__textbase_sync(NULL, lock_abspath, TRUE, TRUE, ctx,
+                                  NULL, scratch_pool, scratch_pool);
+  if (err)
+    {
+      return svn_error_compose_create(
+               err,
+               svn_wc__release_write_lock(ctx->wc_ctx, lock_abspath,
+                                          scratch_pool));
+    }
+
+  *root_abspath_p = lock_abspath;
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+finish_resolve(const char *root_abspath,
+               svn_client_ctx_t *ctx,
+               svn_error_t *resolve_err,
+               apr_pool_t *scratch_pool)
+{
+  svn_error_t *err = resolve_err;
+
+  err = svn_error_compose_create(
+          err,
+          svn_client__textbase_sync(NULL, root_abspath, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
+  err = svn_error_compose_create(
+          err,
+          svn_wc__release_write_lock(ctx->wc_ctx, root_abspath, scratch_pool));
+
+  return err;
+}
+
 /* Implements conflict_option_resolve_func_t. */
 static svn_error_t *
 resolve_text_conflict(svn_client_conflict_option_t *option,
@@ -6428,9 +6477,8 @@ resolve_text_conflict(svn_client_conflic
   conflict_choice = conflict_option_id_to_wc_conflict_choice(option_id);
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
   err = svn_wc__conflict_text_mark_resolved(ctx->wc_ctx,
                                             local_abspath,
                                             conflict_choice,
@@ -6439,9 +6487,7 @@ resolve_text_conflict(svn_client_conflic
                                             ctx->notify_func2,
                                             ctx->notify_baton2,
                                             scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -6474,18 +6520,15 @@ resolve_prop_conflict(svn_client_conflic
   else
     merged_value = NULL;
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
   err = svn_wc__conflict_prop_mark_resolved(ctx->wc_ctx, local_abspath,
                                             propname, conflict_choice,
                                             merged_value,
                                             ctx->notify_func2,
                                             ctx->notify_baton2,
                                             scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -6550,9 +6593,8 @@ resolve_accept_current_wc_state(svn_clie
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   /* Resolve to current working copy state. */
   err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
@@ -6565,10 +6607,7 @@ resolve_accept_current_wc_state(svn_clie
                                            scratch_pool),
                       scratch_pool);
 
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = option_id;
 
@@ -6588,9 +6627,8 @@ resolve_update_break_moved_away(svn_clie
 
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
   err = svn_wc__conflict_tree_update_break_moved_away(ctx->wc_ctx,
                                                       local_abspath,
                                                       ctx->cancel_func,
@@ -6598,10 +6636,7 @@ resolve_update_break_moved_away(svn_clie
                                                       ctx->notify_func2,
                                                       ctx->notify_baton2,
                                                       scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = svn_client_conflict_option_get_id(option);
 
@@ -6621,9 +6656,8 @@ resolve_update_raise_moved_away(svn_clie
 
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
   err = svn_wc__conflict_tree_update_raise_moved_away(ctx->wc_ctx,
                                                       local_abspath,
                                                       ctx->cancel_func,
@@ -6631,10 +6665,7 @@ resolve_update_raise_moved_away(svn_clie
                                                       ctx->notify_func2,
                                                       ctx->notify_baton2,
                                                       scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = svn_client_conflict_option_get_id(option);
 
@@ -6654,9 +6685,8 @@ resolve_update_moved_away_node(svn_clien
 
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
   err = svn_wc__conflict_tree_update_moved_away_node(ctx->wc_ctx,
                                                      local_abspath,
                                                      ctx->cancel_func,
@@ -6664,9 +6694,7 @@ resolve_update_moved_away_node(svn_clien
                                                      ctx->notify_func2,
                                                      ctx->notify_baton2,
                                                      scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -6838,9 +6866,8 @@ resolve_incoming_add_ignore(svn_client_c
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
   operation = svn_client_conflict_get_operation(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   if (operation == svn_wc_operation_update)
     {
@@ -6865,10 +6892,7 @@ resolve_incoming_add_ignore(svn_client_c
                       scratch_pool);
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = svn_client_conflict_option_get_id(option);
 
@@ -6962,14 +6986,13 @@ resolve_merge_incoming_added_file_text_u
                          apr_hash_make(scratch_pool), scratch_pool));
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   /* Revert the path in order to restore the repository's line of
    * history, which is part of the BASE tree. This revert operation
    * is why are being careful about not losing the temporary copy. */
-  err = svn_wc_revert6(ctx->wc_ctx, local_abspath, svn_depth_empty,
+  err = svn_wc_revert7(ctx->wc_ctx, local_abspath, svn_depth_empty,
                        FALSE, NULL, TRUE, FALSE,
                        TRUE /*added_keep_local*/,
                        NULL, NULL, /* no cancellation */
@@ -6979,7 +7002,7 @@ resolve_merge_incoming_added_file_text_u
     goto unlock_wc;
 
   /* Perform the file merge. ### Merge into tempfile and then rename on top? */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, empty_file_abspath,
                       working_file_tmp_abspath, local_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -6997,10 +7020,7 @@ unlock_wc:
               err, _("If needed, a backup copy of '%s' can be found at '%s'"),
               svn_dirent_local_style(local_abspath, scratch_pool),
               svn_dirent_local_style(working_file_tmp_abspath, scratch_pool));
-  err = svn_error_compose_create(err,
-                                 svn_wc__release_write_lock(ctx->wc_ctx,
-                                                            lock_abspath,
-                                                            scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -7108,18 +7128,14 @@ resolve_merge_incoming_added_file_text_m
                          apr_hash_make(scratch_pool), scratch_pool));
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
-  /* Resolve to current working copy state. svn_wc_merge5() requires this. */
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
+  /* Resolve to current working copy state. svn_wc_merge6() requires this. */
   err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
   if (err)
-    return svn_error_compose_create(err,
-                                    svn_wc__release_write_lock(ctx->wc_ctx,
-                                                               lock_abspath,
-                                                               scratch_pool));
+    return finish_resolve(lock_abspath, ctx, err, scratch_pool);
   /* Perform the file merge. ### Merge into tempfile and then rename on top? */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, empty_file_abspath,
                       incoming_new_tmp_abspath, local_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -7130,9 +7146,7 @@ resolve_merge_incoming_added_file_text_m
                       NULL, NULL, /* conflict func/baton */
                       NULL, NULL, /* don't allow user to cancel here */
                       scratch_pool);
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -7247,9 +7261,8 @@ resolve_merge_incoming_added_file_replac
   /* Reset the stream in preparation for adding its content to WC. */
   SVN_ERR(svn_stream_reset(incoming_new_stream));
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   /* ### The following WC modifications should be atomic. */
 
@@ -7281,7 +7294,7 @@ resolve_merge_incoming_added_file_replac
       ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
     }
 
-  /* Resolve to current working copy state. svn_wc_merge5() requires this. */
+  /* Resolve to current working copy state. svn_wc_merge6() requires this. */
   err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
   if (err)
     goto unlock_wc;
@@ -7303,7 +7316,7 @@ resolve_merge_incoming_added_file_replac
     goto unlock_wc;
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, empty_file_abspath,
                       working_file_tmp_abspath, local_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -7334,9 +7347,7 @@ resolve_merge_incoming_added_file_replac
     }
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -7622,7 +7633,7 @@ merge_added_files(const char *local_absp
                          working_props, scratch_pool));
 
   /* Perform the file merge. */
-  SVN_ERR(svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  SVN_ERR(svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                         ctx->wc_ctx, empty_file_abspath,
                         incoming_added_file_abspath, local_abspath,
                         NULL, NULL, NULL, /* labels */
@@ -7908,9 +7919,8 @@ resolve_merge_incoming_added_dir_merge(s
     }
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   /* ### wrap in a transaction */
   err = merge_newly_added_dir(added_repos_relpath,
@@ -7921,9 +7931,7 @@ resolve_merge_incoming_added_dir_merge(s
   if (!err)
     err = svn_wc__del_tree_conflict(ctx->wc_ctx, local_abspath, scratch_pool);
 
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -7957,9 +7965,8 @@ resolve_update_incoming_added_dir_merge(
   if (local_change == svn_wc_conflict_reason_unversioned)
     {
       char *parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-      SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-                &lock_abspath, ctx->wc_ctx, parent_abspath,
-                scratch_pool, scratch_pool));
+      SVN_ERR(begin_resolve(&lock_abspath, parent_abspath, ctx,
+                            scratch_pool, scratch_pool));
 
       /* The update/switch operation has added the incoming versioned
        * directory as a deleted op-depth layer. We can revert this layer
@@ -7970,7 +7977,7 @@ resolve_update_incoming_added_dir_merge(
        * files with files from the repository is impossible because there is
        * no known merge base. No unversioned data will be lost, and any
        * differences to files in the repository will show up in 'svn diff'. */
-      err = svn_wc_revert6(ctx->wc_ctx, local_abspath, svn_depth_infinity,
+      err = svn_wc_revert7(ctx->wc_ctx, local_abspath, svn_depth_infinity,
                            FALSE, NULL, TRUE, TRUE /* metadata_only */,
                            TRUE /*added_keep_local*/,
                            NULL, NULL, /* no cancellation */
@@ -7979,9 +7986,8 @@ resolve_update_incoming_added_dir_merge(
     }
   else
     {
-      SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-                &lock_abspath, ctx->wc_ctx, local_abspath,
-                scratch_pool, scratch_pool));
+      SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                            scratch_pool, scratch_pool));
       err = svn_wc__conflict_tree_update_local_add(ctx->wc_ctx,
                                                    local_abspath,
                                                    ctx->cancel_func,
@@ -7991,10 +7997,7 @@ resolve_update_incoming_added_dir_merge(
                                                    scratch_pool);
     }
 
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -8041,11 +8044,10 @@ merge_incoming_added_dir_replace(svn_cli
 
   /* ### The following WC modifications should be atomic. */
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 svn_dirent_dirname(
-                                                   local_abspath,
-                                                   scratch_pool),
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_dirname(local_abspath,
+                                           scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   /* Remove the working directory. */
   err = svn_wc_delete4(ctx->wc_ctx, local_abspath, FALSE, FALSE,
@@ -8136,9 +8138,7 @@ merge_incoming_added_dir_replace(svn_cli
     }
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
+  err = finish_resolve(lock_abspath, ctx, err, scratch_pool);
   svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
   SVN_ERR(err);
 
@@ -8388,9 +8388,8 @@ resolve_incoming_delete_ignore(svn_clien
   option_id = svn_client_conflict_option_get_id(option);
   local_abspath = svn_client_conflict_get_local_abspath(conflict);
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 local_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, local_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   err = verify_local_state_for_incoming_delete(conflict, option, ctx,
                                                scratch_pool);
@@ -8409,10 +8408,7 @@ resolve_incoming_delete_ignore(svn_clien
                       scratch_pool);
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = option_id;
 
@@ -8437,9 +8433,8 @@ resolve_incoming_delete_accept(svn_clien
 
   /* Deleting a node requires a lock on the node's parent. */
   parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
-                                                 parent_abspath,
-                                                 scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath, parent_abspath, ctx,
+                        scratch_pool, scratch_pool));
 
   err = verify_local_state_for_incoming_delete(conflict, option, ctx,
                                                scratch_pool);
@@ -8478,10 +8473,7 @@ resolve_incoming_delete_accept(svn_clien
                       scratch_pool);
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   conflict->resolution_tree = option_id;
 
@@ -8616,12 +8608,11 @@ resolve_incoming_move_file_text_merge(sv
     merge_source_abspath = victim_abspath;
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   if (local_change != svn_wc_conflict_reason_missing)
     {
@@ -8739,7 +8730,7 @@ resolve_incoming_move_file_text_merge(sv
     SVN_ERR_MALFUNCTION();
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, ancestor_abspath,
                       incoming_abspath, moved_to_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -8817,10 +8808,7 @@ unlock_wc:
               err, _("If needed, a backup copy of '%s' can be found at '%s'"),
               svn_dirent_local_style(moved_to_abspath, scratch_pool),
               svn_dirent_local_style(incoming_abspath, scratch_pool));
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -8934,12 +8922,11 @@ resolve_both_moved_file_text_merge(svn_c
     APR_ARRAY_IDX(local_moves, local_details->wc_move_target_idx, const char 
*);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            local_moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        local_moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
    /* Get a copy of the incoming moved item's properties. */
   err = svn_wc_prop_list2(&incoming_props, ctx->wc_ctx,
@@ -8962,7 +8949,7 @@ resolve_both_moved_file_text_merge(svn_c
     goto unlock_wc;
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, ancestor_abspath,
                       incoming_moved_to_abspath, local_moved_to_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -8995,7 +8982,7 @@ resolve_both_moved_file_text_merge(svn_c
     }
 
   /* Revert local addition of the incoming move's target. */
-  err = svn_wc_revert6(ctx->wc_ctx, incoming_moved_to_abspath,
+  err = svn_wc_revert7(ctx->wc_ctx, incoming_moved_to_abspath,
                        svn_depth_infinity, FALSE, NULL, TRUE, FALSE,
                        FALSE /*added_keep_local*/,
                        NULL, NULL, /* no cancellation */
@@ -9022,10 +9009,7 @@ resolve_both_moved_file_text_merge(svn_c
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -9109,12 +9093,11 @@ resolve_both_moved_dir_merge(svn_client_
     APR_ARRAY_IDX(local_moves, local_details->wc_move_target_idx, const char 
*);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            local_moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        local_moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   /* Perform the merge. */
   incoming_old_url = apr_pstrcat(scratch_pool, repos_root_url, "/",
@@ -9143,7 +9126,7 @@ resolve_both_moved_dir_merge(svn_client_
     goto unlock_wc;
 
   /* Revert local addition of the incoming move's target. */
-  err = svn_wc_revert6(ctx->wc_ctx, incoming_moved_to_abspath,
+  err = svn_wc_revert7(ctx->wc_ctx, incoming_moved_to_abspath,
                        svn_depth_infinity, FALSE, NULL, TRUE, FALSE,
                        FALSE /*added_keep_local*/,
                        NULL, NULL, /* no cancellation */
@@ -9170,10 +9153,7 @@ resolve_both_moved_dir_merge(svn_client_
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -9258,15 +9238,14 @@ resolve_both_moved_dir_move_merge(svn_cl
     APR_ARRAY_IDX(local_moves, local_details->wc_move_target_idx, const char 
*);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            local_moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        local_moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   /* Revert the incoming move target directory. */
-  err = svn_wc_revert6(ctx->wc_ctx, incoming_moved_to_abspath,
+  err = svn_wc_revert7(ctx->wc_ctx, incoming_moved_to_abspath,
                        svn_depth_infinity,
                        FALSE, NULL, TRUE, FALSE,
                        TRUE /*added_keep_local*/,
@@ -9332,10 +9311,7 @@ resolve_both_moved_dir_move_merge(svn_cl
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -9420,12 +9396,11 @@ resolve_incoming_move_dir_merge(svn_clie
 
   /* ### The following WC modifications should be atomic. */
 
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(local_abspath,
-                                            moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(local_abspath,
+                                                        moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   err = svn_wc__node_get_origin(&is_copy, &moved_to_peg_rev,
                                 &moved_to_repos_relpath,
@@ -9470,7 +9445,7 @@ resolve_incoming_move_dir_merge(svn_clie
       svn_opt_revision_t incoming_new_opt_rev;
 
       /* Revert the incoming move target directory. */
-      err = svn_wc_revert6(ctx->wc_ctx, moved_to_abspath, svn_depth_infinity,
+      err = svn_wc_revert7(ctx->wc_ctx, moved_to_abspath, svn_depth_infinity,
                            FALSE, NULL, TRUE, FALSE,
                            TRUE /*added_keep_local*/,
                            NULL, NULL, /* no cancellation */
@@ -9564,10 +9539,7 @@ resolve_incoming_move_dir_merge(svn_clie
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -9689,15 +9661,14 @@ resolve_local_move_file_merge(svn_client
                          scratch_pool));
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(conflict->local_abspath,
-                                            merge_target_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        
svn_dirent_get_longest_ancestor(conflict->local_abspath,
+                                                        merge_target_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx,
                       ancestor_tmp_abspath, incoming_tmp_abspath,
                       merge_target_abspath,
@@ -9712,19 +9683,11 @@ resolve_local_move_file_merge(svn_client
                       scratch_pool);
   svn_io_sleep_for_timestamps(merge_target_abspath, scratch_pool);
   if (err)
-    return svn_error_compose_create(err,
-                                    svn_wc__release_write_lock(ctx->wc_ctx,
-                                                               lock_abspath,
-                                                               scratch_pool));
+    return finish_resolve(lock_abspath, ctx, err, scratch_pool);
 
   err = svn_wc__del_tree_conflict(ctx->wc_ctx, conflict->local_abspath,
                                   scratch_pool);
-  err = svn_error_compose_create(err,
-                                 svn_wc__release_write_lock(ctx->wc_ctx,
-                                                            lock_abspath,
-                                                            scratch_pool));
-  if (err)
-    return svn_error_trace(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   if (ctx->notify_func2)
     {
@@ -9805,12 +9768,11 @@ resolve_local_move_dir_merge(svn_client_
                                          const char *);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(conflict->local_abspath,
-                                            merge_target_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        
svn_dirent_get_longest_ancestor(conflict->local_abspath,
+                                                        merge_target_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
   /* Resolve to current working copy state.
    * svn_client__merge_locked() requires this. */
@@ -9841,12 +9803,7 @@ resolve_local_move_dir_merge(svn_client_
                                  NULL, ctx, scratch_pool, scratch_pool);
 unlock_wc:
   svn_io_sleep_for_timestamps(merge_target_abspath, scratch_pool);
-  err = svn_error_compose_create(err,
-                                 svn_wc__release_write_lock(ctx->wc_ctx,
-                                                            lock_abspath,
-                                                            scratch_pool));
-  if (err)
-    return svn_error_trace(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   if (ctx->notify_func2)
     {
@@ -11232,12 +11189,11 @@ resolve_both_moved_file_update_keep_loca
                   local_details->preferred_move_target_idx, const char *);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            local_moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        local_moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
    /* Get a copy of the incoming moved item's properties. */
   err = svn_wc_prop_list2(&incoming_props, ctx->wc_ctx,
@@ -11260,7 +11216,7 @@ resolve_both_moved_file_update_keep_loca
     goto unlock_wc;
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, ancestor_abspath,
                       incoming_moved_to_abspath, local_moved_to_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -11326,10 +11282,7 @@ resolve_both_moved_file_update_keep_loca
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -11443,12 +11396,11 @@ resolve_both_moved_file_update_keep_inco
                   local_details->preferred_move_target_idx, const char *);
 
   /* ### The following WC modifications should be atomic. */
-  SVN_ERR(svn_wc__acquire_write_lock_for_resolve(
-            &lock_abspath, ctx->wc_ctx,
-            svn_dirent_get_longest_ancestor(victim_abspath,
-                                            local_moved_to_abspath,
-                                            scratch_pool),
-            scratch_pool, scratch_pool));
+  SVN_ERR(begin_resolve(&lock_abspath,
+                        svn_dirent_get_longest_ancestor(victim_abspath,
+                                                        local_moved_to_abspath,
+                                                        scratch_pool),
+                        ctx, scratch_pool, scratch_pool));
 
    /* Get a copy of the incoming moved item's properties. */
   err = svn_wc_prop_list2(&incoming_props, ctx->wc_ctx,
@@ -11471,7 +11423,7 @@ resolve_both_moved_file_update_keep_inco
     goto unlock_wc;
 
   /* Perform the file merge. */
-  err = svn_wc_merge5(&merge_content_outcome, &merge_props_outcome,
+  err = svn_wc_merge6(&merge_content_outcome, &merge_props_outcome,
                       ctx->wc_ctx, ancestor_abspath,
                       local_moved_to_abspath, incoming_moved_to_abspath,
                       NULL, NULL, NULL, /* labels */
@@ -11505,7 +11457,7 @@ resolve_both_moved_file_update_keep_inco
 
   /* Revert the copy-half of the local move. The delete-half of this move
    * has already been deleted during the update/switch operation. */
-  err = svn_wc_revert6(ctx->wc_ctx, local_moved_to_abspath, svn_depth_empty,
+  err = svn_wc_revert7(ctx->wc_ctx, local_moved_to_abspath, svn_depth_empty,
                        FALSE, NULL, TRUE, FALSE,
                        TRUE /*added_keep_local*/,
                        NULL, NULL, /* no cancellation */
@@ -11532,10 +11484,7 @@ resolve_both_moved_file_update_keep_inco
   conflict->resolution_tree = option_id;
 
 unlock_wc:
-  err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
-                                                                 lock_abspath,
-                                                                 
scratch_pool));
-  SVN_ERR(err);
+  SVN_ERR(finish_resolve(lock_abspath, ctx, err, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Tue Dec 13 09:49:29 2022
@@ -2488,6 +2488,7 @@ svn_client__repos_to_wc_copy_dir(svn_boo
                                         TRUE /*ignore_externals*/,
                                         FALSE, /* we don't allow obstructions 
*/
                                         NULL, /* default WC format */
+                                        svn_tristate_unknown,
                                         ra_session, ctx, scratch_pool);
 
     ctx->notify_func2 = old_notify_func2;

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Tue Dec 13 09:49:29 
2022
@@ -2683,7 +2683,8 @@ svn_client_checkout3(svn_revnum_t *resul
   return svn_error_trace(svn_client_checkout4(
                              result_rev, URL, path,
                              peg_revision, revision, depth,
-                             ignore_externals, FALSE, NULL, ctx, pool));
+                             ignore_externals, FALSE, NULL,
+                             svn_tristate_unknown, ctx, pool));
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Tue Dec 13 09:49:29 2022
@@ -1866,12 +1866,20 @@ diff_wc_wc(const char *path1,
                           "or between the working versions of two paths"
                           )));
 
+  /* This will open the RA session internally if needed. */
+  SVN_ERR(svn_client__textbase_sync(NULL, abspath1, TRUE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   SVN_ERR(svn_wc__diff7(TRUE,
                         ctx->wc_ctx, abspath1, depth,
                         ignore_ancestry, changelists,
                         diff_processor,
                         ctx->cancel_func, ctx->cancel_baton,
                         result_pool, scratch_pool));
+
+  SVN_ERR(svn_client__textbase_sync(NULL, abspath1, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -2269,6 +2277,9 @@ diff_repos_wc(struct diff_driver_info_t
   if (reverse)
     diff_processor = svn_diff__tree_processor_reverse_create(diff_processor, 
scratch_pool);
 
+  SVN_ERR(svn_client__textbase_sync(NULL, abspath2, TRUE, TRUE, ctx,
+                                    ra_session, scratch_pool, scratch_pool));
+
   /* Use the diff editor to generate the diff. */
   SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
                                 SVN_RA_CAPABILITY_DEPTH, scratch_pool));
@@ -2330,7 +2341,7 @@ diff_repos_wc(struct diff_driver_info_t
     {
       /* Create a txn mirror of path2;  the diff editor will print
          diffs in reverse.  :-)  */
-      SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, abspath2,
+      SVN_ERR(svn_wc_crawl_revisions6(ctx->wc_ctx, abspath2,
                                       reporter, reporter_baton,
                                       FALSE, depth, TRUE,
                                       (! server_supports_depth),
@@ -2340,6 +2351,9 @@ diff_repos_wc(struct diff_driver_info_t
                                       scratch_pool));
     }
 
+  SVN_ERR(svn_client__textbase_sync(NULL, abspath2, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_client/export.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c (original)
+++ subversion/trunk/subversion/libsvn_client/export.c Tue Dec 13 09:49:29 2022
@@ -321,7 +321,7 @@ export_node(void *baton,
 
          We get all this for free from evaluating SOURCE == NULL:
        */
-      SVN_ERR(svn_wc_get_pristine_contents2(&source, wc_ctx, local_abspath,
+      SVN_ERR(svn_wc_get_pristine_contents3(&source, wc_ctx, local_abspath,
                                             scratch_pool, scratch_pool));
       if (source == NULL)
         return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Tue Dec 13 09:49:29 
2022
@@ -413,6 +413,7 @@ switch_dir_external(const char *local_ab
                                         revision, svn_depth_infinity,
                                         FALSE, FALSE,
                                         NULL, /* default WC format */
+                                        svn_tristate_unknown,
                                         ra_session,
                                         ctx, pool));
 

Modified: subversion/trunk/subversion/libsvn_client/layout.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/layout.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/layout.c (original)
+++ subversion/trunk/subversion/libsvn_client/layout.c Tue Dec 13 09:49:29 2022
@@ -275,7 +275,7 @@ svn_client__layout_list(const char *loca
 
   /* Drive the reporter structure, describing the revisions within
      LOCAL_ABSPATH.  */
-  SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath,
+  SVN_ERR(svn_wc_crawl_revisions6(ctx->wc_ctx, local_abspath,
                                   &layout_reporter, &lb,
                                   FALSE /* restore_files */,
                                   svn_depth_infinity,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Dec 13 09:49:29 2022
@@ -2126,7 +2126,7 @@ merge_file_changed(const char *relpath,
     }
 
   /* This callback is essentially no more than a wrapper around
-     svn_wc_merge5().  Thank goodness that all the
+     svn_wc_merge6().  Thank goodness that all the
      diff-editor-mechanisms are doing the hard work of getting the
      fulltexts! */
 
@@ -2204,7 +2204,7 @@ merge_file_changed(const char *relpath,
 
       /* Do property merge and text merge in one step so that keyword expansion
          takes into account the new property values. */
-      SVN_ERR(svn_wc_merge5(&content_outcome, &property_state, ctx->wc_ctx,
+      SVN_ERR(svn_wc_merge6(&content_outcome, &property_state, ctx->wc_ctx,
                             left_file, right_file, local_abspath,
                             left_label, right_label, target_label,
                             left, right,

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Tue Dec 13 09:49:29 2022
@@ -1086,7 +1086,7 @@ svn_client__ra_provide_base(svn_stream_t
       return SVN_NO_ERROR;
     }
 
-  err = svn_wc_get_pristine_contents2(contents, reb->wc_ctx, local_abspath,
+  err = svn_wc_get_pristine_contents3(contents, reb->wc_ctx, local_abspath,
                                       result_pool, scratch_pool);
   if (err)
     {

Modified: subversion/trunk/subversion/libsvn_client/resolved.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/resolved.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/resolved.c (original)
+++ subversion/trunk/subversion/libsvn_client/resolved.c Tue Dec 13 09:49:29 
2022
@@ -53,6 +53,7 @@ svn_client__resolve_conflicts(svn_boolea
 {
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
   apr_array_header_t *array;
+  svn_ra_session_t *ra_session;
   int i;
 
   if (conflicts_remain)
@@ -61,11 +62,17 @@ svn_client__resolve_conflicts(svn_boolea
   SVN_ERR(svn_hash_keys(&array, conflicted_paths, scratch_pool));
   svn_sort__array(array, svn_sort_compare_paths);
 
+  ra_session = NULL;
   for (i = 0; i < array->nelts; i++)
     {
       const char *local_abspath = APR_ARRAY_IDX(array, i, const char *);
 
       svn_pool_clear(iterpool);
+
+      SVN_ERR(svn_client__textbase_sync(&ra_session, local_abspath,
+                                        TRUE, TRUE, ctx, ra_session,
+                                        scratch_pool, iterpool));
+
       SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, local_abspath,
                                         svn_depth_empty,
                                         TRUE /* resolve_text */,
@@ -98,12 +105,45 @@ svn_client__resolve_conflicts(svn_boolea
           if (text_c || prop_c || tree_c)
             *conflicts_remain = TRUE;
         }
+
+      SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, FALSE, TRUE, ctx,
+                                        NULL, iterpool, iterpool));
     }
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+resolve_locked(const char *local_abspath,
+               const char *root_abspath,
+               svn_depth_t depth,
+               svn_wc_conflict_choice_t conflict_choice,
+               svn_client_ctx_t *ctx,
+               apr_pool_t *scratch_pool)
+{
+  /* This will open the RA session internally if needed. */
+  SVN_ERR(svn_client__textbase_sync(NULL, root_abspath, TRUE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, local_abspath,
+                                    depth,
+                                    TRUE /* resolve_text */,
+                                    "" /* resolve_prop (ALL props) */,
+                                    TRUE /* resolve_tree */,
+                                    conflict_choice,
+                                    ctx->conflict_func2,
+                                    ctx->conflict_baton2,
+                                    ctx->cancel_func, ctx->cancel_baton,
+                                    ctx->notify_func2, ctx->notify_baton2,
+                                    scratch_pool));
+
+  SVN_ERR(svn_client__textbase_sync(NULL, root_abspath, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_client_resolve(const char *path,
                    svn_depth_t depth,
@@ -126,17 +166,9 @@ svn_client_resolve(const char *path,
 
   SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, ctx->wc_ctx,
                                                  local_abspath, pool, pool));
-  err = svn_wc__resolve_conflicts(ctx->wc_ctx, local_abspath,
-                                  depth,
-                                  TRUE /* resolve_text */,
-                                  "" /* resolve_prop (ALL props) */,
-                                  TRUE /* resolve_tree */,
-                                  conflict_choice,
-                                  ctx->conflict_func2,
-                                  ctx->conflict_baton2,
-                                  ctx->cancel_func, ctx->cancel_baton,
-                                  ctx->notify_func2, ctx->notify_baton2,
-                                  pool);
+
+  err = resolve_locked(local_abspath, lock_abspath, depth,
+                       conflict_choice, ctx, pool);
 
   err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
                                                                  lock_abspath,

Modified: subversion/trunk/subversion/libsvn_client/revert.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/revert.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/revert.c (original)
+++ subversion/trunk/subversion/libsvn_client/revert.c Tue Dec 13 09:49:29 2022
@@ -53,11 +53,12 @@ struct revert_with_write_lock_baton {
   svn_boolean_t metadata_only;
   svn_boolean_t added_keep_local;
   svn_client_ctx_t *ctx;
+  svn_ra_session_t **ra_session_p;
 };
 
 /* (Note: All arguments are in the baton above.)
 
-   Attempt to revert LOCAL_ABSPATH by calling svn_wc_revert6(), which
+   Attempt to revert LOCAL_ABSPATH by calling svn_wc_revert7(), which
    see for further details.
 
    If the target isn't versioned, send a 'skip' notification and return
@@ -69,7 +70,11 @@ revert(void *baton, apr_pool_t *result_p
   struct revert_with_write_lock_baton *b = baton;
   svn_error_t *err;
 
-  err = svn_wc_revert6(b->ctx->wc_ctx,
+  SVN_ERR(svn_client__textbase_sync(b->ra_session_p, b->local_abspath,
+                                    TRUE, TRUE, b->ctx, *b->ra_session_p,
+                                    result_pool, scratch_pool));
+
+  err = svn_wc_revert7(b->ctx->wc_ctx,
                        b->local_abspath,
                        b->depth,
                        b->use_commit_times,
@@ -108,6 +113,9 @@ revert(void *baton, apr_pool_t *result_p
         return svn_error_trace(err);
     }
 
+  SVN_ERR(svn_client__textbase_sync(NULL, b->local_abspath, FALSE, TRUE, 
b->ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -128,6 +136,7 @@ svn_client_revert4(const apr_array_heade
   svn_config_t *cfg;
   svn_boolean_t use_commit_times;
   struct revert_with_write_lock_baton baton;
+  svn_ra_session_t *ra_session;
 
   /* Don't even attempt to modify the working copy if any of the
    * targets look like URLs. URLs are invalid input. */
@@ -150,7 +159,7 @@ svn_client_revert4(const apr_array_heade
                               FALSE));
 
   iterpool = svn_pool_create(pool);
-
+  ra_session = NULL;
   for (i = 0; i < paths->nelts; i++)
     {
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
@@ -176,6 +185,7 @@ svn_client_revert4(const apr_array_heade
       baton.metadata_only = metadata_only;
       baton.added_keep_local = added_keep_local;
       baton.ctx = ctx;
+      baton.ra_session_p = &ra_session;
 
       err = svn_wc__is_wcroot(&wc_root, ctx->wc_ctx, local_abspath, iterpool);
       if (err)
@@ -184,7 +194,7 @@ svn_client_revert4(const apr_array_heade
                             : svn_dirent_dirname(local_abspath, pool);
       err = svn_wc__call_with_write_lock(revert, &baton, ctx->wc_ctx,
                                          lock_target, FALSE,
-                                         iterpool, iterpool);
+                                         pool, iterpool);
       if (err)
         goto errorful;
     }

Modified: subversion/trunk/subversion/libsvn_client/shelf.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/shelf.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/shelf.c (original)
+++ subversion/trunk/subversion/libsvn_client/shelf.c Tue Dec 13 09:49:29 2022
@@ -26,6 +26,9 @@
 /* We define this here to remove any further warnings about the usage of
    experimental functions in this file. */
 #define SVN_EXPERIMENTAL
+/* We currently allow using deprecated functions in this experimental
+   context. */
+#define SVN_DEPRECATED
 
 #include "svn_client.h"
 #include "svn_wc.h"
@@ -1034,6 +1037,7 @@ shelf_copy_base(svn_client__shelf_versio
                                         TRUE /*ignore_externals*/,
                                         FALSE /*allow_unver_obstructions*/,
                                         NULL, /* default WC format */
+                                        svn_tristate_unknown,
                                         ra_session,
                                         ctx, scratch_pool));
   /* ### hopefully we won't eventually need to sleep_here... */

Modified: subversion/trunk/subversion/libsvn_client/shelf2.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/shelf2.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/shelf2.c (original)
+++ subversion/trunk/subversion/libsvn_client/shelf2.c Tue Dec 13 09:49:29 2022
@@ -26,6 +26,9 @@
 /* We define this here to remove any further warnings about the usage of
    experimental functions in this file. */
 #define SVN_EXPERIMENTAL
+/* We currently allow using deprecated functions in this experimental
+   context. */
+#define SVN_DEPRECATED
 
 #include "svn_client.h"
 #include "svn_wc.h"

Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Tue Dec 13 09:49:29 2022
@@ -637,7 +637,7 @@ svn_client_status6(svn_revnum_t *result_
              within PATH.  When we call reporter->finish_report,
              EDITOR will be driven to describe differences between our
              working copy and HEAD. */
-          SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx,
+          SVN_ERR(svn_wc_crawl_revisions6(ctx->wc_ctx,
                                           target_abspath,
                                           &lock_fetch_reporter, &rb,
                                           FALSE /* restore_files */,

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Tue Dec 13 09:49:29 2022
@@ -297,6 +297,9 @@ switch_internal(svn_revnum_t *result_rev
 
   SVN_ERR(svn_ra_reparent(ra_session, anchor_url, pool));
 
+  SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, TRUE, TRUE, ctx,
+                                    ra_session, pool, pool));
+
   /* Fetch the switch (update) editor.  If REVISION is invalid, that's
      okay; the RA driver will call editor->set_target_revision() later on. */
   SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
@@ -340,7 +343,7 @@ switch_internal(svn_revnum_t *result_rev
   /* Drive the reporter structure, describing the revisions within
      LOCAL_ABSPATH.  When this calls reporter->finish_report, the
      reporter will drive the switch_editor. */
-  SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
+  SVN_ERR(svn_wc_crawl_revisions6(ctx->wc_ctx, local_abspath, reporter,
                                   report_baton, TRUE,
                                   depth, (! depth_is_sticky),
                                   (! server_supports_depth),
@@ -369,6 +372,9 @@ switch_internal(svn_revnum_t *result_rev
                                            ctx, pool));
     }
 
+  SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, FALSE, TRUE, ctx,
+                                    NULL, pool, pool));
+
   /* Let everyone know we're finished here. */
   if (ctx->notify_func2)
     {

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Tue Dec 13 09:49:29 2022
@@ -471,6 +471,9 @@ update_internal(svn_revnum_t *result_rev
                            anchor_abspath, ctx, result_pool, scratch_pool));
   ra_session = *ra_session_p;
 
+  SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, TRUE, TRUE, ctx,
+                                    ra_session, scratch_pool, scratch_pool));
+
   /* If we got a corrected URL from the RA subsystem, we'll need to
      relocate our working copy first. */
   if (corrected_url)
@@ -557,7 +560,7 @@ update_internal(svn_revnum_t *result_rev
   /* Drive the reporter structure, describing the revisions within
      LOCAL_ABSPATH.  When this calls reporter->finish_report, the
      reporter will drive the update_editor. */
-  SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
+  SVN_ERR(svn_wc_crawl_revisions6(ctx->wc_ctx, local_abspath, reporter,
                                   report_baton, TRUE,
                                   depth, (! depth_is_sticky),
                                   (! server_supports_depth),
@@ -576,6 +579,9 @@ update_internal(svn_revnum_t *result_rev
                                repos_root_url, ra_session, ctx, scratch_pool));
     }
 
+  SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   /* Let everyone know we're finished here (unless we're asked not to). */
   if (ctx->notify_func2 && notify_summary)
     {

Modified: subversion/trunk/subversion/libsvn_client/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/upgrade.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_client/upgrade.c Tue Dec 13 09:49:29 2022
@@ -93,12 +93,14 @@ static svn_error_t *
 upgrade_externals_from_properties(svn_client_ctx_t *ctx,
                                   const char *local_abspath,
                                   int wc_format,
+                                  svn_boolean_t store_pristine,
                                   struct repos_info_baton *info_baton,
                                   apr_pool_t *scratch_pool);
 
 static svn_error_t *
 upgrade_internal(const char *path,
                  int wc_format,
+                 svn_boolean_t store_pristine,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *scratch_pool)
 {
@@ -116,7 +118,8 @@ upgrade_internal(const char *path,
                              _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
-  SVN_ERR(svn_wc__upgrade(ctx->wc_ctx, local_abspath, wc_format,
+  SVN_ERR(svn_wc__upgrade(ctx->wc_ctx, local_abspath,
+                          wc_format, store_pristine,
                           fetch_repos_info, &info_baton,
                           ctx->cancel_func, ctx->cancel_baton,
                           ctx->notify_func2, ctx->notify_baton2,
@@ -155,7 +158,8 @@ upgrade_internal(const char *path,
           if (kind == svn_node_dir)
             {
               svn_error_t *err = upgrade_internal(ext_abspath, wc_format,
-                                                  ctx, iterpool);
+                                                  store_pristine, ctx,
+                                                  iterpool);
 
               if (err)
                 {
@@ -179,9 +183,14 @@ upgrade_internal(const char *path,
       /* Upgrading from <= 1.6, or no svn:properties defined.
          (There is no way to detect the difference from libsvn_client :( ) */
 
-      SVN_ERR(upgrade_externals_from_properties(ctx, local_abspath, wc_format,
+      SVN_ERR(upgrade_externals_from_properties(ctx, local_abspath,
+                                                wc_format, store_pristine,
                                                 &info_baton, scratch_pool));
     }
+
+  SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, FALSE, TRUE, ctx,
+                                    NULL, scratch_pool, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -196,7 +205,7 @@ svn_client_upgrade2(const char *path,
   SVN_ERR(svn_wc__format_from_version(&wc_format,
                                       wc_format_version,
                                       scratch_pool));
-  SVN_ERR(upgrade_internal(path, wc_format, ctx, scratch_pool));
+  SVN_ERR(upgrade_internal(path, wc_format, TRUE, ctx, scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -265,10 +274,21 @@ svn_client_latest_wc_version(apr_pool_t
   return &version;
 }
 
+const svn_version_t *
+svn_client__compatible_wc_version_optional_pristine(apr_pool_t *result_pool)
+{
+  /* NOTE: For consistency, always return the version of the client
+     that first introduced the format. */
+  static const svn_version_t version = { 1, 15, 0, NULL };
+  return &version;
+}
+
 /* Helper for upgrade_externals_from_properties: upgrades one external ITEM
    in EXTERNALS_PARENT. Uses SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-upgrade_external_item(svn_client_ctx_t *ctx, int wc_format,
+upgrade_external_item(svn_client_ctx_t *ctx,
+                      int wc_format,
+                      svn_boolean_t store_pristine,
                       const char *externals_parent_abspath,
                       const char *externals_parent_url,
                       const char *externals_parent_repos_root_url,
@@ -311,7 +331,8 @@ upgrade_external_item(svn_client_ctx_t *
     {
       svn_error_clear(err);
 
-      SVN_ERR(upgrade_internal(external_abspath, wc_format, ctx, 
scratch_pool));
+      SVN_ERR(upgrade_internal(external_abspath, wc_format, store_pristine,
+                               ctx, scratch_pool));
     }
   else if (err)
     return svn_error_trace(err);
@@ -385,6 +406,7 @@ static svn_error_t *
 upgrade_externals_from_properties(svn_client_ctx_t *ctx,
                                   const char *local_abspath,
                                   int wc_format,
+                                  svn_boolean_t store_pristine,
                                   struct repos_info_baton *info_baton,
                                   apr_pool_t *scratch_pool)
 {
@@ -473,7 +495,7 @@ upgrade_externals_from_properties(svn_cl
           item = APR_ARRAY_IDX(externals_p, i, svn_wc_external_item2_t*);
 
           svn_pool_clear(inner_iterpool);
-          err = upgrade_external_item(ctx, wc_format,
+          err = upgrade_external_item(ctx, wc_format, store_pristine,
                                       externals_parent_abspath,
                                       externals_parent_url,
                                       externals_parent_repos_root_url,

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Tue Dec 13 09:49:29 2022
@@ -426,7 +426,7 @@ fetch_base_func(const char **filename,
     }
 
   /* Reads the pristine of WORKING, not of BASE */
-  err = svn_wc_get_pristine_contents2(&pristine_stream, scb->wc_ctx,
+  err = svn_wc_get_pristine_contents3(&pristine_stream, scb->wc_ctx,
                                       local_abspath, scratch_pool,
                                       scratch_pool);
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)

Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
  Merged 
/subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_fs_x:r1897945-1905954

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Tue Dec 13 09:49:29 2022
@@ -1369,6 +1369,18 @@ svn_ra_get_inherited_props(svn_ra_sessio
 }
 
 svn_error_t *
+svn_ra_fetch_file_contents(svn_ra_session_t *session,
+                           const char *path,
+                           svn_revnum_t revision,
+                           svn_stream_t *stream,
+                           apr_pool_t *scratch_pool)
+{
+  SVN_ERR_ASSERT(svn_relpath_is_canonical(path));
+  return session->vtable->fetch_file_contents(session, path, revision, stream,
+                                              scratch_pool);
+}
+
+svn_error_t *
 svn_ra__get_commit_ev2(svn_editor_t **editor,
                        svn_ra_session_t *session,
                        apr_hash_t *revprop_table,

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.h?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.h Tue Dec 13 09:49:29 2022
@@ -345,6 +345,13 @@ typedef struct svn_ra__vtable_t {
                        void *receiver_baton,
                        apr_pool_t *scratch_pool);
 
+  /* See svn_ra_fetch_file_contents(). */
+  svn_error_t *(*fetch_file_contents)(svn_ra_session_t *session,
+                                      const char *path,
+                                      svn_revnum_t revision,
+                                      svn_stream_t *stream,
+                                      apr_pool_t *scratch_pool);
+
   /* Experimental support below here */
 
   /* See svn_ra__register_editor_shim_callbacks() */

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Tue Dec 13 09:49:29 
2022
@@ -1255,13 +1255,13 @@ get_node_props(apr_hash_t **props,
 
 /* Getting just one file. */
 static svn_error_t *
-svn_ra_local__get_file(svn_ra_session_t *session,
-                       const char *path,
-                       svn_revnum_t revision,
-                       svn_stream_t *stream,
-                       svn_revnum_t *fetched_rev,
-                       apr_hash_t **props,
-                       apr_pool_t *pool)
+get_file(svn_ra_session_t *session,
+         const char *path,
+         svn_revnum_t revision,
+         svn_stream_t *stream,
+         svn_revnum_t *fetched_rev,
+         apr_hash_t **props,
+         apr_pool_t *pool)
 {
   svn_fs_root_t *root;
   svn_stream_t *contents;
@@ -1306,11 +1306,8 @@ svn_ra_local__get_file(svn_ra_session_t
          stored checksum, and all we're doing here is writing bytes in
          a loop.  Truly, Nothing Can Go Wrong :-).  But RA layers that
          go over a network should confirm the checksum.
-
-         Note: we are not supposed to close the passed-in stream, so
-         disown the thing.
       */
-      SVN_ERR(svn_stream_copy3(contents, svn_stream_disown(stream, pool),
+      SVN_ERR(svn_stream_copy3(contents, stream,
                                sess->callbacks
                                  ? sess->callbacks->cancel_func : NULL,
                                sess->callback_baton,
@@ -1866,6 +1863,38 @@ svn_ra_local__list(svn_ra_session_t *ses
                                         sess->callback_baton, pool));
 }
 
+static svn_error_t *
+svn_ra_local__get_file(svn_ra_session_t *session,
+                       const char *path,
+                       svn_revnum_t revision,
+                       svn_stream_t *stream,
+                       svn_revnum_t *fetched_rev,
+                       apr_hash_t **props,
+                       apr_pool_t *pool)
+{
+  /* We are not supposed to close the passed-in stream, so disown it. */
+  if (stream)
+    stream = svn_stream_disown(stream, pool);
+
+  SVN_ERR(get_file(session, path, revision, stream, fetched_rev,
+                   props, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+svn_ra_local__fetch_file_contents(svn_ra_session_t *session,
+                                  const char *path,
+                                  svn_revnum_t revision,
+                                  svn_stream_t *stream,
+                                  apr_pool_t *scratch_pool)
+{
+  SVN_ERR(get_file(session, path, revision, stream, NULL,
+                   NULL, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /*----------------------------------------------------------------*/
 
 static const svn_version_t *
@@ -1917,6 +1946,7 @@ static const svn_ra__vtable_t ra_local_v
   svn_ra_local__get_inherited_props,
   NULL /* set_svn_ra_open */,
   svn_ra_local__list ,
+  svn_ra_local__fetch_file_contents,
   svn_ra_local__register_editor_shim_callbacks,
   svn_ra_local__get_commit_ev2,
   NULL /* replay_range_ev2 */

Modified: subversion/trunk/subversion/libsvn_ra_serf/get_file.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/get_file.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/get_file.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/get_file.c Tue Dec 13 09:49:29 
2022
@@ -428,3 +428,59 @@ svn_ra_serf__get_file(svn_ra_session_t *
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_ra_serf__fetch_file_contents(svn_ra_session_t *ra_session,
+                                 const char *path,
+                                 svn_revnum_t revision,
+                                 svn_stream_t *stream,
+                                 apr_pool_t *scratch_pool)
+{
+  svn_ra_serf__session_t *session = ra_session->priv;
+  const char *fetch_url;
+  stream_ctx_t *stream_ctx;
+  svn_ra_serf__handler_t *handler;
+  svn_error_t *err;
+
+  fetch_url = svn_path_url_add_component2(session->session_url.path, path,
+                                          scratch_pool);
+
+  SVN_ERR(svn_ra_serf__get_stable_url(&fetch_url, NULL, session,
+                                      fetch_url, revision,
+                                      scratch_pool, scratch_pool));
+
+  /* Create the fetch context. */
+  stream_ctx = apr_pcalloc(scratch_pool, sizeof(*stream_ctx));
+  stream_ctx->result_stream = stream;
+  stream_ctx->session = session;
+
+  handler = svn_ra_serf__create_handler(session, scratch_pool);
+
+  handler->method = "GET";
+  handler->path = fetch_url;
+
+  handler->custom_accept_encoding = TRUE;
+  handler->no_dav_headers = TRUE;
+
+  handler->header_delegate = headers_fetch;
+  handler->header_delegate_baton = stream_ctx;
+
+  handler->response_handler = handle_stream;
+  handler->response_baton = stream_ctx;
+
+  handler->response_error = cancel_fetch;
+  handler->response_error_baton = stream_ctx;
+
+  stream_ctx->handler = handler;
+
+  err = svn_ra_serf__context_run_one(handler, scratch_pool);
+
+  err = svn_error_compose_create(err, svn_stream_close(stream));
+
+  if (err)
+    return svn_error_trace(err);
+  else if (handler->sline.code != 200)
+    return svn_error_trace(svn_ra_serf__unexpected_status(handler));
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Tue Dec 13 09:49:29 
2022
@@ -1511,6 +1511,14 @@ svn_error_t *
 svn_ra_serf__register_editor_shim_callbacks(svn_ra_session_t *session,
                                     svn_delta_shim_callbacks_t *callbacks);
 
+/* Implements svn_ra__vtable_t.fetch_file_contents(). */
+svn_error_t *
+svn_ra_serf__fetch_file_contents(svn_ra_session_t *session,
+                                 const char *path,
+                                 svn_revnum_t revision,
+                                 svn_stream_t *stream,
+                                 apr_pool_t *scratch_pool);
+
 /*** Authentication handler declarations ***/
 
 /**

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Tue Dec 13 09:49:29 2022
@@ -1068,6 +1068,7 @@ static const svn_ra__vtable_t serf_vtabl
   svn_ra_serf__get_inherited_props,
   NULL /* set_svn_ra_open */,
   svn_ra_serf__list,
+  svn_ra_serf__fetch_file_contents,
   svn_ra_serf__register_editor_shim_callbacks,
   NULL /* commit_ev2 */,
   NULL /* replay_range_ev2 */

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Tue Dec 13 09:49:29 2022
@@ -1436,11 +1436,11 @@ parse_iproplist(apr_array_header_t **inh
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *ra_svn_get_file(svn_ra_session_t *session, const char 
*path,
-                                    svn_revnum_t rev, svn_stream_t *stream,
-                                    svn_revnum_t *fetched_rev,
-                                    apr_hash_t **props,
-                                    apr_pool_t *pool)
+static svn_error_t *get_file(svn_ra_session_t *session, const char *path,
+                             svn_revnum_t rev, svn_stream_t *stream,
+                             svn_revnum_t *fetched_rev,
+                             apr_hash_t **props,
+                             apr_pool_t *pool)
 {
   svn_ra_svn__session_baton_t *sess_baton = session->priv;
   svn_ra_svn_conn_t *conn = sess_baton->conn;
@@ -1497,6 +1497,8 @@ static svn_error_t *ra_svn_get_file(svn_
     }
   svn_pool_destroy(iterpool);
 
+  SVN_ERR(svn_stream_close(stream));
+
   SVN_ERR(svn_ra_svn__read_cmd_response(conn, pool, ""));
 
   if (expected_checksum)
@@ -3258,6 +3260,34 @@ ra_svn_list(svn_ra_session_t *session,
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *ra_svn_get_file(svn_ra_session_t *session, const char 
*path,
+                                    svn_revnum_t rev, svn_stream_t *stream,
+                                    svn_revnum_t *fetched_rev,
+                                    apr_hash_t **props,
+                                    apr_pool_t *pool)
+{
+  /* We are not supposed to close the passed-in stream, so disown it. */
+  if (stream)
+    stream = svn_stream_disown(stream, pool);
+
+  SVN_ERR(get_file(session, path, rev, stream, fetched_rev,
+                   props, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *ra_svn_fetch_file_contents(svn_ra_session_t *session,
+                                               const char *path,
+                                               svn_revnum_t rev,
+                                               svn_stream_t *stream,
+                                               apr_pool_t *scratch_pool)
+{
+  SVN_ERR(get_file(session, path, rev, stream, NULL,
+                   NULL, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 static const svn_ra__vtable_t ra_svn_vtable = {
   svn_ra_svn_version,
   ra_svn_get_description,
@@ -3298,6 +3328,7 @@ static const svn_ra__vtable_t ra_svn_vta
   ra_svn_get_inherited_props,
   NULL /* ra_set_svn_ra_open */,
   ra_svn_list,
+  ra_svn_fetch_file_contents,
   ra_svn_register_editor_shim_callbacks,
   NULL /* commit_ev2 */,
   NULL /* replay_range_ev2 */

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1905955&r1=1905954&r2=1905955&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Tue Dec 13 09:49:29 2022
@@ -65,8 +65,8 @@ extern int (*const svn_sqlite3__api_conf
 #  include <sqlite3.h>
 #endif
 
-#if !SQLITE_VERSION_AT_LEAST(3,8,2)
-#error SQLite is too old -- version 3.8.2 is the minimum required version
+#if !SQLITE_VERSION_AT_LEAST(3,24,0)
+#error SQLite is too old -- version 3.24.0 is the minimum required version
 #endif
 
 #ifndef SQLITE_DETERMINISTIC

Propchange: subversion/trunk/subversion/libsvn_subr/utf8proc/
------------------------------------------------------------------------------
  Merged 
/subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_subr/utf8proc:r1897945-1905954


Reply via email to