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/25 17:24:40 UTC
svn commit: r927478 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
log.c log.h merge.c props.c update_editor.c
Author: gstein
Date: Thu Mar 25 16:24:40 2010
New Revision: 927478
URL: http://svn.apache.org/viewvc?rev=927478&view=rev
Log:
Fix up some pristine handling and log running/management.
In r926814, I compensated for a case where an added file *had* a pristine
and the code was expecting that. Thus, I disabled the special check for
added files. This was incorrect: added files should NOT have pristines,
and the code (svn_wc_add_repos_file4) which expected it... was wrong. This
revision fixes that assumption, and restores the correct behavior to
svn_wc__get_pristine_contents()
This also eliminates svn_wc__run_log2() in favor of manual write checks
and directly calling the wq_run() function. By directly using wq_run(), we
also get to pass a cancel func/baton.
* subversion/libsvn_wc/update_editor.c:
(cleanup_dir_baton): directly call wq_run and don't bother with a write
check. when a dir was opened, that was performed.
(do_entry_deletion, close_directory): directly call wq_run.
(open_directory): perform a write check for this directory
(svn_wc_add_repos_file4): svn_wc__open_writable_base returns an abspath,
so note that with the localvar and remove a get_absolute later. only
install a text base for copied fles. directly call wq_run. if the file
is added, then construct the working file from the temp "pristine"
rather than from the true pristine source. finally, only use
OP_FILE_INSTALL for copied files (which have pristines).
* subversion/libsvn_wc/adm_ops.c:
(svn_wc__get_pristine_contents): restore the check for "added" nodes,
which have no pristine.
* subversion/libsvn_wc/log.h:
* subversion/libsvn_wc/log.c:
(svn_wc__run_log2): removed
* subversion/libsvn_wc/merge.c:
(svn_wc_merge4): move the computation of DIR_ABSPATH to a tighter scope.
perform a write check, and then call wq_run with the cancel func/baton.
* subversion/libsvn_wc/props.c:
(svn_wc_merge_props3): move the declaration of KIND to a tighter scope
and simplify the computation of DIR_ABSPATH. perform a write check,
and then install the props and stuff, then call wq_run with the cancel
func/baton. combined two if-blocks for clarity.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/log.c
subversion/trunk/subversion/libsvn_wc/log.h
subversion/trunk/subversion/libsvn_wc/merge.c
subversion/trunk/subversion/libsvn_wc/props.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Mar 25 16:24:40 2010
@@ -2256,12 +2256,9 @@ svn_wc__get_pristine_contents(svn_stream
if (status == svn_wc__db_status_added)
{
- /* ### locally-added nodes *do* have a pristine. we install it when
- ### the node is added/copied/moved. */
-#if 0
- /* For an added node, we return an empty stream. Make sure this is not
- * copied-here or moved-here, in which case we return the copy/move
- * source's contents. */
+ /* For an added node, we return "no stream". Make sure this is not
+ copied-here or moved-here, in which case we return the copy/move
+ source's contents. */
SVN_ERR(svn_wc__db_scan_addition(&status,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL,
@@ -2273,7 +2270,6 @@ svn_wc__get_pristine_contents(svn_stream
*contents = NULL;
return SVN_NO_ERROR;
}
-#endif
}
else if (status == svn_wc__db_status_not_present)
/* We know that the delete of this node has been committed.
Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Thu Mar 25 16:24:40 2010
@@ -760,23 +760,6 @@ svn_wc__run_xml_log(svn_wc__db_t *db,
}
-svn_error_t *
-svn_wc__run_log2(svn_wc__db_t *db,
- const char *adm_abspath,
- apr_pool_t *scratch_pool)
-{
- /* Verify that we're holding this directory's write lock. */
- SVN_ERR(svn_wc__write_check(db, adm_abspath, scratch_pool));
-
- return svn_error_return(svn_wc__wq_run(
- db, adm_abspath,
- NULL, NULL,
- scratch_pool));
-}
-
-
-
-
/*** Log file generation helpers ***/
/* Extend LOG_ACCUM with log operations to do MOVE_COPY_OP to SRC_PATH and
Modified: subversion/trunk/subversion/libsvn_wc/log.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.h?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.h (original)
+++ subversion/trunk/subversion/libsvn_wc/log.h Thu Mar 25 16:24:40 2010
@@ -304,17 +304,6 @@ svn_wc__loggy_remove(svn_stringbuf_t **l
apr_pool_t *scratch_pool);
-/* Process the instructions in the log file for ADM_ABSPATH,
- using its access baton that MUST BE cached in DB.
-
- Use SCRATCH_POOL for temporary allocations.
- */
-svn_error_t *
-svn_wc__run_log2(svn_wc__db_t *db,
- const char *adm_abspath,
- apr_pool_t *scratch_pool);
-
-
/* TODO ###
Use SCRATCH_POOL for temporary allocations.
Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Thu Mar 25 16:24:40 2010
@@ -1293,7 +1293,6 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
apr_pool_t *scratch_pool)
{
svn_stringbuf_t *log_accum = svn_stringbuf_create("", scratch_pool);
- const char *dir_abspath = svn_dirent_dirname(target_abspath, scratch_pool);
SVN_ERR(svn_wc__internal_merge(&log_accum, merge_outcome,
wc_ctx->db,
@@ -1313,9 +1312,19 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
/* Write our accumulation of log entries into a log file */
if (!dry_run)
{
+ const char *dir_abspath = svn_dirent_dirname(target_abspath,
+ scratch_pool);
+
+ /* Verify that we're holding this directory's write lock. */
+ SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, scratch_pool));
+
+ /* Add all the work items to the queue, then run it. */
+ /* ### add_loggy takes a DIR, but wq_run is a simple WRI_ABSPATH */
SVN_ERR(svn_wc__wq_add_loggy(wc_ctx->db, dir_abspath,
log_accum, scratch_pool));
- SVN_ERR(svn_wc__run_log2(wc_ctx->db, dir_abspath, scratch_pool));
+ SVN_ERR(svn_wc__wq_run(wc_ctx->db, target_abspath,
+ cancel_func, cancel_baton,
+ scratch_pool));
}
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Thu Mar 25 16:24:40 2010
@@ -656,7 +656,6 @@ svn_wc_merge_props3(svn_wc_notify_state_
void *cancel_baton,
apr_pool_t *pool /* scratch_pool */)
{
- svn_wc__db_kind_t kind;
svn_boolean_t hidden;
svn_stringbuf_t *log_accum;
apr_hash_t *new_base_props;
@@ -691,33 +690,33 @@ svn_wc_merge_props3(svn_wc_notify_state_
pool, pool));
if (!dry_run)
- SVN_ERR(svn_wc__install_props(wc_ctx->db, local_abspath,
- new_base_props, new_actual_props,
- base_merge, FALSE, pool));
-
-
- if (! dry_run)
{
+ svn_wc__db_kind_t kind;
const char *dir_abspath;
SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath,
FALSE, pool));
+ if (kind == svn_wc__db_kind_dir)
+ dir_abspath = local_abspath;
+ else
+ dir_abspath = svn_dirent_dirname(local_abspath, pool);
- switch (kind)
- {
- case svn_wc__db_kind_dir:
- dir_abspath = local_abspath;
- break;
- default:
- dir_abspath = svn_dirent_dirname(local_abspath, pool);
- break;
- }
+ /* Verify that we're holding this directory's write lock. */
+ SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, pool));
+
+ SVN_ERR(svn_wc__install_props(wc_ctx->db, local_abspath,
+ new_base_props, new_actual_props,
+ base_merge, FALSE, pool));
+
+ /* ### add_loggy takes a DIR, but wq_run is a simple WRI_ABSPATH */
if (! svn_stringbuf_isempty(log_accum))
- SVN_ERR(svn_wc__wq_add_loggy(wc_ctx->db, dir_abspath, log_accum,
- pool));
+ SVN_ERR(svn_wc__wq_add_loggy(wc_ctx->db, dir_abspath, log_accum,
+ pool));
- SVN_ERR(svn_wc__run_log2(wc_ctx->db, dir_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(wc_ctx->db, local_abspath,
+ cancel_func, cancel_baton,
+ pool));
}
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=927478&r1=927477&r2=927478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Mar 25 16:24:40 2010
@@ -532,7 +532,9 @@ cleanup_dir_baton(void *dir_baton)
err = flush_log(db, pool);
if (!err)
- err = svn_wc__run_log2(eb->db, db->local_abspath, pool);
+ err = svn_wc__wq_run(eb->db, db->local_abspath,
+ eb->cancel_func, eb->cancel_baton,
+ pool);
/* If the editor aborts for some sort of error, the command line
client relies on pool cleanup to run outstanding work queues and
@@ -2156,7 +2158,9 @@ do_entry_deletion(struct edit_baton *eb,
* Do this before schedule_existing_item_for_re_add(), in case
* that needs to modify the same entries. */
SVN_ERR(svn_wc__wq_add_loggy(eb->db, dir_abspath, log_accum, pool));
- SVN_ERR(svn_wc__run_log2(eb->db, dir_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(eb->db, dir_abspath,
+ eb->cancel_func, eb->cancel_baton,
+ pool));
SVN_ERR(svn_wc__db_temp_op_make_copy(eb->db, local_abspath, TRUE,
pool));
@@ -2185,7 +2189,9 @@ do_entry_deletion(struct edit_baton *eb,
* Do this before schedule_existing_item_for_re_add(), in case
* that needs to modify the same entries. */
SVN_ERR(svn_wc__wq_add_loggy(eb->db, dir_abspath, log_accum, pool));
- SVN_ERR(svn_wc__run_log2(eb->db, dir_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(eb->db, dir_abspath,
+ eb->cancel_func, eb->cancel_baton,
+ pool));
SVN_ERR(svn_wc__db_temp_op_make_copy(eb->db, local_abspath, TRUE,
pool));
@@ -2266,7 +2272,9 @@ do_entry_deletion(struct edit_baton *eb,
/* Note: these two lines are duplicated in the tree-conflicts bail out
* above. */
- SVN_ERR(svn_wc__run_log2(eb->db, dir_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(eb->db, dir_abspath,
+ eb->cancel_func, eb->cancel_baton,
+ pool));
/* Notify. (If tree_conflict, we've already notified.) */
if (eb->notify_func
@@ -2769,6 +2777,9 @@ open_directory(const char *path,
SVN_ERR(make_dir_baton(&db, path, eb, pb, FALSE, pool));
*child_baton = db;
+ /* We should have a write lock on every directory touched. */
+ SVN_ERR(svn_wc__write_check(eb->db, db->local_abspath, pool));
+
if (pb->skip_descendants)
{
if (!pb->skip_this)
@@ -3133,7 +3144,9 @@ close_directory(void *dir_baton,
last_change->cmt_author,
pool));
- SVN_ERR(svn_wc__run_log2(eb->db, db->local_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(eb->db, db->local_abspath,
+ eb->cancel_func, eb->cancel_baton,
+ pool));
/* We're done with this directory, so remove one reference from the
bump information. This may trigger a number of actions. See
@@ -5040,7 +5053,8 @@ close_file(void *file_baton,
SVN_ERR(svn_wc__wq_run(eb->db,
fb->dir_baton->local_abspath,
- NULL, NULL, pool));
+ eb->cancel_func, eb->cancel_baton,
+ pool));
}
/* ### Hack: The following block should be an atomic operation (including the install
@@ -6046,7 +6060,9 @@ svn_wc_add_repos_file4(svn_wc_context_t
tmp_text_path, pool, pool));
}
- /* Install new text base. */
+ /* Install new text base for copied files. Added files do NOT have a
+ text base. */
+ if (copyfrom_url != NULL)
{
svn_wc_entry_t tmp_entry;
@@ -6076,7 +6092,9 @@ svn_wc_add_repos_file4(svn_wc_context_t
/* ### execute the work items which construct the node, allowing the
### wc_db operation to tweak the WORKING_NODE row. these values
### should be set some other way. */
- SVN_ERR(svn_wc__run_log2(db, dir_abspath, pool));
+ SVN_ERR(svn_wc__wq_run(db, dir_abspath,
+ cancel_func, cancel_baton,
+ pool));
SVN_ERR(svn_wc__db_temp_op_set_working_last_change(
db, local_abspath,
last_change->cmt_rev,
@@ -6085,12 +6103,27 @@ svn_wc_add_repos_file4(svn_wc_context_t
pool));
}
+ /* 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(&post_props_accum, dir_abspath,
+ tmp_text_base_abspath, local_abspath,
+ pool, pool));
+
+ /* After copying to the working directory, lose the temp file. */
+ SVN_ERR(svn_wc__loggy_remove(&post_props_accum, dir_abspath,
+ tmp_text_base_abspath, pool, pool));
+ }
+
/* ### /HACK */
SVN_ERR(svn_wc__wq_add_loggy(db, dir_abspath, post_props_accum, pool));
/* If a working file was not provided by the caller, then install one
- from the text base (with appropriate translation). */
- if (new_contents == NULL)
+ 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;
@@ -6106,5 +6139,7 @@ svn_wc_add_repos_file4(svn_wc_context_t
SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, pool));
}
- return svn_error_return(svn_wc__run_log2(db, dir_abspath, pool));
+ return svn_error_return(svn_wc__wq_run(db, dir_abspath,
+ cancel_func, cancel_baton,
+ pool));
}