You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/05/18 19:51:13 UTC
svn commit: r945788 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c
adm_files.h diff.c
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(
Re: svn commit: r945788 - in
/subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h diff.c
Posted by Julian Foad <ju...@wandisco.com>.
On Wed, 2010-05-19, Greg Stein wrote:
> On Tue, May 18, 2010 at 13:51, <ju...@apache.org> wrote:
> > 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().
>
> I don't understand this. The uses do not necessarily have a WORKING
> node, so the function name doesn't seem right. The diff code might be
> asking for the pristine text associated with the BASE node (cuz there
> is no WORKING).
Yup - I named it very poorly. Rectified in r946268 - renamed to
svn_wc__text_base_path_to_read(), and doc string completely rewritten.
Thanks.
- Julian
> >...
>
> I do understand/agree with the approach -- different names make it
> easier to reason about the code. But I dunno this reason :-P
>
> Cheers,
> -g
Re: svn commit: r945788 - in /subversion/trunk/subversion/libsvn_wc:
adm_files.c adm_files.h diff.c
Posted by Greg Stein <gs...@gmail.com>.
On Tue, May 18, 2010 at 13:51, <ju...@apache.org> wrote:
> 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().
I don't understand this. The uses do not necessarily have a WORKING
node, so the function name doesn't seem right. The diff code might be
asking for the pristine text associated with the BASE node (cuz there
is no WORKING).
>...
I do understand/agree with the approach -- different names make it
easier to reason about the code. But I dunno this reason :-P
Cheers,
-g