You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/03/31 22:21:26 UTC
svn commit: r929706 - in /subversion/trunk/subversion/libsvn_wc:
adm_crawler.c update_editor.c workqueue.c workqueue.h
Author: gstein
Date: Wed Mar 31 20:21:25 2010
New Revision: 929706
URL: http://svn.apache.org/viewvc?rev=929706&view=rev
Log:
Enable file installation from arbitrary paths, rather than just the node's
pristine text. Use this feature in svn_wc_add_repos_file4().
* subversion/libsvn_wc/workqueue.h:
(svn_wc__wq_build_file_install): add SOURCE_ABSPATH parameter
* subversion/libsvn_wc/workqueue.c:
(svn_wc__wq_build_file_install): add a SOURCE_ABSPATH parameter and
insert it into the skel if not-NULL.
(run_file_install): if the SOURCE_ABSPATH is present in the work item,
then use it to open a readonly source stream. Otherwise, use the
pristine contents.
* subversion/libsvn_wc/update_editor.c:
(svn_wc_add_repos_file4): remove WC_PROPS localvar and its use in the
svn_categorize_props() call; we don't need/use it. remove the various
loggy_copy and loggy_remove calls, consolidating these at the end of
the function to install the working copy file.
* subversion/libsvn_wc/adm_crawler.c:
(restore_file): pass NULL for SOURCE_ABSPATH to wq_build_file_install.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_crawler.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/libsvn_wc/workqueue.c
subversion/trunk/subversion/libsvn_wc/workqueue.h
Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=929706&r1=929705&r2=929706&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Wed Mar 31 20:21:25 2010
@@ -73,6 +73,7 @@ restore_file(svn_wc__db_t *db,
SVN_ERR(svn_wc__wq_build_file_install(&work_item,
db, local_abspath,
+ NULL /* source_abspath */,
use_commit_times,
TRUE /* record_fileinfo */,
scratch_pool, scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=929706&r1=929705&r2=929706&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Wed Mar 31 20:21:25 2010
@@ -5712,6 +5712,7 @@ svn_wc_add_repos_file4(svn_wc_context_t
svn_stringbuf_t *log_accum;
struct last_change_info *last_change = NULL;
svn_error_t *err;
+ const char *source_abspath = NULL;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(new_base_contents != NULL);
@@ -5866,7 +5867,6 @@ svn_wc_add_repos_file4(svn_wc_context_t
/* Categorize the base properties. */
{
apr_array_header_t *regular_props;
- apr_array_header_t *wc_props;
apr_array_header_t *entry_props;
apr_array_header_t *prop_array;
@@ -5875,7 +5875,7 @@ svn_wc_add_repos_file4(svn_wc_context_t
SVN_ERR(svn_prop_diffs(&prop_array, new_base_props,
apr_hash_make(pool), pool));
SVN_ERR(svn_categorize_props(prop_array,
- &entry_props, &wc_props, ®ular_props,
+ &entry_props, NULL, ®ular_props,
pool));
/* Put regular props back into a hash table. */
@@ -5907,40 +5907,18 @@ svn_wc_add_repos_file4(svn_wc_context_t
/* Install working file. */
if (new_contents)
{
- /* If the caller gave us a new working file, copy it in place. */
svn_stream_t *tmp_contents;
- const char *tmp_text_path;
- /* ### it may be nice to have an option to OP_FILE_INSTALL to allow
- ### an installation from an alternate location (TMP_TEXT_PATH). */
-
- SVN_ERR(svn_stream_open_unique(&tmp_contents, &tmp_text_path,
+ /* If the caller gave us a new working file, copy it to a safe
+ (temporary) location. We'll then translate/copy that into place
+ after the node's state has been created. */
+ SVN_ERR(svn_stream_open_unique(&tmp_contents, &source_abspath,
temp_dir_abspath, svn_io_file_del_none,
pool, pool));
SVN_ERR(svn_stream_copy3(new_contents,
tmp_contents,
cancel_func, cancel_baton,
pool));
-
- /* Translate new temporary text file to working text. */
- SVN_ERR(svn_wc__loggy_copy(&log_accum, dir_abspath,
- tmp_text_path, local_abspath,
- pool, pool));
- SVN_WC__FLUSH_LOG_ACCUM(db, dir_abspath, log_accum, pool);
-
- /* After copying to the working directory, lose the temp file. */
- {
- const svn_skel_t *work_item;
-
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- db, tmp_text_path,
- pool, pool));
- /* ### we should pass WORK_ITEM to some wc_db api that constructs
- ### this new node. but alas, we do so much of this in pieces,
- ### and not using wc_db apis. so just manually add the work item
- ### into the queue. */
- SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, pool));
- }
}
/* Install new text base for copied files. Added files do NOT have a
@@ -5980,23 +5958,46 @@ svn_wc_add_repos_file4(svn_wc_context_t
last_change->cmt_author,
pool));
}
+
+ /* ### /HACK */
/* For added files without NEW_CONTENTS, then generate the working file
from the provided "pristine" contents. */
if (new_contents == NULL && copyfrom_url == NULL)
- {
- /* Translate new temporary text file to working text. */
- SVN_ERR(svn_wc__loggy_copy(&log_accum, dir_abspath,
- tmp_text_base_abspath, local_abspath,
- pool, pool));
- SVN_WC__FLUSH_LOG_ACCUM(db, dir_abspath, log_accum, pool);
+ source_abspath = tmp_text_base_abspath;
- /* After copying to the working directory, lose the temp file. */
- {
- const svn_skel_t *work_item;
+ {
+ const svn_skel_t *work_item;
+ svn_boolean_t record_fileinfo;
+ /* If new contents were provided, then we do NOT want to record the
+ file information. We assume the new contents do not match the
+ "proper" values for TRANSLATED_SIZE and LAST_MOD_TIME. */
+ record_fileinfo = new_contents == NULL;
+
+ /* Install the working copy file (with appropriate translation) from
+ the appropriate source. SOURCE_ABSPATH will be NULL, indicating an
+ installation from the pristine (available for copied/moved files),
+ or it will specify a temporary file where we placed a "pristine"
+ (for an added file) or a detranslated local-mods file. */
+ SVN_ERR(svn_wc__wq_build_file_install(&work_item,
+ db, local_abspath,
+ source_abspath,
+ FALSE /* use_commit_times */,
+ record_fileinfo,
+ pool, pool));
+ /* ### we should pass WORK_ITEM to some wc_db api that constructs
+ ### this new node. but alas, we do so much of this in pieces,
+ ### and not using wc_db apis. so just manually add the work item
+ ### into the queue. */
+ SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, pool));
+
+ /* If we installed from somewhere besides the official pristine, then
+ it is a temporary file, which needs to be removed. */
+ if (source_abspath != NULL)
+ {
SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- db, tmp_text_base_abspath,
+ db, source_abspath,
pool, pool));
/* ### we should pass WORK_ITEM to some wc_db api that constructs
### this new node. but alas, we do so much of this in pieces,
@@ -6004,28 +6005,7 @@ svn_wc_add_repos_file4(svn_wc_context_t
### into the queue. */
SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, pool));
}
- }
-
- /* ### /HACK */
-
- /* If a working file was not provided by the caller, then install one
- from the text base (with appropriate translation). Note that the
- text base is available only for copied files. */
- if (new_contents == NULL && copyfrom_url != NULL)
- {
- const svn_skel_t *work_item;
-
- SVN_ERR(svn_wc__wq_build_file_install(&work_item,
- db, local_abspath,
- FALSE /* use_commit_times */,
- TRUE /* record_fileinfo */,
- pool, pool));
- /* ### we should pass WORK_ITEM to some wc_db api that constructs
- ### this new node. but alas, we do so much of this in pieces,
- ### and not using wc_db apis. so just manually add the work item
- ### into the queue. */
- SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, pool));
- }
+ }
return svn_error_return(svn_wc__wq_run(db, dir_abspath,
cancel_func, cancel_baton,
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=929706&r1=929705&r2=929706&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Wed Mar 31 20:21:25 2010
@@ -1920,6 +1920,7 @@ run_file_install(svn_wc__db_t *db,
apr_pool_t *scratch_pool)
{
const svn_skel_t *arg1 = work_item->children->next;
+ const svn_skel_t *arg4 = arg1->next->next->next;
const char *local_abspath;
svn_boolean_t use_commit_times;
svn_boolean_t record_fileinfo;
@@ -1936,10 +1937,22 @@ run_file_install(svn_wc__db_t *db,
use_commit_times = svn_skel__parse_int(arg1->next, scratch_pool) != 0;
record_fileinfo = svn_skel__parse_int(arg1->next->next, scratch_pool) != 0;
- /* Get the pristine contents (from WORKING or BASE, as appropriate). */
- SVN_ERR(svn_wc__get_pristine_contents(&src_stream, db, local_abspath,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(src_stream != NULL);
+ if (arg4 == NULL)
+ {
+ /* Get the pristine contents (from WORKING or BASE, as appropriate). */
+ SVN_ERR(svn_wc__get_pristine_contents(&src_stream, db, local_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR_ASSERT(src_stream != NULL);
+ }
+ else
+ {
+ const char *source_abspath;
+
+ /* Use the provided path for the source. */
+ source_abspath = apr_pstrmemdup(scratch_pool, arg4->data, arg4->len);
+ SVN_ERR(svn_stream_open_readonly(&src_stream, source_abspath,
+ scratch_pool, scratch_pool));
+ }
SVN_ERR(svn_wc__get_special(&special, db, local_abspath, scratch_pool));
if (special)
@@ -2060,6 +2073,7 @@ svn_error_t *
svn_wc__wq_build_file_install(const svn_skel_t **work_item,
svn_wc__db_t *db,
const char *local_abspath,
+ const char *source_abspath,
svn_boolean_t use_commit_times,
svn_boolean_t record_fileinfo,
apr_pool_t *result_pool,
@@ -2067,6 +2081,12 @@ svn_wc__wq_build_file_install(const svn_
{
svn_skel_t *build_item = svn_skel__make_empty_list(result_pool);
+ /* If a SOURCE_ABSPATH was provided, then put it into the skel. If this
+ value is not provided, then the file's pristine contents will be used. */
+ if (source_abspath != NULL)
+ svn_skel__prepend_str(apr_pstrdup(result_pool, source_abspath),
+ build_item, result_pool);
+
svn_skel__prepend_int(record_fileinfo, build_item, result_pool);
svn_skel__prepend_int(use_commit_times, build_item, result_pool);
svn_skel__prepend_str(apr_pstrdup(result_pool, local_abspath),
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=929706&r1=929705&r2=929706&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Wed Mar 31 20:21:25 2010
@@ -66,11 +66,19 @@ svn_wc__wq_run(svn_wc__db_t *db,
copy file at LOCAL_ABSPATH. If USE_COMMIT_TIMES is TRUE, then the newly
installed file will use the nodes CHANGE_DATE for the file timestamp.
If RECORD_FILEINFO is TRUE, then the resulting LAST_MOD_TIME and
- TRANSLATED_SIZE will be recorded in the database. */
+ TRANSLATED_SIZE will be recorded in the database.
+
+ If SOURCE_ABSPATH is NULL, then the pristine contents will be installed
+ (with appropriate translation). If SOURCE_ABSPATH is not NULL, then it
+ specifies a source file for the translation. The file must exist for as
+ long as *WORK_ITEM exists (and is queued). Typically, it will be a
+ temporary file, and an OP_FILE_REMOVE will be queued to later remove it.
+*/
svn_error_t *
svn_wc__wq_build_file_install(const svn_skel_t **work_item,
svn_wc__db_t *db,
const char *local_abspath,
+ const char *source_abspath,
svn_boolean_t use_commit_times,
svn_boolean_t record_fileinfo,
apr_pool_t *result_pool,