Author: julianfoad
Date: Tue May 18 17:51:13 2010
New Revision: 945788
URL: http://svn.apache.org/viewvc?rev=945788&view=rev
Log:
Start splitting up the uses of svn_wc__text_base_path() according to their
purpose: some wanted the path in order to delete the file, some to read it,
some to write it, some to move it. This patch creates and uses a separate
function for those callers that need the path to a file to read from.
* subversion/libsvn_wc/adm_files.h,
subversion/libsvn_wc/adm_files.c
(svn_wc__get_working_node_pristine_file): New function.
* subversion/libsvn_wc/diff.c
(delete_entry, close_file): Use svn_wc__get_working_node_pristine_file()
to replace one kind of usage of svn_wc__text_base_path().
Modified:
subversion/trunk/subversion/libsvn_wc/adm_files.c
subversion/trunk/subversion/libsvn_wc/adm_files.h
subversion/trunk/subversion/libsvn_wc/diff.c
Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=945788&r1=945787&r2=945788&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue May 18 17:51:13 2010
@@ -269,6 +269,18 @@ svn_wc__text_revert_path(const char **re
svn_error_t *
+svn_wc__get_working_node_pristine_file(const char **result_abspath,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool)
+{
+ SVN_ERR(svn_wc__text_base_path(result_abspath, db, local_abspath,
+ result_pool));
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
svn_wc__get_pristine_base_contents(svn_stream_t **contents,
svn_wc__db_t *db,
const char *local_abspath,
Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=945788&r1=945787&r2=945788&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Tue May 18 17:51:13 2010
@@ -133,6 +133,31 @@ svn_error_t *svn_wc__prop_path(const cha
svn_wc__props_kind_t props_kind,
apr_pool_t *pool);
+/* Set *RESULT_ABSPATH to the absolute path to a readable file containing
+ the WORKING_NODE pristine text of LOCAL_ABSPATH in DB.
+
+ The implementation might create the file as an independent copy on
+ demand, or it might return the path to a shared file. The file will
+ remain readable until RESULT_POOL is cleared or until LOCAL_ABSPATH's WC
+ metadata is next changed, whichever is sooner.
+ (### The latter doesn't sound like a totally reasonable condition.)
+ After that, if the implementation provided a separate file then the file
+ will automatically be removed, or if it provided a shared file then
+ no guarantees are made about it after this time.
+
+ ### The present implementation just returns the path to the file in the
+ pristine store and does not make any attempt to ensure its lifetime is
+ as promised.
+
+ If the node LOCAL_ABSPATH has no pristine text, return an error.
+
+ Allocate *RESULT_PATH in RESULT_POOL. */
+svn_error_t *
+svn_wc__get_working_node_pristine_file(const char **result_abspath,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool);
+
/*** Opening all kinds of adm files ***/
Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=945788&r1=945787&r2=945788&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Tue May 18 17:51:13 2010
@@ -1205,8 +1205,9 @@ delete_entry(const char *path,
apr_hash_t *baseprops = NULL;
const char *base_mimetype;
- SVN_ERR(svn_wc__text_base_path(&textbase, eb->db, local_abspath,
- pool));
+ SVN_ERR(svn_wc__get_working_node_pristine_file(&textbase,
+ eb->db, local_abspath,
+ pool, pool));
SVN_ERR(svn_wc__get_pristine_props(&baseprops, eb->db, local_abspath,
pool, pool));
@@ -1575,8 +1576,9 @@ close_file(void *file_baton,
the same as BASE. */
temp_file_path = fb->temp_file_path;
if (!temp_file_path)
- SVN_ERR(svn_wc__text_base_path(&temp_file_path, eb->db, fb->local_abspath,
- fb->pool));
+ SVN_ERR(svn_wc__get_working_node_pristine_file(&temp_file_path,
+ eb->db, fb->local_abspath,
+ fb->pool, fb->pool));
/* If the file isn't in the working copy (either because it was added
in the BASE->repos diff or because we're diffing against WORKING
@@ -1639,8 +1641,9 @@ close_file(void *file_baton,
if (modified)
{
if (eb->use_text_base)
- SVN_ERR(svn_wc__text_base_path(&localfile, eb->db, fb->local_abspath,
- fb->pool));
+ SVN_ERR(svn_wc__get_working_node_pristine_file(&localfile, eb->db,
+ fb->local_abspath,
+ fb->pool, fb->pool));
else
/* a detranslated version of the working file */
SVN_ERR(svn_wc__internal_translated_file(