You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/08/16 12:18:03 UTC
svn commit: r1373783 [30/50] - in /subversion/branches/compressed-pristines:
./ build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/client-side/svn-push/
contrib/client-side/svnmerge/ cont...
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/props.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/props.c Thu Aug 16 10:17:48 2012
@@ -79,47 +79,12 @@ append_prop_conflict(svn_stream_t *strea
/* TODO: someday, perhaps prefix each conflict_description with a
timestamp or something? */
const svn_string_t *conflict_desc;
- apr_size_t len;
const char *native_text;
SVN_ERR(prop_conflict_from_skel(&conflict_desc, prop_skel, pool, pool));
native_text = svn_utf_cstring_from_utf8_fuzzy(conflict_desc->data, pool);
- len = strlen(native_text);
- return svn_stream_write(stream, native_text, &len);
-}
-
-
-/* Get the property reject file for LOCAL_ABSPATH in DB. Set
- *PREJFILE_ABSPATH to the name of that file, or to NULL if no such
- file is named. The file may, or may not, exist on disk. */
-svn_error_t *
-svn_wc__get_prejfile_abspath(const char **prejfile_abspath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const apr_array_header_t *conflicts;
- int i;
-
- SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
- scratch_pool, scratch_pool));
-
- for (i = 0; i < conflicts->nelts; i++)
- {
- const svn_wc_conflict_description2_t *cd;
- cd = APR_ARRAY_IDX(conflicts, i, const svn_wc_conflict_description2_t *);
-
- if (cd->kind == svn_wc_conflict_kind_property)
- {
- *prejfile_abspath = apr_pstrdup(result_pool, cd->their_abspath);
- return SVN_NO_ERROR;
- }
- }
-
- *prejfile_abspath = NULL;
- return SVN_NO_ERROR;
+ return svn_stream_puts(stream, native_text);
}
/*---------------------------------------------------------------------*/
@@ -239,14 +204,16 @@ svn_wc__perform_props_merge(svn_wc_notif
apr_hash_t *new_actual_props;
svn_boolean_t had_props, props_mod;
svn_boolean_t have_base;
- svn_skel_t *work_items;
+ svn_boolean_t conflicted;
+ svn_skel_t *work_items = NULL;
+ svn_skel_t *conflict_skel = NULL;
/* IMPORTANT: svn_wc_merge_prop_diffs relies on the fact that baseprops
may be NULL. */
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, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, &conflicted, NULL,
&had_props, &props_mod, &have_base, NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool));
@@ -270,6 +237,30 @@ svn_wc__perform_props_merge(svn_wc_notif
_("The node '%s' does not have properties in this state."),
svn_dirent_local_style(local_abspath, scratch_pool));
}
+ else if (conflicted)
+ {
+ svn_boolean_t text_conflicted;
+ svn_boolean_t prop_conflicted;
+ svn_boolean_t tree_conflicted;
+
+ SVN_ERR(svn_wc__internal_conflicted_p(&text_conflicted,
+ &prop_conflicted,
+ &tree_conflicted,
+ db, local_abspath,
+ scratch_pool));
+
+ /* We can't install two text/prop conflicts on a single node, so
+ avoid even checking that we have to merge it */
+ if (text_conflicted || prop_conflicted || tree_conflicted)
+ {
+ return svn_error_createf(
+ SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Can't merge into conflicted node '%s'"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+ /* else: Conflict was resolved by removing markers */
+ }
/* The PROPCHANGES may not have non-"normal" properties in it. If entry
or wc props were allowed, then the following code would install them
@@ -301,24 +292,38 @@ svn_wc__perform_props_merge(svn_wc_notif
/* Note that while this routine does the "real" work, it's only
prepping tempfiles and writing log commands. */
- SVN_ERR(svn_wc__merge_props(&work_items, state,
+ SVN_ERR(svn_wc__merge_props(&conflict_skel, state,
&new_pristine_props, &new_actual_props,
db, local_abspath, kind,
- left_version, right_version,
baseprops /* server_baseprops */,
pristine_props,
actual_props,
propchanges, base_merge, dry_run,
- conflict_func, conflict_baton,
cancel_func, cancel_baton,
scratch_pool, scratch_pool));
if (dry_run)
{
- SVN_ERR_ASSERT(! work_items);
return SVN_NO_ERROR;
}
+ if (conflict_skel)
+ {
+ svn_skel_t *work_item;
+ SVN_ERR(svn_wc__conflict_skel_set_op_merge(conflict_skel,
+ left_version,
+ right_version,
+ scratch_pool,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__conflict_create_markers(&work_item,
+ db, local_abspath,
+ conflict_skel,
+ scratch_pool, scratch_pool));
+
+ work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+ }
+
{
const char *dir_abspath;
@@ -346,9 +351,10 @@ svn_wc__perform_props_merge(svn_wc_notif
return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
U_("base_merge=TRUE is no longer supported"));
#endif
+
SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, new_actual_props,
svn_wc__has_magic_property(propchanges),
- NULL /* conflict */,
+ conflict_skel,
work_items,
scratch_pool));
@@ -357,6 +363,12 @@ svn_wc__perform_props_merge(svn_wc_notif
scratch_pool));
}
+ if (conflict_skel && conflict_func)
+ SVN_ERR(svn_wc__conflict_invoke_resolver(db, local_abspath, conflict_skel,
+ NULL /* merge_options */,
+ conflict_func, conflict_baton,
+ scratch_pool));
+
return SVN_NO_ERROR;
}
@@ -621,7 +633,7 @@ prop_conflict_from_skel(const svn_string
if (!(original_is_binary || mine_is_binary || incoming_is_binary))
{
diff_opts = svn_diff_file_options_create(scratch_pool);
- diff_opts->ignore_space = FALSE;
+ diff_opts->ignore_space = svn_diff_file_ignore_space_none;
diff_opts->ignore_eol_style = FALSE;
diff_opts->show_c_function = FALSE;
SVN_ERR(svn_diff_mem_string_diff3(&diff, original, mine, incoming,
@@ -771,268 +783,6 @@ set_prop_merge_state(svn_wc_notify_state
*state = new_value;
}
-/* Helper function for the three apply_* functions below, used when
- * merging properties together.
- *
- * Given property PROPNAME on LOCAL_ABSPATH, and four possible property
- * values, generate four tmpfiles and pass them to CONFLICT_FUNC callback.
- * This gives the client an opportunity to interactively resolve the
- * property conflict.
- *
- * BASE_VAL/WORKING_VAL represent the current state of the working
- * copy, and INCOMING_OLD_VAL/INCOMING_NEW_VAL represents the incoming
- * propchange. Any of these values might be NULL, indicating either
- * non-existence or intent-to-delete.
- *
- * If the callback isn't available, or if it responds with
- * 'choose_postpone', then set *CONFLICT_REMAINS to TRUE and return.
- *
- * If the callback responds with a choice of 'base', 'theirs', 'mine',
- * or 'merged', then install the proper value into ACTUAL_PROPS and
- * set *CONFLICT_REMAINS to FALSE.
- */
-static svn_error_t *
-maybe_generate_propconflict(svn_boolean_t *conflict_remains,
- svn_wc__db_t *db,
- const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
- const char *propname,
- apr_hash_t *actual_props,
- const svn_string_t *incoming_old_val,
- const svn_string_t *incoming_new_val,
- const svn_string_t *base_val,
- const svn_string_t *working_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
- apr_pool_t *scratch_pool)
-{
- svn_wc_conflict_result_t *result = NULL;
- apr_pool_t *filepool = svn_pool_create(scratch_pool);
- svn_wc_conflict_description2_t *cdesc;
- const char *dirpath = svn_dirent_dirname(local_abspath, filepool);
-
- if (! conflict_func || dry_run)
- {
- /* Just postpone the conflict. */
- *conflict_remains = TRUE;
- return SVN_NO_ERROR;
- }
-
- cdesc = svn_wc_conflict_description_create_prop2(
- local_abspath,
- is_dir ? svn_node_dir : svn_node_file, propname, scratch_pool);
-
- cdesc->src_left_version = left_version;
- cdesc->src_right_version = right_version;
-
- /* Create a tmpfile for each of the string_t's we've got. */
- if (working_val)
- {
- const char *file_name;
-
- SVN_ERR(svn_io_write_unique(&file_name, dirpath, working_val->data,
- working_val->len,
- svn_io_file_del_on_pool_cleanup, filepool));
- cdesc->my_abspath = svn_dirent_join(dirpath, file_name, filepool);
- }
-
- if (incoming_new_val)
- {
- const char *file_name;
-
- SVN_ERR(svn_io_write_unique(&file_name, dirpath, incoming_new_val->data,
- incoming_new_val->len,
- svn_io_file_del_on_pool_cleanup, filepool));
- cdesc->their_abspath = svn_dirent_join(dirpath, file_name, filepool);
- }
-
- if (!base_val && !incoming_old_val)
- {
- /* If base and old are both NULL, then that's fine, we just let
- base_file stay NULL as-is. Both agents are attempting to add a
- new property. */
- }
-
- else if ((base_val && !incoming_old_val)
- || (!base_val && incoming_old_val))
- {
- /* If only one of base and old are defined, then we've got a
- situation where one agent is attempting to add the property
- for the first time, and the other agent is changing a
- property it thinks already exists. In this case, we return
- whichever older-value happens to be defined, so that the
- conflict-callback can still attempt a 3-way merge. */
-
- const svn_string_t *conflict_base_val = base_val ? base_val
- : incoming_old_val;
- const char *file_name;
-
- SVN_ERR(svn_io_write_unique(&file_name, dirpath,
- conflict_base_val->data,
- conflict_base_val->len,
- svn_io_file_del_on_pool_cleanup,
- filepool));
- cdesc->base_abspath = svn_dirent_join(dirpath, file_name, filepool);
- }
-
- else /* base and old are both non-NULL */
- {
- const svn_string_t *conflict_base_val;
- const char *file_name;
-
- if (! svn_string_compare(base_val, incoming_old_val))
- {
- /* What happens if 'base' and 'old' don't match up? In an
- ideal situation, they would. But if they don't, this is
- a classic example of a patch 'hunk' failing to apply due
- to a lack of context. For example: imagine that the user
- is busy changing the property from a value of "cat" to
- "dog", but the incoming propchange wants to change the
- same property value from "red" to "green". Total context
- mismatch.
-
- HOWEVER: we can still pass one of the two base values as
- 'base_file' to the callback anyway. It's still useful to
- present the working and new values to the user to
- compare. */
-
- if (working_val && svn_string_compare(base_val, working_val))
- conflict_base_val = incoming_old_val;
- else
- conflict_base_val = base_val;
- }
- else
- {
- conflict_base_val = base_val;
- }
-
- SVN_ERR(svn_io_write_unique(&file_name, dirpath, conflict_base_val->data,
- conflict_base_val->len,
- svn_io_file_del_on_pool_cleanup, filepool));
- cdesc->base_abspath = svn_dirent_join(dirpath, file_name, filepool);
-
- if (working_val && incoming_new_val)
- {
- svn_stream_t *mergestream;
- svn_diff_t *diff;
- svn_diff_file_options_t *options =
- svn_diff_file_options_create(filepool);
-
- SVN_ERR(svn_stream_open_unique(&mergestream, &cdesc->merged_file,
- NULL, svn_io_file_del_on_pool_cleanup,
- filepool, scratch_pool));
- SVN_ERR(svn_diff_mem_string_diff3(&diff, conflict_base_val,
- working_val,
- incoming_new_val, options, filepool));
- SVN_ERR(svn_diff_mem_string_output_merge2
- (mergestream, diff, conflict_base_val, working_val,
- incoming_new_val, NULL, NULL, NULL, NULL,
- svn_diff_conflict_display_modified_latest, filepool));
- SVN_ERR(svn_stream_close(mergestream));
- }
- }
-
- /* Build the rest of the description object: */
- cdesc->mime_type = (is_dir ? NULL : svn_prop_get_value(actual_props,
- SVN_PROP_MIME_TYPE));
- cdesc->is_binary = (cdesc->mime_type
- && svn_mime_type_is_binary(cdesc->mime_type));
-
- if (!incoming_old_val && incoming_new_val)
- cdesc->action = svn_wc_conflict_action_add;
- else if (incoming_old_val && !incoming_new_val)
- cdesc->action = svn_wc_conflict_action_delete;
- else
- cdesc->action = svn_wc_conflict_action_edit;
-
- if (base_val && !working_val)
- cdesc->reason = svn_wc_conflict_reason_deleted;
- else if (!base_val && working_val)
- cdesc->reason = svn_wc_conflict_reason_obstructed;
- else
- cdesc->reason = svn_wc_conflict_reason_edited;
-
- /* Invoke the interactive conflict callback. */
- {
- SVN_ERR(conflict_func(&result, cdesc, conflict_baton, scratch_pool,
- scratch_pool));
- }
- if (result == NULL)
- {
- *conflict_remains = TRUE;
- return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
- NULL, _("Conflict callback violated API:"
- " returned no results."));
- }
-
- switch (result->choice)
- {
- default:
- case svn_wc_conflict_choose_postpone:
- {
- *conflict_remains = TRUE;
- break;
- }
- case svn_wc_conflict_choose_mine_full:
- {
- /* No need to change actual_props; it already contains working_val */
- *conflict_remains = FALSE;
- break;
- }
- /* I think _mine_full and _theirs_full are appropriate for prop
- behavior as well as the text behavior. There should even be
- analogous behaviors for _mine and _theirs when those are
- ready, namely: fold in all non-conflicting prop changes, and
- then choose _mine side or _theirs side for conflicting ones. */
- case svn_wc_conflict_choose_theirs_full:
- {
- apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING,
- incoming_new_val);
- *conflict_remains = FALSE;
- break;
- }
- case svn_wc_conflict_choose_base:
- {
- apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, base_val);
- *conflict_remains = FALSE;
- break;
- }
- case svn_wc_conflict_choose_merged:
- {
- if (!cdesc->merged_file && !result->merged_file)
- return svn_error_create
- (SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
- NULL, _("Conflict callback violated API:"
- " returned no merged file."));
- else
- {
- svn_stringbuf_t *merged_stringbuf;
- svn_string_t *merged_string;
-
- SVN_ERR(svn_stringbuf_from_file2(&merged_stringbuf,
- result->merged_file ?
- result->merged_file :
- cdesc->merged_file,
- scratch_pool));
- merged_string = svn_stringbuf__morph_into_string(merged_stringbuf);
- apr_hash_set(actual_props, propname,
- APR_HASH_KEY_STRING, merged_string);
- *conflict_remains = FALSE;
- }
- break;
- }
- }
-
- /* Delete any tmpfiles we made. */
- svn_pool_destroy(filepool);
-
- return SVN_NO_ERROR;
-}
-
-
/* Add the property with name PROPNAME to the set of ACTUAL_PROPS on
* PATH, setting *STATE or *CONFLICT_REMAINS according to merge outcomes.
*
@@ -1042,26 +792,16 @@ maybe_generate_propconflict(svn_boolean_
* BASE_VAL contains the working copy base property value
*
* NEW_VAL contains the value to be set.
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict; it gives the client a chance to resolve the
- * conflict interactively.
*/
static svn_error_t *
apply_single_prop_add(svn_wc_notify_state_t *state,
svn_boolean_t *conflict_remains,
svn_wc__db_t *db,
const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
apr_hash_t *actual_props,
const char *propname,
const svn_string_t *base_val,
const svn_string_t *new_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
@@ -1114,31 +854,11 @@ apply_single_prop_add(svn_wc_notify_stat
}
if (!merged_prop)
- {
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir,
- propname, actual_props,
- NULL, new_val,
- base_val, working_val,
- conflict_func,
- conflict_baton,
- dry_run, scratch_pool));
- }
+ *conflict_remains = TRUE;
}
}
else if (base_val)
- {
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir, propname,
- actual_props, NULL, new_val,
- base_val, NULL,
- conflict_func, conflict_baton,
- dry_run, scratch_pool));
- }
+ *conflict_remains = TRUE;
else /* property doesn't yet exist in actual_props... */
/* so just set it */
apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, new_val);
@@ -1158,26 +878,16 @@ apply_single_prop_add(svn_wc_notify_stat
*
* OLD_VAL contains the value the of the property the server
* thinks it's deleting.
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict; it gives the client a chance to resolve the
- * conflict interactively.
*/
static svn_error_t *
apply_single_prop_delete(svn_wc_notify_state_t *state,
svn_boolean_t *conflict_remains,
svn_wc__db_t *db,
const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
apr_hash_t *actual_props,
const char *propname,
const svn_string_t *base_val,
const svn_string_t *old_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1192,14 +902,7 @@ apply_single_prop_delete(svn_wc_notify_s
&& !svn_string_compare(working_val, old_val))
{
/* We are trying to delete a locally-added prop. */
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir, propname,
- actual_props, old_val, NULL,
- base_val, working_val,
- conflict_func, conflict_baton,
- dry_run, scratch_pool));
+ *conflict_remains = TRUE;
}
else
{
@@ -1219,18 +922,7 @@ apply_single_prop_delete(svn_wc_notify_s
/* they have the same values, so it's an update */
apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, NULL);
else
- {
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir,
- propname, actual_props,
- old_val, NULL,
- base_val, working_val,
- conflict_func,
- conflict_baton,
- dry_run, scratch_pool));
- }
+ *conflict_remains = TRUE;
}
else
/* The property is locally deleted from the same value, so it's
@@ -1239,16 +931,7 @@ apply_single_prop_delete(svn_wc_notify_s
}
else
- {
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir, propname,
- actual_props, old_val, NULL,
- base_val, working_val,
- conflict_func, conflict_baton,
- dry_run, scratch_pool));
- }
+ *conflict_remains = TRUE;
return SVN_NO_ERROR;
}
@@ -1266,17 +949,11 @@ apply_single_mergeinfo_prop_change(svn_w
svn_boolean_t *conflict_remains,
svn_wc__db_t *db,
const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
apr_hash_t *actual_props,
const char *propname,
const svn_string_t *base_val,
const svn_string_t *old_val,
const svn_string_t *new_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1314,14 +991,7 @@ apply_single_mergeinfo_prop_change(svn_w
else
{
/* There is a base_val but no working_val */
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir, propname, actual_props,
- old_val, new_val,
- base_val, working_val,
- conflict_func, conflict_baton,
- dry_run, scratch_pool));
+ *conflict_remains = TRUE;
}
}
@@ -1378,17 +1048,11 @@ apply_single_generic_prop_change(svn_wc_
svn_boolean_t *conflict_remains,
svn_wc__db_t *db,
const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
apr_hash_t *actual_props,
const char *propname,
const svn_string_t *base_val,
const svn_string_t *old_val,
const svn_string_t *new_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1416,14 +1080,7 @@ apply_single_generic_prop_change(svn_wc_
else
{
/* Merge the change. */
- SVN_ERR(maybe_generate_propconflict(conflict_remains,
- db, local_abspath,
- left_version, right_version,
- is_dir, propname, actual_props,
- old_val, new_val,
- base_val, working_val,
- conflict_func, conflict_baton,
- dry_run, scratch_pool));
+ *conflict_remains = TRUE;
}
return SVN_NO_ERROR;
@@ -1441,27 +1098,17 @@ apply_single_generic_prop_change(svn_wc_
* thinks it's overwriting. (Not null.)
*
* NEW_VAL contains the value to be set. (Not null.)
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict; it gives the client a chance to resolve the
- * conflict interactively.
*/
static svn_error_t *
apply_single_prop_change(svn_wc_notify_state_t *state,
svn_boolean_t *conflict_remains,
svn_wc__db_t *db,
const char *local_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- svn_boolean_t is_dir,
apr_hash_t *actual_props,
const char *propname,
const svn_string_t *base_val,
const svn_string_t *old_val,
const svn_string_t *new_val,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- svn_boolean_t dry_run,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1487,17 +1134,11 @@ apply_single_prop_change(svn_wc_notify_s
svn_error_t *err = apply_single_mergeinfo_prop_change(state,
conflict_remains,
db, local_abspath,
- left_version,
- right_version,
- is_dir,
actual_props,
propname,
base_val,
old_val,
new_val,
- conflict_func,
- conflict_baton,
- dry_run,
result_pool,
scratch_pool);
if (err)
@@ -1520,13 +1161,9 @@ apply_single_prop_change(svn_wc_notify_s
SVN_ERR(apply_single_generic_prop_change(state, conflict_remains,
db, local_abspath,
- left_version, right_version,
- is_dir,
actual_props,
propname, base_val, old_val,
new_val,
- conflict_func, conflict_baton,
- dry_run,
result_pool, scratch_pool));
}
@@ -1535,23 +1172,19 @@ apply_single_prop_change(svn_wc_notify_s
svn_error_t *
-svn_wc__merge_props(svn_skel_t **work_items,
+svn_wc__merge_props(svn_skel_t **conflict_skel,
svn_wc_notify_state_t *state,
apr_hash_t **new_pristine_props,
apr_hash_t **new_actual_props,
svn_wc__db_t *db,
const char *local_abspath,
svn_kind_t kind,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
apr_hash_t *server_baseprops,
apr_hash_t *pristine_props,
apr_hash_t *actual_props,
const apr_array_header_t *propchanges,
svn_boolean_t base_merge,
svn_boolean_t dry_run,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool,
@@ -1559,21 +1192,24 @@ svn_wc__merge_props(svn_skel_t **work_it
{
apr_pool_t *iterpool;
int i;
- svn_boolean_t is_dir;
- svn_skel_t *conflict_skel = NULL;
+ apr_hash_t *conflict_props = NULL;
+ apr_hash_t *old_actual_props;
+ apr_hash_t *their_props;
SVN_ERR_ASSERT(pristine_props != NULL);
SVN_ERR_ASSERT(actual_props != NULL);
- *work_items = NULL;
+ /* Just copy the pointers as we copy the data in the skel if
+ necessary */
+ old_actual_props = apr_hash_copy(scratch_pool, actual_props);
*new_pristine_props = NULL;
*new_actual_props = NULL;
- is_dir = (kind == svn_kind_dir);
-
if (!server_baseprops)
- server_baseprops = pristine_props;
+ server_baseprops = apr_hash_copy(scratch_pool, pristine_props);
+
+ their_props = apr_hash_copy(scratch_pool, server_baseprops);
if (state)
{
@@ -1591,8 +1227,9 @@ svn_wc__merge_props(svn_skel_t **work_it
const char *propname;
svn_boolean_t conflict_remains;
const svn_prop_t *incoming_change;
- const svn_string_t *from_val, *to_val, *base_val;
- const svn_string_t *mine_val;
+ const svn_string_t *base_val; /* Pristine in WC */
+ const svn_string_t *from_val; /* Merge left */
+ const svn_string_t *to_val; /* Merge right */
svn_pool_clear(iterpool);
@@ -1612,8 +1249,7 @@ svn_wc__merge_props(svn_skel_t **work_it
if (base_merge)
apr_hash_set(pristine_props, propname, APR_HASH_KEY_STRING, to_val);
- /* Save MINE for later message generation. */
- mine_val = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
+ apr_hash_set(their_props, propname, APR_HASH_KEY_STRING, to_val);
/* We already know that state is at least `changed', so mark
that, but remember that we may later upgrade to `merged' or
@@ -1623,31 +1259,23 @@ svn_wc__merge_props(svn_skel_t **work_it
if (! from_val) /* adding a new property */
SVN_ERR(apply_single_prop_add(state, &conflict_remains,
db, local_abspath,
- left_version, right_version,
- is_dir, actual_props,
+ actual_props,
propname, base_val, to_val,
- conflict_func, conflict_baton,
- dry_run, result_pool, iterpool));
+ result_pool, iterpool));
else if (! to_val) /* delete an existing property */
SVN_ERR(apply_single_prop_delete(state, &conflict_remains,
db, local_abspath,
- left_version, right_version,
- is_dir,
actual_props,
propname, base_val, from_val,
- conflict_func, conflict_baton,
- dry_run, result_pool, iterpool));
+ result_pool, iterpool));
else /* changing an existing property */
SVN_ERR(apply_single_prop_change(state, &conflict_remains,
db, local_abspath,
- left_version, right_version,
- is_dir,
actual_props,
propname, base_val, from_val, to_val,
- conflict_func, conflict_baton,
- dry_run, result_pool, iterpool));
+ result_pool, iterpool));
/* merging logic complete, now we need to possibly log conflict
@@ -1660,17 +1288,11 @@ svn_wc__merge_props(svn_skel_t **work_it
if (dry_run)
continue; /* skip to next incoming change */
- if (conflict_skel == NULL)
- conflict_skel = svn_wc__conflict_skel_new(result_pool);
+ if (!conflict_props)
+ conflict_props = apr_hash_make(result_pool);
- SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(conflict_skel,
- propname,
- base_val,
- mine_val,
- to_val,
- from_val,
- result_pool,
- iterpool));
+ apr_hash_set(conflict_props, apr_pstrdup(result_pool, propname),
+ APR_HASH_KEY_STRING, "");
}
} /* foreach propchange ... */
@@ -1684,63 +1306,23 @@ svn_wc__merge_props(svn_skel_t **work_it
*new_pristine_props = pristine_props;
*new_actual_props = actual_props;
- if (conflict_skel != NULL)
+ if (conflict_props != NULL)
{
- const char *reject_path;
-
- /* Now try to get the name of a pre-existing .prej file from the
- entries file */
- SVN_ERR(svn_wc__get_prejfile_abspath(&reject_path, db, local_abspath,
- scratch_pool, scratch_pool));
-
- if (! reject_path)
- {
- /* Reserve a new .prej file *above* the .svn/ directory by
- opening and closing it. */
- const char *reject_dirpath;
- const char *reject_filename;
- svn_skel_t *work_item;
-
- if (is_dir)
- {
- reject_dirpath = local_abspath;
- reject_filename = SVN_WC__THIS_DIR_PREJ;
- }
- else
- svn_dirent_split(&reject_dirpath, &reject_filename, local_abspath,
- scratch_pool);
-
- SVN_ERR(svn_io_open_uniquely_named(NULL, &reject_path,
- reject_dirpath,
- reject_filename,
- SVN_WC__PROP_REJ_EXT,
- svn_io_file_del_none,
- scratch_pool, scratch_pool));
-
- /* This file will be overwritten when the wq is run; that's
- ok, because at least now we have a reservation on
- disk. */
-
- /* Mark entry as "conflicted" with a particular .prej file. */
- SVN_ERR(svn_wc__wq_tmp_build_set_property_conflict_marker(
- &work_item,
- db, local_abspath, reject_path,
- result_pool, scratch_pool));
+ /* Ok, we got some conflict. Lets store all the property knowledge we
+ have for resolving later */
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- }
-
- /* Once the prejfile is recorded, then install the file. */
- {
- svn_skel_t *work_item;
-
- SVN_ERR(svn_wc__wq_build_prej_install(&work_item,
- db, local_abspath,
- conflict_skel,
- result_pool, scratch_pool));
+ if (!*conflict_skel)
+ *conflict_skel = svn_wc__conflict_skel_create(result_pool);
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- }
+ SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(*conflict_skel,
+ db, local_abspath,
+ NULL /* reject_path */,
+ old_actual_props,
+ server_baseprops,
+ their_props,
+ conflict_props,
+ result_pool,
+ scratch_pool));
}
return SVN_NO_ERROR;
@@ -1844,7 +1426,6 @@ svn_wc__prop_list_recursive(svn_wc_conte
const char *local_abspath,
const char *propname,
svn_depth_t depth,
- svn_boolean_t base_props,
svn_boolean_t pristine,
const apr_array_header_t *changelists,
svn_wc__proplist_receiver_t receiver_func,
@@ -1855,8 +1436,11 @@ svn_wc__prop_list_recursive(svn_wc_conte
{
svn_wc__proplist_receiver_t receiver = receiver_func;
void *baton = receiver_baton;
- struct propname_filter_baton_t pfb = { receiver_func, receiver_baton,
- propname };
+ struct propname_filter_baton_t pfb;
+
+ pfb.receiver_func = receiver_func;
+ pfb.receiver_baton = receiver_baton;
+ pfb.propname = propname;
SVN_ERR_ASSERT(receiver_func);
@@ -1898,7 +1482,7 @@ svn_wc__prop_list_recursive(svn_wc_conte
case svn_depth_infinity:
{
SVN_ERR(svn_wc__db_read_props_streamily(wc_ctx->db, local_abspath,
- depth, base_props, pristine,
+ depth, pristine,
changelists, receiver, baton,
cancel_func, cancel_baton,
scratch_pool));
@@ -1912,6 +1496,22 @@ svn_wc__prop_list_recursive(svn_wc_conte
}
svn_error_t *
+svn_wc__prop_retrieve_recursive(apr_hash_t **values,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ const char *propname,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(
+ svn_wc__db_prop_retrieve_recursive(values,
+ wc_ctx->db,
+ local_abspath,
+ propname,
+ result_pool, scratch_pool));
+}
+
+svn_error_t *
svn_wc__get_pristine_props(apr_hash_t **props,
svn_wc__db_t *db,
const char *local_abspath,
@@ -2210,32 +1810,11 @@ do_propset(svn_wc__db_t *db,
{
apr_hash_t *prophash;
svn_wc_notify_action_t notify_action;
- svn_wc__db_status_t status;
svn_skel_t *work_item = NULL;
svn_boolean_t clear_recorded_info = FALSE;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- /* Get the node status for this path. */
- SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool));
-
- if (status != svn_wc__db_status_normal
- && status != svn_wc__db_status_added
- && status != svn_wc__db_status_incomplete)
- return svn_error_createf(SVN_ERR_WC_INVALID_SCHEDULE, NULL,
- _("Can't set properties on '%s':"
- " invalid status for updating properties."),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
-
- /* Else, handle a regular property: */
-
-
/* Setting an inappropriate property is not allowed (unless
overridden by 'skip_checks', in some circumstances). Deleting an
inappropriate property is allowed, however, since older clients
@@ -2320,7 +1899,7 @@ do_propset(svn_wc__db_t *db,
}
else if (kind == svn_node_file && strcmp(name, SVN_PROP_EOL_STYLE) == 0)
{
- svn_string_t *old_value = apr_hash_get(prophash, SVN_PROP_KEYWORDS,
+ svn_string_t *old_value = apr_hash_get(prophash, SVN_PROP_EOL_STYLE,
APR_HASH_KEY_STRING);
if (((value == NULL) != (old_value == NULL))
@@ -2430,6 +2009,7 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
apr_pool_t *scratch_pool)
{
enum svn_prop_kind prop_kind = svn_property_kind2(name);
+ svn_wc__db_status_t status;
svn_kind_t kind;
const char *dir_abspath;
@@ -2451,8 +2031,22 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
backward we never call this API with depth > empty, so we only need
to do the write check once per call, here (and not for every node in
the node walker). */
- SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath, TRUE,
- scratch_pool));
+ /* Get the node status for this path. */
+ 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, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (status != svn_wc__db_status_normal
+ && status != svn_wc__db_status_added
+ && status != svn_wc__db_status_incomplete)
+ return svn_error_createf(SVN_ERR_WC_INVALID_SCHEDULE, NULL,
+ _("Can't set properties on '%s':"
+ " invalid status for updating properties."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
if (kind == svn_kind_dir)
dir_abspath = local_abspath;
@@ -2461,7 +2055,7 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, scratch_pool));
- if (depth == svn_depth_empty)
+ if (depth == svn_depth_empty || kind != svn_kind_dir)
{
apr_hash_t *changelist_hash = NULL;
@@ -2482,8 +2076,14 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
}
else
{
- struct propset_walk_baton wb = { name, value, wc_ctx->db, skip_checks,
- notify_func, notify_baton };
+ struct propset_walk_baton wb;
+
+ wb.propname = name;
+ wb.propval = value;
+ wb.db = wc_ctx->db;
+ wb.force = skip_checks;
+ wb.notify_func = notify_func;
+ wb.notify_baton = notify_baton;
SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath,
FALSE, changelist_filter,
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/props.h
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/props.h?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/props.h (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/props.h Thu Aug 16 10:17:48 2012
@@ -91,32 +91,24 @@ svn_wc__internal_propget(const svn_strin
into the .prej file later. Modify base properties unconditionally,
if BASE_MERGE is TRUE, they do not generate conficts.
- TODO ### LEFT_VERSION and RIGHT_VERSION ...
-
TODO ### DRY_RUN ...
- TODO ### CONFLICT_FUNC/CONFLICT_BATON ...
-
If STATE is non-null, set *STATE to the state of the local properties
after the merge. */
svn_error_t *
-svn_wc__merge_props(svn_skel_t **work_items,
+svn_wc__merge_props(svn_skel_t **conflict_skel,
svn_wc_notify_state_t *state,
apr_hash_t **new_pristine_props,
apr_hash_t **new_actual_props,
svn_wc__db_t *db,
const char *local_abspath,
svn_kind_t kind,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
apr_hash_t *server_baseprops,
apr_hash_t *pristine_props,
apr_hash_t *actual_props,
const apr_array_header_t *propchanges,
svn_boolean_t base_merge,
svn_boolean_t dry_run,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool,
@@ -153,13 +145,6 @@ svn_wc__get_actual_props(apr_hash_t **pr
apr_pool_t *scratch_pool);
svn_error_t *
-svn_wc__get_prejfile_abspath(const char **prejfile_abspath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-svn_error_t *
svn_wc__create_prejfile(const char **tmp_prejfile_abspath,
svn_wc__db_t *db,
const char *local_abspath,
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/questions.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/questions.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/questions.c Thu Aug 16 10:17:48 2012
@@ -40,8 +40,7 @@
#include "svn_props.h"
#include "wc.h"
-#include "adm_files.h"
-#include "props.h"
+#include "conflicts.h"
#include "translate.h"
#include "wc_db.h"
@@ -374,11 +373,9 @@ svn_error_t *
svn_wc_text_modified_p2(svn_boolean_t *modified_p,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
- svn_boolean_t force_comparison,
+ svn_boolean_t unused,
apr_pool_t *scratch_pool)
{
- /* ### We ignore FORCE_COMPARISON, but we also fixed its only
- remaining use-case */
return svn_wc__internal_file_modified_p(modified_p, wc_ctx->db,
local_abspath, FALSE, scratch_pool);
}
@@ -394,106 +391,122 @@ svn_wc__internal_conflicted_p(svn_boolea
apr_pool_t *scratch_pool)
{
svn_node_kind_t kind;
- svn_kind_t node_kind;
- const apr_array_header_t *conflicts;
- int i;
- svn_boolean_t conflicted;
-
- if (text_conflicted_p)
- *text_conflicted_p = FALSE;
- if (prop_conflicted_p)
- *prop_conflicted_p = FALSE;
- if (tree_conflicted_p)
- *tree_conflicted_p = FALSE;
-
- SVN_ERR(svn_wc__db_read_info(NULL, &node_kind, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, &conflicted,
- NULL, NULL, NULL, NULL, NULL, NULL,
- db, local_abspath, scratch_pool,
- scratch_pool));
-
- if (!conflicted)
- return SVN_NO_ERROR;
-
-
- SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, local_abspath,
- scratch_pool, scratch_pool));
+ svn_skel_t *conflicts;
+ svn_boolean_t resolved_text = FALSE;
+ svn_boolean_t resolved_props = FALSE;
- for (i = 0; i < conflicts->nelts; i++)
+ SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!conflicts)
{
- const svn_wc_conflict_description2_t *cd;
- cd = APR_ARRAY_IDX(conflicts, i, const svn_wc_conflict_description2_t *);
+ if (text_conflicted_p)
+ *text_conflicted_p = FALSE;
+ if (prop_conflicted_p)
+ *prop_conflicted_p = FALSE;
+ if (tree_conflicted_p)
+ *tree_conflicted_p = FALSE;
+
+ return SVN_NO_ERROR;
+ }
- switch (cd->kind)
+ SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, text_conflicted_p,
+ prop_conflicted_p, tree_conflicted_p,
+ db, local_abspath, conflicts,
+ scratch_pool, scratch_pool));
+
+ if (text_conflicted_p && *text_conflicted_p)
+ {
+ const char *mine_abspath;
+ const char *their_old_abspath;
+ const char *their_abspath;
+ svn_boolean_t done = FALSE;
+
+ /* Look for any text conflict, exercising only as much effort as
+ necessary to obtain a definitive answer. This only applies to
+ files, but we don't have to explicitly check that entry is a
+ file, since these attributes would never be set on a directory
+ anyway. A conflict file entry notation only counts if the
+ conflict file still exists on disk. */
+
+ SVN_ERR(svn_wc__conflict_read_text_conflict(&mine_abspath,
+ &their_old_abspath,
+ &their_abspath,
+ db, local_abspath, conflicts,
+ scratch_pool, scratch_pool));
+
+ if (mine_abspath)
{
- case svn_wc_conflict_kind_text:
- /* Look for any text conflict, exercising only as much effort as
- necessary to obtain a definitive answer. This only applies to
- files, but we don't have to explicitly check that entry is a
- file, since these attributes would never be set on a directory
- anyway. A conflict file entry notation only counts if the
- conflict file still exists on disk. */
-
- if (!text_conflicted_p || *text_conflicted_p)
- break;
-
- if (cd->base_abspath)
- {
- SVN_ERR(svn_io_check_path(cd->base_abspath, &kind,
- scratch_pool));
+ SVN_ERR(svn_io_check_path(mine_abspath, &kind, scratch_pool));
- *text_conflicted_p = (kind == svn_node_file);
+ *text_conflicted_p = (kind == svn_node_file);
- if (*text_conflicted_p)
- break;
- }
-
- if (cd->their_abspath)
- {
- SVN_ERR(svn_io_check_path(cd->their_abspath, &kind,
- scratch_pool));
+ if (*text_conflicted_p)
+ done = TRUE;
+ }
- *text_conflicted_p = (kind == svn_node_file);
+ if (!done && their_abspath)
+ {
+ SVN_ERR(svn_io_check_path(their_abspath, &kind, scratch_pool));
- if (*text_conflicted_p)
- break;
- }
-
- if (cd->my_abspath)
- {
- SVN_ERR(svn_io_check_path(cd->my_abspath, &kind,
- scratch_pool));
+ *text_conflicted_p = (kind == svn_node_file);
- *text_conflicted_p = (kind == svn_node_file);
- }
- break;
-
- case svn_wc_conflict_kind_property:
- if (!prop_conflicted_p || *prop_conflicted_p)
- break;
-
- if (cd->their_abspath)
- {
- SVN_ERR(svn_io_check_path(cd->their_abspath, &kind,
- scratch_pool));
+ if (*text_conflicted_p)
+ done = TRUE;
+ }
+
+ if (!done && their_old_abspath)
+ {
+ SVN_ERR(svn_io_check_path(their_old_abspath, &kind, scratch_pool));
- *prop_conflicted_p = (kind == svn_node_file);
- }
+ *text_conflicted_p = (kind == svn_node_file);
- break;
+ if (*text_conflicted_p)
+ done = TRUE;
+ }
- case svn_wc_conflict_kind_tree:
- if (tree_conflicted_p)
- *tree_conflicted_p = TRUE;
+ if (!done && (mine_abspath || their_abspath || their_old_abspath))
+ resolved_text = TRUE; /* Remove in-db conflict marker */
+ }
- break;
+ if (prop_conflicted_p && *prop_conflicted_p)
+ {
+ const char *prej_abspath;
- default:
- /* Ignore other conflict types */
- break;
+ SVN_ERR(svn_wc__conflict_read_prop_conflict(&prej_abspath,
+ NULL, NULL, NULL, NULL,
+ db, local_abspath, conflicts,
+ scratch_pool, scratch_pool));
+
+ if (prej_abspath)
+ {
+ SVN_ERR(svn_io_check_path(prej_abspath, &kind, scratch_pool));
+
+ *prop_conflicted_p = (kind == svn_node_file);
+
+ if (! *prop_conflicted_p)
+ resolved_props = TRUE; /* Remove in-db conflict marker */
}
}
+
+ /* tree_conflicts don't have markers, so don't need checking */
+
+ if (resolved_text || resolved_props)
+ {
+ svn_boolean_t own_lock;
+
+ /* The marker files are missing, so "repair" wc.db if we can */
+ SVN_ERR(svn_wc__db_wclock_owns_lock(&own_lock, db, local_abspath, FALSE,
+ scratch_pool));
+ if (own_lock)
+ SVN_ERR(svn_wc__db_op_mark_resolved(db, local_abspath,
+ resolved_text,
+ resolved_props,
+ FALSE /* resolved_tree */,
+ NULL /* work_items */,
+ scratch_pool));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/status.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/status.c Thu Aug 16 10:17:48 2012
@@ -41,6 +41,7 @@
#include "svn_config.h"
#include "svn_time.h"
#include "svn_hash.h"
+#include "svn_sorts.h"
#include "svn_private_config.h"
@@ -949,6 +950,9 @@ send_status_structure(const struct walk_
IGNORES is a list of patterns to include; typically this will
be the default ignores as, for example, specified in a config file.
+ If MAY_HAVE_PROPS is false, local_abspath is assumed to have no
+ properties.
+
LOCAL_ABSPATH and DB control how to access the ignore information.
Allocate results in RESULT_POOL, temporary stuffs in SCRATCH_POOL.
@@ -960,11 +964,13 @@ collect_ignore_patterns(apr_array_header
svn_wc__db_t *db,
const char *local_abspath,
const apr_array_header_t *ignores,
+ svn_boolean_t may_have_props,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
int i;
const svn_string_t *value;
+ apr_hash_t *props;
/* ### assert we are passed a directory? */
@@ -978,9 +984,18 @@ collect_ignore_patterns(apr_array_header
ignore);
}
+ if (!may_have_props)
+ return SVN_NO_ERROR;
+
/* Then add any svn:ignore globs to the PATTERNS array. */
- SVN_ERR(svn_wc__internal_propget(&value, db, local_abspath, SVN_PROP_IGNORE,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!props)
+ return SVN_NO_ERROR;
+
+ value = apr_hash_get(props, SVN_PROP_IGNORE, APR_HASH_KEY_STRING);
+
if (value != NULL)
svn_cstring_split_append(*patterns, value->data, "\n\r", FALSE,
result_pool);
@@ -1120,6 +1135,8 @@ get_dir_status(const struct walk_status_
* DIR_REPOS_* should reflect LOCAL_ABSPATH's parent URL, i.e. LOCAL_ABSPATH's
* URL treated with svn_uri_dirname(). ### TODO verify this (externals)
*
+ * DIR_HAS_PROPS is a boolean indicating whether PARENT_ABSPATH has properties.
+ *
* If *COLLECTED_IGNORE_PATTERNS is NULL and ignore patterns are needed in
* this call, *COLLECTED_IGNORE_PATTERNS will be set to an apr_array_header_t*
* containing all ignore patterns, as returned by collect_ignore_patterns() on
@@ -1140,6 +1157,7 @@ one_child_status(const struct walk_statu
const char *dir_repos_root_url,
const char *dir_repos_relpath,
const char *dir_repos_uuid,
+ svn_boolean_t dir_has_props,
svn_boolean_t unversioned_tree_conflicted,
apr_array_header_t **collected_ignore_patterns,
const apr_array_header_t *ignore_patterns,
@@ -1227,6 +1245,7 @@ one_child_status(const struct walk_statu
if (ignore_patterns && ! *collected_ignore_patterns)
SVN_ERR(collect_ignore_patterns(collected_ignore_patterns, wb->db,
parent_abspath, ignore_patterns,
+ dir_has_props,
result_pool, scratch_pool));
SVN_ERR(send_unversioned_item(wb,
@@ -1280,14 +1299,16 @@ get_dir_status(const struct walk_status_
void *cancel_baton,
apr_pool_t *scratch_pool)
{
- apr_hash_index_t *hi;
const char *dir_repos_root_url;
const char *dir_repos_relpath;
const char *dir_repos_uuid;
+ svn_boolean_t dir_has_props;
apr_hash_t *dirents, *nodes, *conflicts, *all_children;
+ apr_array_header_t *sorted_children;
apr_array_header_t *collected_ignore_patterns = NULL;
apr_pool_t *iterpool, *subpool = svn_pool_create(scratch_pool);
svn_error_t *err;
+ int i;
if (cancel_func)
SVN_ERR(cancel_func(cancel_baton));
@@ -1333,7 +1354,19 @@ get_dir_status(const struct walk_status_
/* Handle "this-dir" first. */
if (! skip_this_dir)
{
-#ifdef HAVE_SYMLINK
+ /* This code is not conditional on HAVE_SYMLINK as some systems that do
+ not allow creating symlinks (!HAVE_SYMLINK) can still encounter
+ symlinks (or in case of Windows also 'Junctions') created by other
+ methods.
+
+ Without this block a working copy in the root of a junction is
+ reported as an obstruction, because the junction itself is reported as
+ special.
+
+ Systems that have no symlink support at all, would always see
+ dirent->special as FALSE, so even there enabling this code shouldn't
+ produce problems.
+ */
if (dirent->special)
{
svn_io_dirent2_t *this_dirent = svn_io_dirent2_dup(dirent, iterpool);
@@ -1354,7 +1387,6 @@ get_dir_status(const struct walk_status_
iterpool));
}
else
-#endif
SVN_ERR(send_status_structure(wb, local_abspath,
parent_repos_root_url,
parent_repos_relpath,
@@ -1368,21 +1400,28 @@ get_dir_status(const struct walk_status_
if (depth == svn_depth_empty)
return SVN_NO_ERROR;
+ dir_has_props = (dir_info->had_props || dir_info->props_mod);
+
/* Walk all the children of this directory. */
- for (hi = apr_hash_first(subpool, all_children); hi; hi = apr_hash_next(hi))
+ sorted_children = svn_sort__hash(all_children,
+ svn_sort_compare_items_lexically,
+ subpool);
+ for (i = 0; i < sorted_children->nelts; i++)
{
const void *key;
apr_ssize_t klen;
+ svn_sort__item_t item;
const char *child_abspath;
svn_io_dirent2_t *child_dirent;
const struct svn_wc__db_info_t *child_info;
svn_pool_clear(iterpool);
- apr_hash_this(hi, &key, &klen, NULL);
+ item = APR_ARRAY_IDX(sorted_children, i, svn_sort__item_t);
+ key = item.key;
+ klen = item.klen;
child_abspath = svn_dirent_join(local_abspath, key, iterpool);
-
child_dirent = apr_hash_get(dirents, key, klen);
child_info = apr_hash_get(nodes, key, klen);
@@ -1394,6 +1433,7 @@ get_dir_status(const struct walk_status_
dir_repos_root_url,
dir_repos_relpath,
dir_repos_uuid,
+ dir_has_props,
apr_hash_get(conflicts, key, klen) != NULL,
&collected_ignore_patterns,
ignore_patterns,
@@ -1480,6 +1520,7 @@ get_child_status(const struct walk_statu
dir_repos_root_url,
dir_repos_relpath,
dir_repos_uuid,
+ (dir_info->had_props || dir_info->props_mod),
FALSE, /* unversioned_tree_conflicted */
&collected_ignore_patterns,
ignore_patterns,
@@ -1553,7 +1594,6 @@ tweak_statushash(void *baton,
svn_boolean_t is_dir_baton,
svn_wc__db_t *db,
const char *local_abspath,
- svn_boolean_t is_dir,
enum svn_wc_status_kind repos_node_status,
enum svn_wc_status_kind repos_text_status,
enum svn_wc_status_kind repos_prop_status,
@@ -1642,7 +1682,7 @@ tweak_statushash(void *baton,
isn't available. */
if (statstruct->repos_node_status == svn_wc_status_deleted)
{
- statstruct->ood_kind = is_dir ? svn_node_dir : svn_node_file;
+ statstruct->ood_kind = statstruct->kind;
/* Pre 1.5 servers don't provide the revision a path was deleted.
So we punt and use the last committed revision of the path's
@@ -2038,16 +2078,13 @@ delete_entry(const char *path,
struct dir_baton *db = parent_baton;
struct edit_baton *eb = db->edit_baton;
const char *local_abspath = svn_dirent_join(eb->anchor_abspath, path, pool);
- svn_kind_t kind;
/* Note: when something is deleted, it's okay to tweak the
statushash immediately. No need to wait until close_file or
close_dir, because there's no risk of having to honor the 'added'
flag. We already know this item exists in the working copy. */
-
- SVN_ERR(svn_wc__db_read_kind(&kind, eb->db, local_abspath, FALSE, pool));
SVN_ERR(tweak_statushash(db, db, TRUE, eb->db,
- local_abspath, kind == svn_kind_dir,
+ local_abspath,
svn_wc_status_deleted, 0, 0, revision, NULL, pool));
/* Mark the parent dir -- it lost an entry (unless that parent dir
@@ -2056,7 +2093,6 @@ delete_entry(const char *path,
if (db->parent_baton && (! *eb->target_basename))
SVN_ERR(tweak_statushash(db->parent_baton, db, TRUE,eb->db,
db->local_abspath,
- kind == svn_kind_dir,
svn_wc_status_modified, svn_wc_status_modified,
0, SVN_INVALID_REVNUM, NULL, pool));
@@ -2179,7 +2215,7 @@ close_directory(void *dir_baton,
/* ### When we add directory locking, we need to find a
### directory lock here. */
SVN_ERR(tweak_statushash(pb, db, TRUE, eb->db, db->local_abspath,
- TRUE, repos_node_status, repos_text_status,
+ repos_node_status, repos_text_status,
repos_prop_status, SVN_INVALID_REVNUM, NULL,
pool));
}
@@ -2424,7 +2460,7 @@ close_file(void *file_baton,
}
return tweak_statushash(fb, NULL, FALSE, fb->edit_baton->db,
- fb->local_abspath, FALSE, repos_node_status,
+ fb->local_abspath, repos_node_status,
repos_text_status, repos_prop_status,
SVN_INVALID_REVNUM, repos_lock, pool);
}
@@ -2619,9 +2655,6 @@ svn_wc__internal_walk_status(svn_wc__db_
wb.repos_root = NULL;
wb.repos_locks = NULL;
- SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, local_abspath,
- scratch_pool, scratch_pool));
-
/* Use the caller-provided ignore patterns if provided; the build-time
configured defaults otherwise. */
if (!ignore_patterns)
@@ -2643,7 +2676,12 @@ svn_wc__internal_walk_status(svn_wc__db_
}
else
return svn_error_trace(err);
+
+ wb.externals = apr_hash_make(scratch_pool);
}
+ else
+ SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, local_abspath,
+ scratch_pool, scratch_pool));
SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
scratch_pool, scratch_pool));
@@ -2673,15 +2711,27 @@ svn_wc__internal_walk_status(svn_wc__db_
/* It may be a file or an unversioned item. And this is an explicit
* target, so no ignoring. An unversioned item (file or dir) shows a
* status like '?', and can yield a tree conflicted path. */
- SVN_ERR(get_child_status(&wb,
- local_abspath,
- info,
- dirent,
- ignore_patterns,
- get_all,
- status_func, status_baton,
- cancel_func, cancel_baton,
- scratch_pool));
+ err = get_child_status(&wb,
+ local_abspath,
+ info,
+ dirent,
+ ignore_patterns,
+ get_all,
+ status_func, status_baton,
+ cancel_func, cancel_baton,
+ scratch_pool);
+
+ if (!info && err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ /* The parent is also not versioned, but it is not nice to show
+ an error about a path a user didn't intend to touch. */
+ svn_error_clear(err);
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+ SVN_ERR(err);
}
return SVN_NO_ERROR;
@@ -2937,6 +2987,6 @@ svn_wc_get_ignores2(apr_array_header_t *
SVN_ERR(svn_wc_get_default_ignores(&default_ignores, config, scratch_pool));
return svn_error_trace(collect_ignore_patterns(patterns, wc_ctx->db,
local_abspath,
- default_ignores,
+ default_ignores, TRUE,
result_pool, scratch_pool));
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/tree_conflicts.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/tree_conflicts.c Thu Aug 16 10:17:48 2012
@@ -27,6 +27,7 @@
#include "svn_pools.h"
#include "tree_conflicts.h"
+#include "conflicts.h"
#include "wc.h"
#include "private/svn_skel.h"
@@ -158,15 +159,18 @@ read_node_version_info(const svn_wc_conf
_("Invalid version info in tree conflict "
"description"));
- repos_root = apr_pstrmemdup(result_pool,
- skel->children->next->data,
- skel->children->next->len);
+ repos_root = apr_pstrmemdup(scratch_pool,
+ skel->children->next->data,
+ skel->children->next->len);
if (*repos_root == '\0')
{
*version_info = NULL;
return SVN_NO_ERROR;
}
+ /* Apply the Subversion 1.7+ url canonicalization rules to a pre 1.7 url */
+ repos_root = svn_uri_canonicalize(repos_root, result_pool);
+
peg_rev = SVN_STR_TO_REV(apr_pstrmemdup(scratch_pool,
skel->children->next->next->data,
skel->children->next->next->len));
@@ -386,8 +390,9 @@ svn_wc__del_tree_conflict(svn_wc_context
{
SVN_ERR_ASSERT(svn_dirent_is_absolute(victim_abspath));
- SVN_ERR(svn_wc__db_op_set_tree_conflict(wc_ctx->db, victim_abspath,
- NULL, scratch_pool));
+ SVN_ERR(svn_wc__db_op_mark_resolved(wc_ctx->db, victim_abspath,
+ FALSE, FALSE, TRUE, NULL,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -397,66 +402,99 @@ svn_wc__add_tree_conflict(svn_wc_context
const svn_wc_conflict_description2_t *conflict,
apr_pool_t *scratch_pool)
{
- const svn_wc_conflict_description2_t *existing_conflict;
+ svn_boolean_t existing_conflict;
+ svn_skel_t *conflict_skel;
+ svn_error_t *err;
/* Re-adding an existing tree conflict victim is an error. */
- SVN_ERR(svn_wc__db_op_read_tree_conflict(&existing_conflict, wc_ctx->db,
- conflict->local_abspath,
- scratch_pool, scratch_pool));
- if (existing_conflict != NULL)
+ err = svn_wc__internal_conflicted_p(NULL, NULL, &existing_conflict,
+ wc_ctx->db, conflict->local_abspath,
+ scratch_pool);
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ }
+ else if (existing_conflict)
return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
_("Attempt to add tree conflict that already "
"exists at '%s'"),
svn_dirent_local_style(conflict->local_abspath,
scratch_pool));
+ else if (!conflict)
+ return SVN_NO_ERROR;
+
+ conflict_skel = svn_wc__conflict_skel_create(scratch_pool);
+
+ SVN_ERR(svn_wc__conflict_skel_add_tree_conflict(conflict_skel, wc_ctx->db,
+ conflict->local_abspath,
+ conflict->reason,
+ conflict->action,
+ scratch_pool, scratch_pool));
+
+ switch(conflict->operation)
+ {
+ case svn_wc_operation_update:
+ default:
+ SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_skel,
+ conflict->src_left_version,
+ scratch_pool, scratch_pool));
+ break;
+ case svn_wc_operation_switch:
+ SVN_ERR(svn_wc__conflict_skel_set_op_switch(conflict_skel,
+ conflict->src_left_version,
+ scratch_pool, scratch_pool));
+ break;
+ case svn_wc_operation_merge:
+ SVN_ERR(svn_wc__conflict_skel_set_op_merge(conflict_skel,
+ conflict->src_left_version,
+ conflict->src_right_version,
+ scratch_pool, scratch_pool));
+ break;
+ }
return svn_error_trace(
- svn_wc__db_op_set_tree_conflict(wc_ctx->db, conflict->local_abspath,
- conflict, scratch_pool));
+ svn_wc__db_op_mark_conflict(wc_ctx->db, conflict->local_abspath,
+ conflict_skel, NULL, scratch_pool));
}
svn_error_t *
svn_wc__get_tree_conflict(const svn_wc_conflict_description2_t **tree_conflict,
svn_wc_context_t *wc_ctx,
- const char *victim_abspath,
+ const char *local_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- SVN_ERR_ASSERT(svn_dirent_is_absolute(victim_abspath));
-
- return svn_error_trace(
- svn_wc__db_op_read_tree_conflict(tree_conflict, wc_ctx->db, victim_abspath,
- result_pool, scratch_pool));
-}
+ const apr_array_header_t *conflicts;
+ int i;
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-svn_error_t *
-svn_wc__get_all_tree_conflicts(apr_hash_t **tree_conflicts,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- apr_hash_t *conflicts;
- apr_hash_index_t *hi;
+ SVN_ERR(svn_wc__read_conflicts(&conflicts,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ if (!conflicts || conflicts->nelts == 0)
+ {
+ *tree_conflict = NULL;
+ return SVN_NO_ERROR;
+ }
- SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(&conflicts, wc_ctx->db,
- local_abspath,
- result_pool, scratch_pool));
- *tree_conflicts = apr_hash_make(result_pool);
- /* Convert from basenames as keys to abspaths as keys. */
- for (hi = apr_hash_first(scratch_pool, conflicts); hi;
- hi = apr_hash_next(hi))
+ for (i = 0; i < conflicts->nelts; i++)
{
- const char *name = svn__apr_hash_index_key(hi);
- const svn_wc_conflict_description2_t *conflict
- = svn__apr_hash_index_val(hi);
- const char *abspath = svn_dirent_join(local_abspath, name, scratch_pool);
+ const svn_wc_conflict_description2_t *desc;
- apr_hash_set(*tree_conflicts, abspath, APR_HASH_KEY_STRING, conflict);
- }
+ desc = APR_ARRAY_IDX(conflicts, i, svn_wc_conflict_description2_t *);
+ if (desc->kind == svn_wc_conflict_kind_tree)
+ {
+ *tree_conflict = svn_wc__conflict_description2_dup(desc,
+ result_pool);
+ return SVN_NO_ERROR;
+ }
+ }
return SVN_NO_ERROR;
}
+