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/04/25 07:19:24 UTC
svn commit: r937744 - in /subversion/trunk/subversion/libsvn_wc: log.c log.h
props.c
Author: gstein
Date: Sun Apr 25 05:19:23 2010
New Revision: 937744
URL: http://svn.apache.org/viewvc?rev=937744&view=rev
Log:
Adjust the prop merge logic to queue all prop conflicts into a conflict
skel, and dump that into a file all at once. The old code wrote to a
temporary file piece-meal. After the file has been written (into a tmp
area), then a loggy operation will later move it into place in the working
copy.
This obsoletes the non-idempotent loggy_append functionality.
* subversion/libsvn_wc/props.c:
(open_reject_tmp_stream): remove. unused.
(create_conflict_file): new function to write a set of prop conflicts
into a temporary file.
(svn_wc__merge_props): collect the prop conflicts into a single
CONFLICT_SKEL, rather than writing them into a temp file. if the merge
is not a DRY_RUN, then dump those conflicts into a temp file for later
movement into the working copy (via a loggy operation).
* subversion/libsvn_wc/log.h:
(svn_wc__loggy_append): removed. no longer used.
* subversion/libsvn_wc/log.c:
(SVN_WC__LOG_APPEND, log_do_file_append, svn_wc__loggy_append): removed
(start_handler): remove handling of SVN_WC__LOG_APPEND
Modified:
subversion/trunk/subversion/libsvn_wc/log.c
subversion/trunk/subversion/libsvn_wc/log.h
subversion/trunk/subversion/libsvn_wc/props.c
Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=937744&r1=937743&r2=937744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Sun Apr 25 05:19:23 2010
@@ -88,9 +88,6 @@
the DEST. */
#define SVN_WC__LOG_CP_AND_TRANSLATE "cp-and-translate"
-/* Append file from SVN_WC__LOG_ATTR_NAME to SVN_WC__LOG_ATTR_DEST. */
-#define SVN_WC__LOG_APPEND "append"
-
/* Make file SVN_WC__LOG_ATTR_NAME readonly */
#define SVN_WC__LOG_READONLY "readonly"
@@ -152,25 +149,6 @@ struct log_runner
static svn_error_t *
-log_do_file_append(const char *from_abspath,
- const char *dest_abspath,
- apr_pool_t *scratch_pool)
-{
- svn_error_t *err;
-
- err = svn_io_append_file(from_abspath, dest_abspath, scratch_pool);
- if (err)
- {
- if (!APR_STATUS_IS_ENOENT(err->apr_err))
- return svn_error_return(err);
- svn_error_clear(err);
- }
-
- return SVN_NO_ERROR;
-}
-
-
-static svn_error_t *
log_do_file_cp_and_translate(svn_wc__db_t *db,
const char *from_abspath,
const char *dest_abspath,
@@ -623,16 +601,6 @@ start_handler(void *userData, const char
err = log_do_file_cp_and_translate(loggy->db, from_abspath, dest_abspath,
versioned_abspath, loggy->pool);
}
- else if (strcmp(eltname, SVN_WC__LOG_APPEND) == 0) {
- const char *dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
- const char *from_abspath;
- const char *dest_abspath;
-
- SVN_ERR_ASSERT_NO_RETURN(dest != NULL);
- from_abspath = svn_dirent_join(loggy->adm_abspath, name, loggy->pool);
- dest_abspath = svn_dirent_join(loggy->adm_abspath, dest, loggy->pool);
- err = log_do_file_append(from_abspath, dest_abspath, loggy->pool);
- }
else if (strcmp(eltname, SVN_WC__LOG_READONLY) == 0) {
err = log_do_file_readonly(loggy, name);
}
@@ -736,31 +704,6 @@ loggy_path(const char **logy_path,
svn_error_t *
-svn_wc__loggy_append(svn_wc__db_t *db,
- const char *adm_abspath,
- const char *src, const char *dst,
- apr_pool_t *scratch_pool)
-{
- const char *loggy_path1;
- const char *loggy_path2;
- svn_stringbuf_t *log_accum = NULL;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(adm_abspath));
-
- SVN_ERR(loggy_path(&loggy_path1, src, adm_abspath, scratch_pool));
- SVN_ERR(loggy_path(&loggy_path2, dst, adm_abspath, scratch_pool));
- svn_xml_make_open_tag(&log_accum, scratch_pool,
- svn_xml_self_closing, SVN_WC__LOG_APPEND,
- SVN_WC__LOG_ATTR_NAME, loggy_path1,
- SVN_WC__LOG_ATTR_DEST, loggy_path2,
- NULL);
-
- return svn_error_return(svn_wc__wq_add_loggy(db, adm_abspath, log_accum,
- scratch_pool));
-}
-
-
-svn_error_t *
svn_wc__loggy_translated_file(svn_wc__db_t *db,
const char *adm_abspath,
const char *dst_abspath,
Modified: subversion/trunk/subversion/libsvn_wc/log.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.h?rev=937744&r1=937743&r2=937744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.h (original)
+++ subversion/trunk/subversion/libsvn_wc/log.h Sun Apr 25 05:19:23 2010
@@ -43,25 +43,6 @@ extern "C" {
*/
-
-/* Insert into DB a work queue instruction to append the contents
- of SRC to DST.
- SRC and DST are relative to ADM_ABSPATH.
-
- This command fails to be idempotent or atomic: there's no way to
- tell if you should re-run this! This function is deprecated; new
- uses should not be added, and the single current use (constructing
- human-readable non-parsed property conflict files) should be
- rewritten. See Issue #3015.
-*/
-SVN_DEPRECATED
-svn_error_t *
-svn_wc__loggy_append(svn_wc__db_t *db,
- const char *adm_abspath,
- const char *src, const char *dst,
- apr_pool_t *scratch_pool);
-
-
/* Insert into DB a work queue instruction to generate a translated
file from SRC to DST with translation settings from VERSIONED.
ADM_ABSPATH is the absolute path for the admin directory for PATH.
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=937744&r1=937743&r2=937744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Sun Apr 25 05:19:23 2010
@@ -240,26 +240,6 @@ load_actual_props(apr_hash_t **props,
}
-/* Opens reject temporary stream for FULL_PATH in the appropriate tmp space. */
-static svn_error_t *
-open_reject_tmp_stream(svn_stream_t **stream,
- const char **reject_tmp_path,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const char *tmp_base_abspath;
-
- SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmp_base_abspath, db, local_abspath,
- scratch_pool, scratch_pool));
-
- return svn_stream_open_unique(stream, reject_tmp_path, tmp_base_abspath,
- svn_io_file_del_none, result_pool,
- scratch_pool);
-}
-
-
/* Given a *SINGLE* property conflict in PROP_SKEL, generate a message
for it, and write it to STREAM, along with a trailing EOL sequence.
@@ -909,6 +889,46 @@ message_from_skel(const svn_skel_t *skel
}
+/* Create a property conflict file at PREJFILE based on the property
+ conflicts in CONFLICT_SKEL. */
+static svn_error_t *
+create_conflict_file(const char **tmp_prejfile_abspath,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const svn_skel_t *conflict_skel,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *tempdir_abspath;
+ svn_stream_t *stream;
+ const char *temp_abspath;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ const svn_skel_t *scan;
+
+ SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tempdir_abspath,
+ db, local_abspath,
+ iterpool, iterpool));
+
+ SVN_ERR(svn_stream_open_unique(&stream, &temp_abspath,
+ tempdir_abspath, svn_io_file_del_none,
+ scratch_pool, iterpool));
+
+ for (scan = conflict_skel->children->next; scan != NULL; scan = scan->next)
+ {
+ svn_pool_clear(iterpool);
+
+ SVN_ERR(append_prop_conflict(stream, scan, iterpool));
+ }
+
+ SVN_ERR(svn_stream_close(stream));
+
+ svn_pool_destroy(iterpool);
+
+ *tmp_prejfile_abspath = apr_pstrdup(result_pool, temp_abspath);
+ return SVN_NO_ERROR;
+}
+
+
/* Set the value of *STATE to NEW_VALUE if STATE is not NULL
* and NEW_VALUE is a higer order value than *STATE's current value
* using this ordering (lower order first):
@@ -1662,10 +1682,8 @@ svn_wc__merge_props(svn_wc_notify_state_
apr_pool_t *iterpool;
int i;
svn_boolean_t is_dir;
- const char *reject_path = NULL;
- svn_stream_t *reject_tmp_stream = NULL; /* the temporary conflicts stream */
- const char *reject_tmp_path = NULL;
const char *adm_abspath;
+ svn_skel_t *conflict_skel = NULL;
SVN_ERR_ASSERT(base_props != NULL);
SVN_ERR_ASSERT(working_props != NULL);
@@ -1763,7 +1781,13 @@ svn_wc__merge_props(svn_wc_notify_state_
if (conflict_remains)
{
- svn_skel_t *conflict_skel = svn_wc__conflict_skel_new(iterpool);
+ set_prop_merge_state(state, svn_wc_notify_state_conflicted);
+
+ if (dry_run)
+ continue; /* skip to next incoming change */
+
+ if (conflict_skel == NULL)
+ conflict_skel = svn_wc__conflict_skel_new(scratch_pool);
SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(conflict_skel,
propname,
@@ -1771,27 +1795,8 @@ svn_wc__merge_props(svn_wc_notify_state_
mine_val,
to_val,
from_val,
- iterpool,
+ scratch_pool,
iterpool));
-
- set_prop_merge_state(state, svn_wc_notify_state_conflicted);
-
- if (dry_run)
- continue; /* skip to next incoming change */
-
- if (! reject_tmp_stream)
- /* This is the very first prop conflict found on this item. */
- SVN_ERR(open_reject_tmp_stream(&reject_tmp_stream,
- &reject_tmp_path, db,
- local_abspath,
- scratch_pool, iterpool));
-
- /* Append the conflict to the open tmp/PROPS/---.prej file. Note
- that skel->children refers to the OPERATION skel, and ->next
- refers to the single property conflict skel. */
- SVN_ERR(append_prop_conflict(reject_tmp_stream,
- conflict_skel->children->next,
- iterpool));
}
} /* foreach propchange ... */
@@ -1805,14 +1810,16 @@ svn_wc__merge_props(svn_wc_notify_state_
*new_base_props = base_props;
*new_actual_props = working_props;
- if (reject_tmp_stream)
+ if (conflict_skel != NULL)
{
- /* There's a temporary reject file sitting in .svn/tmp/ somewhere. Deal
- with the conflicts. */
+ const char *tmp_prejfile_abspath;
+ const char *reject_path;
- /* First, _close_ this temporary conflicts file. We've been
- appending to it all along. */
- SVN_ERR(svn_stream_close(reject_tmp_stream));
+ /* Construct a property reject file in the temporary area. */
+ SVN_ERR(create_conflict_file(&tmp_prejfile_abspath,
+ db, local_abspath,
+ conflict_skel,
+ scratch_pool, scratch_pool));
/* Now try to get the name of a pre-existing .prej file from the
entries file */
@@ -1847,23 +1854,11 @@ svn_wc__merge_props(svn_wc_notify_state_
disk. */
}
- /* We've now guaranteed that some kind of .prej file exists
- above the .svn/ dir. We write log entries to append our
- conflicts to it. */
- SVN_ERR(svn_wc__loggy_append(db, adm_abspath, reject_tmp_path,
- reject_path, scratch_pool));
-
- /* And of course, delete the temporary reject file. */
- {
- const svn_skel_t *work_item;
-
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- db, reject_tmp_path,
- scratch_pool, scratch_pool));
- /* ### we should pass WORK_ITEM to some wc_db api that records
- ### the property conflicts. */
- SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, scratch_pool));
- }
+ /* Move the temporary file to THE property reject file in the working
+ copy area. */
+ SVN_ERR(svn_wc__loggy_move(db, adm_abspath,
+ tmp_prejfile_abspath, reject_path,
+ scratch_pool));
/* Mark entry as "conflicted" with a particular .prej file. */
{
@@ -1875,8 +1870,7 @@ svn_wc__merge_props(svn_wc_notify_state_
SVN_WC__ENTRY_MODIFY_PREJFILE,
scratch_pool));
}
-
- } /* if (reject_tmp_fp) */
+ }
return SVN_NO_ERROR;
}