Author: kotkov
Date: Fri Aug 27 13:53:00 2021
New Revision: 1892647
URL: http://svn.apache.org/viewvc?rev=1892647&view=rev
Log:
On the pristines-on-demand branch: Lay some groundwork for making the
text-bases optional.
Introduce a new svn_wc__textbase sublayer dedicated to working with
text-bases and start using it on all relevant calling sites.
The purpose of this change is twofold:
- We introduce a centralized layer that handles the text-base operations.
For now, the operations are either "get" or "install".
- On the pristine layer, we still have the svn_wc__db_pristine_get_path()
function that allows the callers to directly access the pristine file.
With optional text-bases, we'd probably want to substitute that with
streams, because now the text-base could also be the (unmodified) file
itself. The new svn_wc__textbase layer solves this by not allowing to
work with the file by its path, so while we transition to it we also
have to eliminate all such accesses.
For those cases where we need the text-base file (due to the API promises
or other circumstances), we introduce the special "setaside" helpers that
make the contents available in a temporary file. We may be able to get
rid of some of these setaside calls in the future.
* subversion/libsvn_wc/textbase.h,
subversion/libsvn_wc/textbase.c: New files.
(svn_wc__textbase_get_contents,
svn_wc__textbase_setaside,
svn_wc__textbase_setaside_wq,
svn_wc__textbase_prepare_install): Declare and implement these new
functions.
* subversion/libsvn_wc/adm_crawler.c
(): Include textbase.h.
(read_and_checksum_pristine_text, svn_wc__internal_transmit_text_deltas):
Update to call the functions of the new svn_wc__textbase layer.
* subversion/libsvn_wc/adm_ops.c
(): Include textbase.h.
(svn_wc_get_pristine_copy_path, svn_wc_get_pristine_contents2):
Update to call the functions of the new svn_wc__textbase layer.
* subversion/libsvn_wc/diff_editor.c
(): Include textbase.h.
(svn_wc__diff_base_working_diff, svn_wc__diff_local_only_file,
svn_wc__diff_base_only_file, apply_textdelta, close_file):
Update to call the functions of the new svn_wc__textbase layer.
Use the setaside function if we need a file path.
* subversion/libsvn_wc/externals.c
(): Include textbase.h.
(apply_textdelta): Update to call the functions of the new
svn_wc__textbase layer.
* subversion/libsvn_wc/update_editor.c
(): Include textbase.h.
(get_empty_tmp_file): Update to create a work item that will delete
the temporary file, as that should allow us to write symmetric code …
(svn_wc__perform_file_merge): …in this function. Update to call the
functions of the new svn_wc__textbase layer. Use the setaside function
if we need a file path.
(close_file): Update to call the functions of the new svn_wc__textbase
layer.
(svn_wc_add_repos_file4): Update to call the function of the new
svn_wc__textbase layer.
* subversion/libsvn_wc/util.c
(): Include textbase.h.
(svn_wc__fetch_base_func): Update to call the function of the new
svn_wc__textbase layer.
* subversion/libsvn_wc/wc_db_update_move.c
(): Include textbase.h.
(tc_editor_alter_file,
tc_editor_update_incoming_moved_file,
tc_editor_update_add_merge_files): Update to call the functions of
the new svn_wc__textbase layer. Use the setaside function if we
need a file path.
* subversion/libsvn_wc/adm_files.h,
subversion/libsvn_wc/adm_files.c
(svn_wc__text_base_path_to_read, svn_wc__get_pristine_contents): Remove.
* subversion/libsvn_wc/wc_db.h,
subversion/libsvn_wc/wc_db_pristine.c
(svn_wc__db_pristine_get_path): Remove.
Added:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c
(with props)
subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h
(with props)
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_crawler.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.h
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_ops.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/diff_editor.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/externals.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/update_editor.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/util.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db.h
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_pristine.c
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_update_move.c
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_crawler.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_crawler.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_crawler.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_crawler.c
Fri Aug 27 13:53:00 2021
@@ -46,6 +46,7 @@
#include "translate.h"
#include "workqueue.h"
#include "conflicts.h"
+#include "textbase.h"
#include "svn_private_config.h"
@@ -980,8 +981,8 @@ read_and_checksum_pristine_text(svn_stre
{
svn_stream_t *base_stream;
- SVN_ERR(svn_wc__get_pristine_contents(&base_stream, NULL, db, local_abspath,
- result_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_get_contents(&base_stream, db, local_abspath, NULL,
+ TRUE, result_pool, scratch_pool));
if (base_stream == NULL)
{
base_stream = svn_stream_empty(result_pool);
@@ -1097,11 +1098,11 @@ svn_wc__internal_transmit_text_deltas(sv
{
svn_stream_t *new_pristine_stream;
- SVN_ERR(svn_wc__db_pristine_prepare_install(&new_pristine_stream,
- &install_data,
- &local_sha1_checksum, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_prepare_install(&new_pristine_stream,
+ &install_data,
+ &local_sha1_checksum, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
local_stream = copying_stream(local_stream, new_pristine_stream,
scratch_pool);
}
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.c
Fri Aug 27 13:53:00 2021
@@ -160,122 +160,6 @@ make_adm_subdir(const char *path,
-/*** Syncing files in the adm area. ***/
-
-
-svn_error_t *
-svn_wc__text_base_path_to_read(const char **result_abspath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_status_t status;
- svn_node_kind_t kind;
- const svn_checksum_t *checksum;
-
- SVN_ERR(svn_wc__db_read_pristine_info(&status, &kind, NULL, NULL, NULL, NULL,
- &checksum, NULL, NULL, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool));
-
- /* Sanity */
- if (kind != svn_node_file)
- return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
- _("Can only get the pristine contents of files; "
- "'%s' is not a file"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
-
- if (status == svn_wc__db_status_not_present)
- /* We know that the delete of this node has been committed.
- This should be the same as if called on an unknown path. */
- return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
- _("Cannot get the pristine contents of '%s' "
- "because its delete is already committed"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
- else if (status == svn_wc__db_status_server_excluded
- || status == svn_wc__db_status_excluded
- || status == svn_wc__db_status_incomplete)
- return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
- _("Cannot get the pristine contents of '%s' "
- "because it has an unexpected status"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
-
- if (checksum == NULL)
- return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
- _("Node '%s' has no pristine text"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
- SVN_ERR(svn_wc__db_pristine_get_path(result_abspath, db, local_abspath,
- checksum,
- result_pool, scratch_pool));
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__get_pristine_contents(svn_stream_t **contents,
- svn_filesize_t *size,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_status_t status;
- svn_node_kind_t kind;
- const svn_checksum_t *sha1_checksum;
-
- if (size)
- *size = SVN_INVALID_FILESIZE;
-
- SVN_ERR(svn_wc__db_read_pristine_info(&status, &kind, NULL, NULL, NULL, NULL,
- &sha1_checksum, NULL, NULL, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool));
-
- /* Sanity */
- if (kind != svn_node_file)
- return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
- _("Can only get the pristine contents of files; "
- "'%s' is not a file"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
-
- if (status == svn_wc__db_status_added && !sha1_checksum)
- {
- /* Simply added. The pristine base does not exist. */
- *contents = NULL;
- return SVN_NO_ERROR;
- }
- else if (status == svn_wc__db_status_not_present)
- /* We know that the delete of this node has been committed.
- This should be the same as if called on an unknown path. */
- return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
- _("Cannot get the pristine contents of '%s' "
- "because its delete is already committed"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
- else if (status == svn_wc__db_status_server_excluded
- || status == svn_wc__db_status_excluded
- || status == svn_wc__db_status_incomplete)
- return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
- _("Cannot get the pristine contents of '%s' "
- "because it has an unexpected status"),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
- if (sha1_checksum)
- SVN_ERR(svn_wc__db_pristine_read(contents, size, db, local_abspath,
- sha1_checksum,
- result_pool, scratch_pool));
- else
- *contents = NULL;
-
- return SVN_NO_ERROR;
-}
-
-
/*** Opening and closing files in the adm area. ***/
svn_error_t *
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.h?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.h
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_files.h
Fri Aug 27 13:53:00 2021
@@ -52,55 +52,6 @@ svn_boolean_t svn_wc__adm_area_exists(co
apr_pool_t *pool);
-/* Set *CONTENTS to a readonly stream on the pristine text of the working
- * version of the file LOCAL_ABSPATH in DB. If the file is locally copied
- * or moved to this path, this means the pristine text of the copy source,
- * even if the file replaces a previously existing base node at this path.
- *
- * Set *CONTENTS to NULL if there is no pristine text because the file is
- * locally added (even if it replaces an existing base node). Return an
- * error if there is no pristine text for any other reason.
- *
- * If SIZE is not NULL, set *SIZE to the length of the pristine stream in
- * BYTES or to SVN_INVALID_FILESIZE if no pristine is available for this
- * file.
- *
- * For more detail, see the description of svn_wc_get_pristine_contents2().
- */
-svn_error_t *
-svn_wc__get_pristine_contents(svn_stream_t **contents,
- svn_filesize_t *size,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-/* Set *RESULT_ABSPATH to the absolute path to a readable file containing
- the WC-1 "normal text-base" of LOCAL_ABSPATH in DB.
-
- "Normal text-base" means the same as in svn_wc__text_base_path().
- ### May want to check the callers' exact requirements and replace this
- definition with something easier to comprehend.
-
- What the callers want:
- A path to a file that will remain available and unchanged as long as
- the caller wants it - such as for the lifetime of RESULT_POOL.
-
- What the current implementation provides:
- A path to the file in the pristine store. This file will be removed or
- replaced the next time this or another Subversion client updates the WC.
-
- If the node LOCAL_ABSPATH has no such pristine text, return an error of
- type SVN_ERR_WC_PATH_UNEXPECTED_STATUS.
-
- Allocate *RESULT_PATH in RESULT_POOL. */
-svn_error_t *
-svn_wc__text_base_path_to_read(const char **result_abspath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
/*** Opening all kinds of adm files ***/
Modified: subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_ops.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_ops.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/adm_ops.c Fri
Aug 27 13:53:00 2021
@@ -53,6 +53,7 @@
#include "adm_files.h"
#include "conflicts.h"
#include "workqueue.h"
+#include "textbase.h"
#include "private/svn_dep_compat.h"
#include "private/svn_sorts_private.h"
@@ -779,8 +780,8 @@ svn_wc_get_pristine_copy_path(const char
may use repeatedly despite error return values. The rest of this
function should aggressively close DB, even in the error case. */
- err = svn_wc__text_base_path_to_read(pristine_path, db, local_abspath,
- pool, pool);
+ err = svn_wc__textbase_setaside(pristine_path, db, local_abspath,
+ NULL, NULL, NULL, pool, pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
{
/* The node doesn't exist, so return a non-existent path located
@@ -806,9 +807,10 @@ svn_wc_get_pristine_contents2(svn_stream
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- return svn_error_trace(svn_wc__get_pristine_contents(contents, NULL,
+ return svn_error_trace(svn_wc__textbase_get_contents(contents,
wc_ctx->db,
local_abspath,
+ NULL, TRUE,
result_pool,
scratch_pool));
}
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/diff_editor.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/diff_editor.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/diff_editor.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/diff_editor.c
Fri Aug 27 13:53:00 2021
@@ -75,6 +75,7 @@
#include "adm_files.h"
#include "translate.h"
#include "diff.h"
+#include "textbase.h"
#include "svn_private_config.h"
@@ -476,15 +477,17 @@ svn_wc__diff_base_working_diff(svn_wc__d
if (skip)
return SVN_NO_ERROR;
- SVN_ERR(svn_wc__db_pristine_get_path(&pristine_file,
- db, local_abspath, checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&pristine_file,
+ db, local_abspath, checksum,
+ cancel_func, cancel_baton,
+ scratch_pool, scratch_pool));
if (diff_pristine)
- SVN_ERR(svn_wc__db_pristine_get_path(&local_file,
- db, local_abspath,
- working_checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&local_file,
+ db, local_abspath,
+ working_checksum,
+ cancel_func, cancel_baton,
+ scratch_pool, scratch_pool));
else if (! (had_props || props_mod))
local_file = local_abspath;
else if (files_same)
@@ -1019,8 +1022,9 @@ svn_wc__diff_local_only_file(svn_wc__db_
right_props = svn_prop_hash_dup(pristine_props, scratch_pool);
if (checksum)
- SVN_ERR(svn_wc__db_pristine_get_path(&pristine_file, db, local_abspath,
- checksum, scratch_pool,
scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&pristine_file, db, local_abspath,
+ checksum, cancel_func, cancel_baton,
+ scratch_pool, scratch_pool));
else
pristine_file = NULL;
@@ -1415,9 +1419,10 @@ svn_wc__diff_base_only_file(svn_wc__db_t
if (skip)
return SVN_NO_ERROR;
- SVN_ERR(svn_wc__db_pristine_get_path(&pristine_file,
- db, local_abspath, checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&pristine_file,
+ db, local_abspath, checksum,
+ NULL, NULL,
+ scratch_pool, scratch_pool));
SVN_ERR(processor->file_deleted(relpath,
left_src,
@@ -2111,17 +2116,17 @@ apply_textdelta(void *file_baton,
pool));
}
- SVN_ERR(svn_wc__db_pristine_read(&source, NULL,
- eb->db, fb->local_abspath,
- fb->base_checksum,
- pool, pool));
+ SVN_ERR(svn_wc__textbase_get_contents(&source,
+ eb->db, fb->local_abspath,
+ fb->base_checksum, FALSE,
+ pool, pool));
}
else if (fb->base_checksum)
{
- SVN_ERR(svn_wc__db_pristine_read(&source, NULL,
- eb->db, fb->local_abspath,
- fb->base_checksum,
- pool, pool));
+ SVN_ERR(svn_wc__textbase_get_contents(&source,
+ eb->db, fb->local_abspath,
+ fb->base_checksum, FALSE,
+ pool, pool));
}
else
source = svn_stream_empty(pool);
@@ -2215,10 +2220,11 @@ close_file(void *file_baton,
if (! repos_file)
{
assert(fb->base_checksum);
- SVN_ERR(svn_wc__db_pristine_get_path(&repos_file,
- eb->db, eb->anchor_abspath,
- fb->base_checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&repos_file,
+ eb->db, fb->local_abspath,
+ fb->base_checksum,
+ eb->cancel_func, eb->cancel_baton,
+ scratch_pool, scratch_pool));
}
}
@@ -2251,10 +2257,11 @@ close_file(void *file_baton,
eb->db, fb->local_abspath,
scratch_pool, scratch_pool));
assert(checksum);
- SVN_ERR(svn_wc__db_pristine_get_path(&localfile,
- eb->db, eb->anchor_abspath,
- checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(&localfile,
+ eb->db, fb->local_abspath,
+ checksum,
+ eb->cancel_func, eb->cancel_baton,
+ scratch_pool, scratch_pool));
}
else
{
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/externals.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/externals.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/externals.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/externals.c
Fri Aug 27 13:53:00 2021
@@ -53,6 +53,7 @@
#include "translate.h"
#include "workqueue.h"
#include "conflicts.h"
+#include "textbase.h"
#include "svn_private_config.h"
@@ -631,19 +632,20 @@ apply_textdelta(void *file_baton,
pool)));
}
- SVN_ERR(svn_wc__db_pristine_read(&src_stream, NULL, eb->db,
- eb->wri_abspath, eb->original_checksum,
- pool, pool));
+ SVN_ERR(svn_wc__textbase_get_contents(&src_stream, eb->db,
+ eb->local_abspath,
+ eb->original_checksum,
+ FALSE, pool, pool));
}
else
src_stream = svn_stream_empty(pool);
- SVN_ERR(svn_wc__db_pristine_prepare_install(&dest_stream,
- &eb->install_data,
- &eb->new_sha1_checksum,
- &eb->new_md5_checksum,
- eb->db, eb->wri_abspath,
- eb->pool, pool));
+ SVN_ERR(svn_wc__textbase_prepare_install(&dest_stream,
+ &eb->install_data,
+ &eb->new_sha1_checksum,
+ &eb->new_md5_checksum,
+ eb->db, eb->local_abspath,
+ eb->pool, pool));
svn_txdelta_apply(src_stream, dest_stream, NULL, eb->local_abspath, pool,
handler, handler_baton);
Added: subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c?rev=1892647&view=auto
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c
(added)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c Fri
Aug 27 13:53:00 2021
@@ -0,0 +1,240 @@
+/*
+ * textbase.c: working with text-bases
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#include "svn_dirent_uri.h"
+
+#include "textbase.h"
+#include "wc.h"
+#include "workqueue.h"
+
+static svn_error_t *
+open_textbase(svn_stream_t **contents_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *textbase_checksum,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_status_t status;
+ svn_node_kind_t kind;
+ const svn_checksum_t *checksum;
+ const svn_checksum_t *target_checksum;
+
+ SVN_ERR(svn_wc__db_read_pristine_info(&status, &kind, NULL, NULL, NULL,
+ NULL, &checksum, NULL, NULL,
+ NULL, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ /* Sanity */
+ if (kind != svn_node_file)
+ return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
+ _("Can only get the pristine contents of files; "
+ "'%s' is not a file"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
+ if (status == svn_wc__db_status_not_present)
+ {
+ /* We know that the delete of this node has been committed.
+ This should be the same as if called on an unknown path. */
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("Cannot get the pristine contents of '%s' "
+ "because its delete is already committed"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+ else if (status == svn_wc__db_status_server_excluded ||
+ status == svn_wc__db_status_excluded ||
+ status == svn_wc__db_status_incomplete)
+ {
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Cannot get the pristine contents of '%s' "
+ "because it has an unexpected status"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+
+ if (textbase_checksum)
+ target_checksum = textbase_checksum;
+ else
+ target_checksum = checksum;
+
+ if (!target_checksum)
+ {
+ *contents_p = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(svn_wc__db_pristine_read(contents_p, NULL, db, local_abspath,
+ target_checksum, result_pool,
scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__textbase_get_contents(svn_stream_t **contents_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_boolean_t ignore_enoent,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_stream_t *contents;
+
+ SVN_ERR(open_textbase(&contents, db, local_abspath, checksum,
+ result_pool, scratch_pool));
+
+ if (!contents && ignore_enoent)
+ {
+ *contents_p = NULL;
+ return SVN_NO_ERROR;
+ }
+ else if (!contents)
+ {
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Node '%s' has no pristine text"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+
+ *contents_p = contents;
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__textbase_setaside(const char **result_abspath_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_stream_t *contents;
+ const char *tmpdir_abspath;
+ svn_stream_t *tmpstream;
+ const char *tmpfile_abspath;
+ svn_error_t *err;
+
+ SVN_ERR(open_textbase(&contents, db, local_abspath, checksum,
+ scratch_pool, scratch_pool));
+
+ if (!contents)
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Node '%s' has no pristine text"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_open_unique(&tmpstream, &tmpfile_abspath, tmpdir_abspath,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+ err = svn_stream_copy3(contents, tmpstream, cancel_func, cancel_baton,
+ scratch_pool);
+ if (err)
+ {
+ return svn_error_compose_create(
+ err,
+ svn_io_remove_file2(tmpfile_abspath, TRUE, scratch_pool));
+ }
+
+ *result_abspath_p = tmpfile_abspath;
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__textbase_setaside_wq(const char **result_abspath_p,
+ svn_skel_t **cleanup_work_item_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_stream_t *contents;
+ const char *tmpdir_abspath;
+ svn_stream_t *tmpstream;
+ const char *tmpfile_abspath;
+ svn_skel_t *work_item;
+ svn_error_t *err;
+
+ SVN_ERR(open_textbase(&contents, db, local_abspath, checksum,
+ scratch_pool, scratch_pool));
+
+ if (!contents)
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Node '%s' has no pristine text"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmpdir_abspath,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_open_unique(&tmpstream, &tmpfile_abspath, tmpdir_abspath,
+ svn_io_file_del_none,
+ result_pool, scratch_pool));
+ err = svn_wc__wq_build_file_remove(&work_item, db,
+ local_abspath, tmpfile_abspath,
+ result_pool, scratch_pool);
+ if (!err)
+ err = svn_stream_copy3(contents, tmpstream, cancel_func, cancel_baton,
+ scratch_pool);
+
+ if (err)
+ {
+ return svn_error_compose_create(
+ err,
+ svn_io_remove_file2(tmpfile_abspath, TRUE, scratch_pool));
+ }
+
+ *result_abspath_p = tmpfile_abspath;
+ *cleanup_work_item_p = work_item;
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__textbase_prepare_install(svn_stream_t **stream_p,
+ svn_wc__db_install_data_t **install_data_p,
+ svn_checksum_t **sha1_checksum_p,
+ svn_checksum_t **md5_checksum_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ SVN_ERR(svn_wc__db_pristine_prepare_install(stream_p, install_data_p,
+ sha1_checksum_p,
+ md5_checksum_p,
+ db, local_abspath,
+ result_pool, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
Propchange:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h?rev=1892647&view=auto
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h
(added)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h Fri
Aug 27 13:53:00 2021
@@ -0,0 +1,113 @@
+/*
+ * textbase.h: working with text-bases
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#ifndef SVN_LIBSVN_WC_TEXTBASE_H
+#define SVN_LIBSVN_WC_TEXTBASE_H
+
+#include "svn_types.h"
+#include "svn_io.h"
+
+#include "wc_db.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Set *CONTENTS_P to a readonly stream containing the text-base contents
+ * of the version of the file LOCAL_ABSPATH identified by CHECKSUM in DB.
+ * If the CHECKSUM is NULL, return the text-base of the working version
+ * of the file. If the file is locally copied or moved to this path,
+ * the text-base will correspond to the copy source, even if the file
+ * replaces a previously existing base node at this path.
+ *
+ * If the file is not modified, the function may return a detranslated
+ * stream to the contents of the file itself.
+ *
+ * If the text-base is not available on disk or if the file does not
+ * have a text-base, set *CONTENTS_P to NULL iff IGNORE_ENOENT is true
+ * and return an error otherwise.
+ */
+svn_error_t *
+svn_wc__textbase_get_contents(svn_stream_t **contents_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_boolean_t ignore_enoent,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/* Set *RESULT_ABSPATH_P to the path of the temporary file containing the
+ * text-base contents of the version of the file LOCAL_ABSPATH identified
+ * by CHECKSUM in DB. The returned file will be removed when the RESULT_POOL
+ * is cleared.
+ *
+ * For more detail, see the description of svn_wc__textbase_get_contents().
+ */
+svn_error_t *
+svn_wc__textbase_setaside(const char **result_abspath_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/* Set *RESULT_ABSPATH_P to the path of the temporary file containing the
+ * text-base contents of the version of the file LOCAL_ABSPATH identified
+ * by CHECKSUM in DB. Set *CLEANUP_WORK_ITEM_P to a new work item that
+ * will remove the temporary file. Allocate both *RESULT_ABSPATH_P and
+ * *CLEANUP_WORK_ITEM_P in RESULT_POOL.
+ *
+ * For more detail, see the description of svn_wc__textbase_get_contents().
+ */
+svn_error_t *
+svn_wc__textbase_setaside_wq(const char **result_abspath_p,
+ svn_skel_t **cleanup_work_item_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_checksum_t *checksum,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/* Prepare to install the text-base contents for file LOCAL_ABSPATH in DB.
+ *
+ * For more detail, see the description of
svn_wc__db_pristine_prepare_install().
+ */
+svn_error_t *
+svn_wc__textbase_prepare_install(svn_stream_t **stream_p,
+ svn_wc__db_install_data_t **install_data_p,
+ svn_checksum_t **sha1_checksum_p,
+ svn_checksum_t **md5_checksum_p,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SVN_LIBSVN_WC_TEXTBASE_H */
Propchange:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/textbase.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/update_editor.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/update_editor.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
---
subversion/branches/pristines-on-demand/subversion/libsvn_wc/update_editor.c
(original)
+++
subversion/branches/pristines-on-demand/subversion/libsvn_wc/update_editor.c
Fri Aug 27 13:53:00 2021
@@ -48,6 +48,7 @@
#include "conflicts.h"
#include "translate.h"
#include "workqueue.h"
+#include "textbase.h"
#include "private/svn_subr_private.h"
#include "private/svn_wc_private.h"
@@ -439,7 +440,8 @@ struct handler_baton
/* Get an empty file in the temporary area for WRI_ABSPATH. The file will
not be set for automatic deletion, and the name will be returned in
- TMP_FILENAME.
+ TMP_FILENAME_P. Set *CLEANUP_WORK_ITEM_P to a new work item that will
+ remove the temporary file.
This implementation creates a new empty file with a unique name.
@@ -451,19 +453,35 @@ struct handler_baton
### file name to create later. A better way may not be readily available.
*/
static svn_error_t *
-get_empty_tmp_file(const char **tmp_filename,
+get_empty_tmp_file(const char **tmp_filename_p,
+ svn_skel_t **cleanup_work_item_p,
svn_wc__db_t *db,
const char *wri_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
const char *temp_dir_abspath;
+ const char *tmp_filename;
+ svn_skel_t *work_item;
+ svn_error_t *err;
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath, db, wri_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(svn_io_open_unique_file3(NULL, tmp_filename, temp_dir_abspath,
+ SVN_ERR(svn_io_open_unique_file3(NULL, &tmp_filename, temp_dir_abspath,
svn_io_file_del_none,
scratch_pool, scratch_pool));
+ err = svn_wc__wq_build_file_remove(&work_item, db, wri_abspath,
+ tmp_filename,
+ result_pool, scratch_pool);
+ if (err)
+ {
+ return svn_error_compose_create(
+ err,
+ svn_io_remove_file2(tmp_filename, TRUE, scratch_pool));
+ }
+
+ *tmp_filename_p = tmp_filename;
+ *cleanup_work_item_p = work_item;
return SVN_NO_ERROR;
}
@@ -3726,10 +3744,10 @@ lazy_open_source(svn_stream_t **stream,
{
struct file_baton *fb = baton;
- SVN_ERR(svn_wc__db_pristine_read(stream, NULL, fb->edit_baton->db,
- fb->local_abspath,
- fb->original_checksum,
- result_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_get_contents(stream, fb->edit_baton->db,
+ fb->local_abspath,
+ fb->original_checksum, FALSE,
+ result_pool, scratch_pool));
return SVN_NO_ERROR;
@@ -3754,13 +3772,13 @@ lazy_open_target(svn_stream_t **stream_p
INSTALL_STREAM if is not NULL on error.
So we store INSTALL_DATA to local variable first, to leave
HB->INSTALL_DATA unchanged on error. */
- SVN_ERR(svn_wc__db_pristine_prepare_install(&pristine_install_stream,
- &pristine_install_data,
- &hb->new_text_base_sha1_checksum,
- NULL,
- fb->edit_baton->db,
- fb->dir_baton->local_abspath,
- result_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_prepare_install(&pristine_install_stream,
+ &pristine_install_data,
+ &hb->new_text_base_sha1_checksum,
+ NULL,
+ fb->edit_baton->db,
+ fb->local_abspath,
+ result_pool, scratch_pool));
if (fb->shadowed || fb->obstruction_found || fb->edit_obstructed)
{
@@ -4062,17 +4080,19 @@ svn_wc__perform_file_merge(svn_skel_t **
the textual changes into the working file. */
const char *oldrev_str, *newrev_str, *mine_str;
const char *merge_left;
- svn_boolean_t delete_left = FALSE;
const char *path_ext = "";
const char *new_pristine_abspath;
enum svn_wc_merge_outcome_t merge_outcome = svn_wc_merge_unchanged;
svn_skel_t *work_item;
+ svn_skel_t *cleanup_queue = NULL;
*work_items = NULL;
- SVN_ERR(svn_wc__db_pristine_get_path(&new_pristine_abspath,
- db, wri_abspath, new_checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside_wq(&new_pristine_abspath, &work_item,
+ db, local_abspath, new_checksum,
+ cancel_func, cancel_baton,
+ result_pool, scratch_pool));
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item, result_pool);
/* If we have any file extensions we're supposed to
preserve in generated conflict file names, then find
@@ -4106,14 +4126,19 @@ svn_wc__perform_file_merge(svn_skel_t **
if (! original_checksum)
{
- SVN_ERR(get_empty_tmp_file(&merge_left, db, wri_abspath,
+ SVN_ERR(get_empty_tmp_file(&merge_left, &work_item, db, wri_abspath,
result_pool, scratch_pool));
- delete_left = TRUE;
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item, result_pool);
}
else
- SVN_ERR(svn_wc__db_pristine_get_path(&merge_left, db, wri_abspath,
- original_checksum,
- result_pool, scratch_pool));
+ {
+ SVN_ERR(svn_wc__textbase_setaside_wq(&merge_left, &work_item,
+ db, local_abspath,
+ original_checksum,
+ cancel_func, cancel_baton,
+ result_pool, scratch_pool));
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item, result_pool);
+ }
/* Merge the changes from the old textbase to the new
textbase into the file we're updating.
@@ -4134,16 +4159,9 @@ svn_wc__perform_file_merge(svn_skel_t **
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- *found_conflict = (merge_outcome == svn_wc_merge_conflict);
+ *work_items = svn_wc__wq_merge(*work_items, cleanup_queue, result_pool);
- /* If we created a temporary left merge file, get rid of it. */
- if (delete_left)
- {
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item, db, wri_abspath,
- merge_left,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- }
+ *found_conflict = (merge_outcome == svn_wc_merge_conflict);
return SVN_NO_ERROR;
}
@@ -4728,9 +4746,9 @@ close_file(void *file_baton,
}
else
{
- SVN_ERR(svn_wc__db_pristine_read(&src_stream, NULL, eb->db,
- eb->wcroot_abspath, new_checksum,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_get_contents(&src_stream, eb->db,
+ fb->local_abspath,
new_checksum,
+ FALSE, scratch_pool,
scratch_pool));
}
SVN_ERR(svn_stream_copy3(src_stream, dst_stream, NULL, NULL,
scratch_pool));
@@ -5610,12 +5628,12 @@ svn_wc_add_repos_file4(svn_wc_context_t
NEW_TEXT_BASE_MD5_CHECKSUM and NEW_TEXT_BASE_SHA1_CHECKSUM as we copy. */
if (copyfrom_url)
{
- SVN_ERR(svn_wc__db_pristine_prepare_install(&tmp_base_contents,
- &install_data,
- &new_text_base_sha1_checksum,
- &new_text_base_md5_checksum,
- wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_prepare_install(&tmp_base_contents,
+ &install_data,
+ &new_text_base_sha1_checksum,
+ &new_text_base_md5_checksum,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
}
else
{
Modified: subversion/branches/pristines-on-demand/subversion/libsvn_wc/util.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/util.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/util.c
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/util.c Fri Aug
27 13:53:00 2021
@@ -37,6 +37,7 @@
#include "wc.h" /* just for prototypes of things in this .c file */
#include "entries.h"
+#include "textbase.h"
#include "private/svn_wc_private.h"
#include "svn_private_config.h"
@@ -505,8 +506,9 @@ svn_wc__fetch_base_func(const char **fil
return SVN_NO_ERROR;
}
- SVN_ERR(svn_wc__db_pristine_get_path(filename, sfb->db, local_abspath,
- checksum, scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__textbase_setaside(filename, sfb->db, local_abspath,
+ checksum, NULL, NULL,
+ result_pool, scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db.h?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db.h
(original)
+++ subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db.h Fri
Aug 27 13:53:00 2021
@@ -914,21 +914,6 @@ svn_wc__db_base_get_lock_tokens_recursiv
@{
*/
-/* Set *PRISTINE_ABSPATH to the path to the pristine text file
- identified by SHA1_CHECKSUM. Error if it does not exist.
-
- ### This is temporary - callers should not be looking at the file
- directly.
-
- Allocate the path in RESULT_POOL. */
-svn_error_t *
-svn_wc__db_pristine_get_path(const char **pristine_abspath,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
/* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be
used by the pristine text identified by SHA1_CHECKSUM. The file
need not exist.
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_pristine.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_pristine.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
---
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_pristine.c
(original)
+++
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_pristine.c
Fri Aug 27 13:53:00 2021
@@ -94,50 +94,6 @@ get_pristine_fname(const char **pristine
svn_error_t *
-svn_wc__db_pristine_get_path(const char **pristine_abspath,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_wcroot_t *wcroot;
- const char *local_relpath;
- svn_boolean_t present;
-
- SVN_ERR_ASSERT(pristine_abspath != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- /* ### Transitional: accept MD-5 and look up the SHA-1. Return an error
- * if the pristine text is not in the store. */
- if (sha1_checksum->kind != svn_checksum_sha1)
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db, wri_abspath,
- sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
- db, wri_abspath,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_WCROOT(wcroot);
-
- SVN_ERR(svn_wc__db_pristine_check(&present, db, wri_abspath, sha1_checksum,
- scratch_pool));
- if (! present)
- return svn_error_createf(SVN_ERR_WC_DB_ERROR, NULL,
- _("The pristine text with checksum '%s' was "
- "not found"),
- svn_checksum_to_cstring_display(sha1_checksum,
- scratch_pool));
-
- SVN_ERR(get_pristine_fname(pristine_abspath, wcroot->abspath,
- sha1_checksum,
- result_pool, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
svn_wc__db_pristine_get_future_path(const char **pristine_abspath,
const char *wcroot_abspath,
const svn_checksum_t *sha1_checksum,
Modified:
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_update_move.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_update_move.c?rev=1892647&r1=1892646&r2=1892647&view=diff
==============================================================================
---
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_update_move.c
(original)
+++
subversion/branches/pristines-on-demand/subversion/libsvn_wc/wc_db_update_move.c
Fri Aug 27 13:53:00 2021
@@ -154,6 +154,7 @@
#include "conflicts.h"
#include "workqueue.h"
#include "token-map.h"
+#include "textbase.h"
/* Helper functions */
/* Return the absolute path, in local path style, of LOCAL_RELPATH
@@ -1382,20 +1383,30 @@ tc_editor_alter_file(node_move_baton_t *
}
else
{
+ svn_skel_t *cleanup_queue = NULL;
+
/*
* Run a 3-way merge to update the file, using the pre-update
* pristine text as the merge base, the post-update pristine
* text as the merge-left version, and the current content of the
* moved-here working file as the merge-right version.
*/
- SVN_ERR(svn_wc__db_pristine_get_path(&old_pristine_abspath,
- b->db, b->wcroot->abspath,
+ SVN_ERR(svn_wc__textbase_setaside_wq(&old_pristine_abspath,
+ &work_item, b->db,
+ local_abspath,
old_version.checksum,
+ b->cancel_func, b->cancel_baton,
scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__db_pristine_get_path(&new_pristine_abspath,
- b->db, b->wcroot->abspath,
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item,
scratch_pool);
+
+ SVN_ERR(svn_wc__textbase_setaside_wq(&new_pristine_abspath,
+ &work_item, b->db,
+ local_abspath,
new_version.checksum,
+ b->cancel_func, b->cancel_baton,
scratch_pool, scratch_pool));
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item,
scratch_pool);
+
SVN_ERR(svn_wc__internal_merge(&work_item, &conflict_skel,
&merge_outcome, b->db,
old_pristine_abspath,
@@ -1412,6 +1423,7 @@ tc_editor_alter_file(node_move_baton_t *
scratch_pool, scratch_pool));
work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+ work_items = svn_wc__wq_merge(work_items, cleanup_queue,
scratch_pool);
if (merge_outcome == svn_wc_merge_conflict)
content_state = svn_wc_notify_state_conflicted;
@@ -1599,6 +1611,7 @@ tc_editor_update_incoming_moved_file(nod
const char *src_abspath;
const char *label_left;
const char *label_target;
+ svn_skel_t *cleanup_queue = NULL;
/*
* Run a 3-way merge to update the file at its post-move location,
@@ -1607,12 +1620,17 @@ tc_editor_update_incoming_moved_file(nod
* content of the working file at the pre-move location as the
* merge-left version.
*/
- SVN_ERR(svn_wc__db_pristine_get_path(&old_pristine_abspath,
- b->db, b->wcroot->abspath,
- src_checksum,
- scratch_pool, scratch_pool));
src_abspath = svn_dirent_join(b->wcroot->abspath, src_relpath,
scratch_pool);
+
+ SVN_ERR(svn_wc__textbase_setaside_wq(&old_pristine_abspath,
+ &work_item, b->db,
+ src_abspath,
+ src_checksum,
+ b->cancel_func, b->cancel_baton,
+ scratch_pool, scratch_pool));
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item,
scratch_pool);
+
label_left = apr_psprintf(scratch_pool, ".r%ld",
b->old_version->peg_rev);
label_target = apr_psprintf(scratch_pool, ".r%ld",
@@ -1635,6 +1653,7 @@ tc_editor_update_incoming_moved_file(nod
scratch_pool, scratch_pool));
work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+ work_items = svn_wc__wq_merge(work_items, cleanup_queue,
scratch_pool);
if (merge_outcome == svn_wc_merge_conflict)
content_state = svn_wc_notify_state_conflicted;
@@ -3162,6 +3181,7 @@ tc_editor_update_add_merge_files(added_n
const char *empty_file_abspath;
const char *pristine_abspath;
svn_skel_t *work_item = NULL;
+ svn_skel_t *cleanup_queue = NULL;
/*
* Run a 3-way merge to update the file, using the empty file
@@ -3172,9 +3192,13 @@ tc_editor_update_add_merge_files(added_n
SVN_ERR(svn_io_open_unique_file3(NULL, &empty_file_abspath, NULL,
svn_io_file_del_on_pool_cleanup,
scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__db_pristine_get_path(&pristine_abspath, b->db,
- b->wcroot->abspath, base_checksum,
+ SVN_ERR(svn_wc__textbase_setaside_wq(&pristine_abspath,
+ &work_item, b->db,
+ local_abspath,
+ base_checksum,
+ b->cancel_func, b->cancel_baton,
scratch_pool, scratch_pool));
+ cleanup_queue = svn_wc__wq_merge(cleanup_queue, work_item, scratch_pool);
/* Create a property diff which shows all props as added. */
SVN_ERR(svn_prop_diffs(&propchanges, working_props,
@@ -3196,6 +3220,7 @@ tc_editor_update_add_merge_files(added_n
scratch_pool, scratch_pool));
work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+ work_items = svn_wc__wq_merge(work_items, cleanup_queue, scratch_pool);
if (merge_outcome == svn_wc_merge_conflict)
content_state = svn_wc_notify_state_conflicted;