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/24 20:20:15 UTC
svn commit: r947744 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c
adm_files.h adm_ops.c diff.c workqueue.c
Author: julianfoad
Date: Mon May 24 18:20:14 2010
New Revision: 947744
URL: http://svn.apache.org/viewvc?rev=947744&view=rev
Log:
Fill in the Pristine-Store implementations of some functions, conditional on
SVN_EXPERIMENTAL_PRISTINE.
* subversion/libsvn_wc/adm_files.c
(svn_wc__text_base_path_to_read, svn_wc__ultimate_base_text_path,
svn_wc__get_pristine_contents): Implement the Pristine Store version.
(svn_wc__get_ultimate_base_contents): Adjust calls to pass a scratch pool.
* subversion/libsvn_wc/adm_files.h
(svn_wc__text_base_path_to_read): Add a scratch pool parameter.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_get_pristine_copy_path): Adjust calls to pass a scratch pool.
* subversion/libsvn_wc/diff.c
(get_nearest_pristine_text_as_file): Add a scratch pool parameter. Adjust
calls to pass a scratch pool.
(file_diff, report_wc_file_as_added, delete_entry, close_file): Adjust
calls to pass a scratch pool.
* subversion/libsvn_wc/workqueue.c
(verify_pristine_present, log_do_committed): Adjust calls to pass a
scratch pool.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_files.c
subversion/trunk/subversion/libsvn_wc/adm_files.h
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/diff.c
subversion/trunk/subversion/libsvn_wc/workqueue.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=947744&r1=947743&r2=947744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Mon May 24 18:20:14 2010
@@ -268,8 +268,27 @@ 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 *result_pool,
+ apr_pool_t *scratch_pool)
{
+#ifdef SVN_EXPERIMENTAL_PRISTINE
+ const svn_checksum_t *checksum;
+
+ SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, &checksum,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, 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));
+#else
SVN_ERR(svn_wc__text_base_path(result_abspath, db, local_abspath,
result_pool));
/* Return an error if the file does not exist */
@@ -283,6 +302,7 @@ svn_wc__text_base_path_to_read(const cha
svn_dirent_local_style(local_abspath,
result_pool));
}
+#endif
return SVN_NO_ERROR;
}
@@ -319,6 +339,23 @@ svn_wc__ultimate_base_text_path(const ch
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+#ifdef SVN_EXPERIMENTAL_PRISTINE
+ const svn_checksum_t *checksum;
+
+ SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, &checksum,
+ NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (checksum == NULL)
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Node '%s' has no pristine base 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));
+#else
svn_error_t *err;
svn_boolean_t replaced;
@@ -338,6 +375,7 @@ svn_wc__ultimate_base_text_path(const ch
else
SVN_ERR(svn_wc__text_base_path(result_abspath, db, local_abspath,
result_pool));
+#endif
return SVN_NO_ERROR;
}
@@ -413,7 +451,7 @@ svn_wc__get_ultimate_base_contents(svn_s
/* There's no "revert base", so open the "normal base". */
err = svn_wc__text_base_path_to_read(&revert_base, db, local_abspath,
- scratch_pool);
+ scratch_pool, scratch_pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
{
svn_error_clear(err);
@@ -439,10 +477,11 @@ svn_wc__get_pristine_contents(svn_stream
{
svn_wc__db_status_t status;
svn_wc__db_kind_t kind;
+ const svn_checksum_t *sha1_checksum;
- SVN_ERR(svn_wc__db_read_info(&status, &kind,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, &sha1_checksum,
+ NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
db, local_abspath, scratch_pool, scratch_pool));
@@ -495,13 +534,20 @@ svn_wc__get_pristine_contents(svn_stream
&& status != svn_wc__db_status_obstructed_delete
&& status != svn_wc__db_status_base_deleted);
- /* ### TODO 1.7: use pristine store instead of this block: */
+#ifdef SVN_EXPERIMENTAL_PRISTINE
+ if (sha1_checksum)
+ SVN_ERR(svn_wc__db_pristine_read(contents, db, local_abspath,
+ sha1_checksum,
+ result_pool, scratch_pool));
+ else
+ *contents = NULL;
+#else
{
const char *text_base;
svn_error_t *err;
err = svn_wc__text_base_path_to_read(&text_base, db, local_abspath,
- scratch_pool);
+ scratch_pool, scratch_pool);
/* ### now for some ugly hackiness. right now, file externals will
### sometimes put their pristine contents into the revert base,
### because they think they're *replaced* nodes, rather than
@@ -528,6 +574,7 @@ svn_wc__get_pristine_contents(svn_stream
SVN_ERR(svn_stream_open_readonly(contents, text_base,
result_pool, scratch_pool));
}
+#endif
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=947744&r1=947743&r2=947744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Mon May 24 18:20:14 2010
@@ -161,7 +161,8 @@ 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 *result_pool,
+ apr_pool_t *scratch_pool);
/* Set *RESULT_ABSPATH to the path of the WC-1 "revert-base" text of the
versioned file LOCAL_ABSPATH in DB.
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=947744&r1=947743&r2=947744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon May 24 18:20:14 2010
@@ -2291,7 +2291,7 @@ svn_wc_get_pristine_copy_path(const char
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
err = svn_wc__text_base_path_to_read(pristine_path, db, local_abspath,
- pool);
+ pool, pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
{
const char *adm_abspath = svn_dirent_dirname(local_abspath, pool);
Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=947744&r1=947743&r2=947744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Mon May 24 18:20:14 2010
@@ -152,12 +152,13 @@ static svn_error_t *
get_nearest_pristine_text_as_file(const char **result_abspath,
svn_wc__db_t *db,
const char *local_abspath,
- apr_pool_t *result_pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_error_t *err;
err = svn_wc__text_base_path_to_read(result_abspath, db, local_abspath,
- result_pool);
+ result_pool, scratch_pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
{
@@ -608,7 +609,7 @@ file_diff(struct dir_baton *db,
### There shouldn't be cases where the result is NULL, but at present
there might be - see get_nearest_pristine_text_as_file(). */
SVN_ERR(get_nearest_pristine_text_as_file(&textbase, eb->db, local_abspath,
- pool));
+ pool, pool));
SVN_ERR(get_empty_file(eb, &empty_file));
@@ -1000,7 +1001,8 @@ report_wc_file_as_added(struct dir_baton
if (eb->use_text_base)
SVN_ERR(svn_wc__text_base_path_to_read(&source_file,
- eb->db, local_abspath, pool));
+ eb->db, local_abspath,
+ pool, pool));
else
source_file = path;
@@ -1230,7 +1232,7 @@ delete_entry(const char *path,
SVN_ERR(svn_wc__text_base_path_to_read(&textbase,
eb->db, local_abspath,
- pool));
+ pool, pool));
SVN_ERR(svn_wc__get_pristine_props(&baseprops, eb->db, local_abspath,
pool, pool));
@@ -1601,7 +1603,7 @@ close_file(void *file_baton,
if (!temp_file_path)
SVN_ERR(svn_wc__text_base_path_to_read(&temp_file_path,
eb->db, fb->local_abspath,
- fb->pool));
+ fb->pool, 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
@@ -1666,7 +1668,7 @@ close_file(void *file_baton,
if (eb->use_text_base)
SVN_ERR(svn_wc__text_base_path_to_read(&localfile,
eb->db, fb->local_abspath,
- fb->pool));
+ fb->pool, pool));
else
/* a detranslated version of the working file */
SVN_ERR(svn_wc__internal_translated_file(
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=947744&r1=947743&r2=947744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Mon May 24 18:20:14 2010
@@ -492,7 +492,7 @@ verify_pristine_present(svn_wc__db_t *db
/* Verify that one of the two text bases are present. */
err = svn_wc__text_base_path_to_read(&base_abspath, db, local_abspath,
- scratch_pool);
+ scratch_pool, scratch_pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
{
svn_error_clear(err);
@@ -1425,7 +1425,7 @@ log_do_committed(svn_wc__db_t *db,
timestamp instead. */
SVN_ERR(svn_wc__text_base_path_to_read(&base_abspath,
db, local_abspath,
- pool));
+ pool, pool));
SVN_ERR(svn_io_stat(&basef_finfo, base_abspath,
APR_FINFO_MIN | APR_FINFO_LINK,
pool));