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 [29/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/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/info.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/info.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/info.c Thu Aug 16 10:17:48 2012
@@ -41,8 +41,7 @@ svn_wc_info_dup(const svn_wc_info_t *inf
if (info->changelist)
new_info->changelist = apr_pstrdup(pool, info->changelist);
- if (info->checksum)
- new_info->checksum = svn_checksum_dup(info->checksum, pool);
+ new_info->checksum = svn_checksum_dup(info->checksum, pool);
if (info->conflicts)
{
int i;
@@ -280,9 +279,9 @@ build_info_for_node(svn_wc__info2_t **in
local_abspath, result_pool, scratch_pool));
if (conflicted)
- SVN_ERR(svn_wc__db_read_conflicts(&wc_info->conflicts, db,
- local_abspath,
- result_pool, scratch_pool));
+ SVN_ERR(svn_wc__read_conflicts(&wc_info->conflicts, db,
+ local_abspath,
+ result_pool, scratch_pool));
else
wc_info->conflicts = NULL;
@@ -386,21 +385,21 @@ info_found_node_callback(const char *loc
* are not visited will remain in the list. */
if (fe_baton->actual_only && kind == svn_node_dir)
{
- apr_hash_t *conflicts;
- apr_hash_index_t *hi;
+ const apr_array_header_t *victims;
+ int i;
+
+ SVN_ERR(svn_wc__db_read_conflict_victims(&victims,
+ fe_baton->db, local_abspath,
+ scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__db_op_read_all_tree_conflicts(
- &conflicts, fe_baton->db, local_abspath,
- fe_baton->pool, scratch_pool));
- for (hi = apr_hash_first(scratch_pool, conflicts); hi;
- hi = apr_hash_next(hi))
+ for (i = 0; i < victims->nelts; i++)
{
- const char *this_basename = svn__apr_hash_index_key(hi);
+ const char *this_basename = APR_ARRAY_IDX(victims, i, const char *);
apr_hash_set(fe_baton->tree_conflicts,
svn_dirent_join(local_abspath, this_basename,
fe_baton->pool),
- APR_HASH_KEY_STRING, svn__apr_hash_index_val(hi));
+ APR_HASH_KEY_STRING, "");
}
}
@@ -450,6 +449,8 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
svn_error_t *err;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
apr_hash_index_t *hi;
+ const char *repos_root_url = NULL;
+ const char *repos_uuid = NULL;
fe_baton.receiver = receiver;
fe_baton.receiver_baton = receiver_baton;
@@ -477,9 +478,9 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
const svn_wc_conflict_description2_t *root_tree_conflict;
svn_error_t *err2;
- err2 = svn_wc__db_op_read_tree_conflict(&root_tree_conflict,
- wc_ctx->db, local_abspath,
- scratch_pool, iterpool);
+ err2 = svn_wc__get_tree_conflict(&root_tree_conflict,
+ wc_ctx, local_abspath,
+ scratch_pool, iterpool);
if ((err2 && err2->apr_err == SVN_ERR_WC_PATH_NOT_FOUND))
{
@@ -503,30 +504,41 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
hi = apr_hash_next(hi))
{
const char *this_abspath = svn__apr_hash_index_key(hi);
- const svn_wc_conflict_description2_t *tree_conflict
- = svn__apr_hash_index_val(hi);
+ const svn_wc_conflict_description2_t *tree_conflict;
+ svn_wc__info2_t *info;
svn_pool_clear(iterpool);
- if (depth_includes(local_abspath, depth, tree_conflict->local_abspath,
- tree_conflict->node_kind, iterpool))
+ SVN_ERR(build_info_for_unversioned(&info, iterpool));
+
+ if (!repos_root_url)
{
- apr_array_header_t *conflicts = apr_array_make(iterpool,
- 1, sizeof(const svn_wc_conflict_description2_t *));
- svn_wc__info2_t *info;
-
- SVN_ERR(build_info_for_unversioned(&info, iterpool));
- SVN_ERR(svn_wc__internal_get_repos_info(&info->repos_root_URL,
- &info->repos_UUID,
- fe_baton.db,
+ SVN_ERR(svn_wc__internal_get_repos_info(&repos_root_url,
+ &repos_uuid,
+ wc_ctx->db,
local_abspath,
- iterpool, iterpool));
- APR_ARRAY_PUSH(conflicts, const svn_wc_conflict_description2_t *)
- = tree_conflict;
- info->wc_info->conflicts = conflicts;
-
- SVN_ERR(receiver(receiver_baton, this_abspath, info, iterpool));
+ scratch_pool,
+ iterpool));
}
+
+ info->repos_root_URL = repos_root_url;
+ info->repos_UUID = repos_uuid;
+
+ SVN_ERR(svn_wc__read_conflicts(&info->wc_info->conflicts,
+ wc_ctx->db, this_abspath,
+ iterpool, iterpool));
+
+ if (! info->wc_info->conflicts || ! info->wc_info->conflicts->nelts)
+ continue;
+
+ tree_conflict = APR_ARRAY_IDX(info->wc_info->conflicts, 0,
+ svn_wc_conflict_description2_t *);
+
+ if (!depth_includes(local_abspath, depth, tree_conflict->local_abspath,
+ tree_conflict->node_kind, iterpool))
+ continue;
+
+ SVN_ERR(receiver(receiver_baton, this_abspath, info, iterpool));
}
svn_pool_destroy(iterpool);
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/lock.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/lock.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/lock.c Thu Aug 16 10:17:48 2012
@@ -920,7 +920,9 @@ svn_wc_adm_retrieve(svn_wc_adm_access_t
if (associated)
{
err = svn_wc__db_read_kind(&kind, svn_wc__adm_get_db(associated),
- local_abspath, TRUE, pool);
+ local_abspath,
+ TRUE /* allow_missing */,
+ FALSE /* show_hidden */, pool);
if (err)
{
@@ -980,7 +982,9 @@ svn_wc_adm_probe_retrieve(svn_wc_adm_acc
SVN_ERR_ASSERT(associated != NULL);
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
- SVN_ERR(svn_wc__db_read_kind(&kind, associated->db, local_abspath, TRUE, pool));
+ SVN_ERR(svn_wc__db_read_kind(&kind, associated->db, local_abspath,
+ TRUE /* allow_missing */, FALSE /* show_hidden*/,
+ pool));
if (kind == svn_kind_dir)
dir = path;
@@ -1515,7 +1519,8 @@ svn_wc__acquire_write_lock(const char **
svn_error_t *err;
SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath,
- (lock_root_abspath != NULL),
+ (lock_root_abspath != NULL) /* allow_missing*/,
+ FALSE /* show_hidden */,
scratch_pool));
if (!lock_root_abspath && kind != svn_kind_dir)
@@ -1524,6 +1529,21 @@ svn_wc__acquire_write_lock(const char **
svn_dirent_local_style(local_abspath,
scratch_pool));
+ if (lock_anchor && kind == svn_kind_dir)
+ {
+ svn_boolean_t is_wcroot;
+
+ SVN_ERR_ASSERT(lock_root_abspath != NULL);
+
+ /* Perform a cheap check to avoid looking for a parent working copy,
+ which might be very expensive in some specific scenarios */
+ SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath,
+ scratch_pool));
+
+ if (is_wcroot)
+ lock_anchor = FALSE;
+ }
+
if (lock_anchor)
{
const char *parent_abspath;
@@ -1532,7 +1552,9 @@ svn_wc__acquire_write_lock(const char **
SVN_ERR_ASSERT(lock_root_abspath != NULL);
parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
- err = svn_wc__db_read_kind(&parent_kind, db, parent_abspath, TRUE,
+ err = svn_wc__db_read_kind(&parent_kind, db, parent_abspath,
+ TRUE /* allow_missing */,
+ FALSE /* show_missing */,
scratch_pool);
if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
{
@@ -1565,7 +1587,9 @@ svn_wc__acquire_write_lock(const char **
/* Can't lock parents that don't exist */
if (kind == svn_kind_unknown)
{
- SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, FALSE,
+ SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath,
+ FALSE /* allow_missing */,
+ FALSE /* show_hidden */,
scratch_pool));
if (kind != svn_kind_dir)
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/merge.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/merge.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/merge.c Thu Aug 16 10:17:48 2012
@@ -29,6 +29,7 @@
#include "wc.h"
#include "adm_files.h"
+#include "conflicts.h"
#include "translate.h"
#include "workqueue.h"
@@ -240,13 +241,11 @@ detranslate_wc_file(const char **detrans
if (force_copy || keywords || eol || special)
{
- const char *wcroot_abspath, *temp_dir_abspath;
+ const char *temp_dir_abspath;
const char *detranslated;
/* Force a copy into the temporary wc area to avoid having
temporary files created below to appear in the actual wc. */
- SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, mt->db, mt->wri_abspath,
- scratch_pool, scratch_pool));
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath, mt->db,
mt->wri_abspath,
scratch_pool, scratch_pool));
@@ -450,198 +449,6 @@ do_text_merge_external(svn_boolean_t *co
return SVN_NO_ERROR;
}
-/* Create a new file in the same directory as VERSIONED_ABSPATH, with the
- same basename as VERSIONED_ABSPATH, with a ".edited" extension, and set
- *WORK_ITEM to a new work item that will copy and translate from the file
- SOURCE to that new file. It will be translated from repository-normal
- form to working-copy form according to the versioned properties of
- VERSIONED_ABSPATH that are current when the work item is executed.
-
- DB should have a write lock for the directory containing SOURCE.
-
- Allocate *WORK_ITEM in RESULT_POOL. */
-static svn_error_t*
-save_merge_result(svn_skel_t **work_item,
- const merge_target_t *mt,
- const char *source,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const char *edited_copy_abspath;
- const char *dir_abspath;
- const char *filename;
-
- svn_dirent_split(&dir_abspath, &filename, mt->local_abspath, scratch_pool);
-
- /* ### Should use preserved-conflict-file-exts. */
- /* Create the .edited file within this file's DIR_ABSPATH */
- SVN_ERR(svn_io_open_uniquely_named(NULL,
- &edited_copy_abspath,
- dir_abspath,
- filename,
- ".edited",
- svn_io_file_del_none,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__wq_build_file_copy_translated(work_item,
- mt->db, mt->local_abspath,
- source, edited_copy_abspath,
- result_pool, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-/* Deal with the result of the conflict resolution callback, as indicated by
- * CHOICE.
- *
- * Set *WORK_ITEMS to new work items that will ...
- * Set *MERGE_OUTCOME to the result of the 3-way merge.
- *
- * LEFT_ABSPATH, RIGHT_ABSPATH, and TARGET_ABSPATH are the input files to
- * the 3-way merge, and MERGED_FILE is the merged result as generated by the
- * internal or external merge or by the conflict resolution callback.
- *
- * DETRANSLATED_TARGET is the detranslated version of TARGET_ABSPATH
- * (see detranslate_wc_file() above). DIFF3_OPTIONS are passed to the
- * diff3 implementation in case a 3-way merge has to be carried out. */
-static svn_error_t*
-eval_conflict_func_result(svn_skel_t **work_items,
- enum svn_wc_merge_outcome_t *merge_outcome,
- svn_wc_conflict_choice_t choice,
- const merge_target_t *mt,
- const char *left_abspath,
- const char *right_abspath,
- const char *merged_file,
- const char *detranslated_target,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const char *install_from = NULL;
- svn_boolean_t remove_source = FALSE;
-
- *work_items = NULL;
-
- switch (choice)
- {
- /* If the callback wants to use one of the fulltexts
- to resolve the conflict, so be it.*/
- case svn_wc_conflict_choose_base:
- {
- install_from = left_abspath;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- case svn_wc_conflict_choose_theirs_full:
- {
- install_from = right_abspath;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- case svn_wc_conflict_choose_mine_full:
- {
- /* Do nothing to merge_target, let it live untouched! */
- *merge_outcome = svn_wc_merge_merged;
- return SVN_NO_ERROR;
- }
- case svn_wc_conflict_choose_theirs_conflict:
- case svn_wc_conflict_choose_mine_conflict:
- {
- const char *chosen_path;
- const char *temp_dir;
- svn_stream_t *chosen_stream;
- svn_diff_t *diff;
- svn_diff_conflict_display_style_t style;
- svn_diff_file_options_t *diff3_options;
-
- diff3_options = svn_diff_file_options_create(scratch_pool);
-
- if (mt->merge_options)
- SVN_ERR(svn_diff_file_options_parse(diff3_options,
- mt->merge_options,
- scratch_pool));
-
- style = choice == svn_wc_conflict_choose_theirs_conflict
- ? svn_diff_conflict_display_latest
- : svn_diff_conflict_display_modified;
-
- SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir, mt->db,
- mt->wri_abspath,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_open_unique(&chosen_stream, &chosen_path,
- temp_dir, svn_io_file_del_none,
- scratch_pool, scratch_pool));
-
- SVN_ERR(svn_diff_file_diff3_2(&diff,
- left_abspath,
- detranslated_target, right_abspath,
- diff3_options, scratch_pool));
- SVN_ERR(svn_diff_file_output_merge2(chosen_stream, diff,
- left_abspath,
- detranslated_target,
- right_abspath,
- /* markers ignored */
- NULL, NULL,
- NULL, NULL,
- style,
- scratch_pool));
- SVN_ERR(svn_stream_close(chosen_stream));
-
- install_from = chosen_path;
- remove_source = TRUE;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
-
- /* For the case of 3-way file merging, we don't
- really distinguish between these return values;
- if the callback claims to have "generally
- resolved" the situation, we still interpret
- that as "OK, we'll assume the merged version is
- good to use". */
- case svn_wc_conflict_choose_merged:
- {
- install_from = merged_file;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- case svn_wc_conflict_choose_postpone:
- default:
- {
-#if 0
- /* ### what should this value be? no caller appears to initialize
- ### it, so we really SHOULD be setting a value here. */
- *merge_outcome = svn_wc_merge_merged;
-#endif
-
- /* Assume conflict remains. */
- return SVN_NO_ERROR;
- }
- }
-
- SVN_ERR_ASSERT(install_from != NULL);
-
- {
- svn_skel_t *work_item;
-
- SVN_ERR(svn_wc__wq_build_file_install(&work_item,
- mt->db, mt->local_abspath,
- install_from,
- FALSE /* use_commit_times */,
- FALSE /* record_fileinfo */,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
-
- if (remove_source)
- {
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- mt->db, install_from,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- }
- }
-
- return SVN_NO_ERROR;
-}
-
/* Preserve the three pre-merge files.
Create three empty files, with unique names that each include the
@@ -722,7 +529,8 @@ preserve_pre_merge_files(svn_skel_t **wo
SVN_ERR(svn_io_copy_file(left_abspath, tmp_left, TRUE, scratch_pool));
/* And create a wq item to remove the file later */
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, tmp_left,
+ SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, wcroot_abspath,
+ tmp_left,
result_pool, scratch_pool));
last_items = svn_wc__wq_merge(last_items, work_item, result_pool);
@@ -738,7 +546,8 @@ preserve_pre_merge_files(svn_skel_t **wo
SVN_ERR(svn_io_copy_file(right_abspath, tmp_right, TRUE, scratch_pool));
/* And create a wq item to remove the file later */
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, tmp_right,
+ SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, wcroot_abspath,
+ tmp_right,
result_pool, scratch_pool));
last_items = svn_wc__wq_merge(last_items, work_item, result_pool);
@@ -788,7 +597,7 @@ preserve_pre_merge_files(svn_skel_t **wo
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
/* And maybe delete some tempfiles */
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db,
+ SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, wcroot_abspath,
detranslated_target_copy,
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
@@ -798,137 +607,13 @@ preserve_pre_merge_files(svn_skel_t **wo
return SVN_NO_ERROR;
}
-/* Helper for maybe_resolve_conflicts() below. */
-static const svn_wc_conflict_description2_t *
-setup_text_conflict_desc(const char *left_abspath,
- const char *right_abspath,
- const char *target_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- const char *result_target,
- const char *detranslated_target,
- const svn_prop_t *mimeprop,
- svn_boolean_t is_binary,
- apr_pool_t *pool)
-{
- svn_wc_conflict_description2_t *cdesc;
-
- cdesc = svn_wc_conflict_description_create_text2(target_abspath, pool);
- cdesc->is_binary = is_binary;
- cdesc->mime_type = (mimeprop && mimeprop->value)
- ? mimeprop->value->data : NULL,
- cdesc->base_abspath = left_abspath;
- cdesc->their_abspath = right_abspath;
- cdesc->my_abspath = detranslated_target;
- cdesc->merged_file = result_target;
-
- cdesc->src_left_version = left_version;
- cdesc->src_right_version = right_version;
-
- return cdesc;
-}
-
-/* XXX Insane amount of parameters... */
-/* RESULT_TARGET is the path to the merged file produced by the internal or
- external 3-way merge. */
-static svn_error_t*
-maybe_resolve_conflicts(svn_skel_t **work_items,
- const merge_target_t *mt,
- const char *left_abspath,
- const char *right_abspath,
- const char *left_label,
- const char *right_label,
- const char *target_label,
- enum svn_wc_merge_outcome_t *merge_outcome,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- const char *result_target,
- const char *detranslated_target,
- 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,
- apr_pool_t *scratch_pool)
-{
- svn_wc_conflict_result_t *result;
- svn_skel_t *work_item;
-
- *work_items = NULL;
-
- /* Give the conflict resolution callback a chance to clean
- up the conflicts before we mark the file 'conflicted' */
- if (!conflict_func)
- {
- /* If there is no interactive conflict resolution then we are effectively
- postponing conflict resolution. */
- result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone,
- NULL, result_pool);
- }
- else
- {
- const svn_wc_conflict_description2_t *cdesc;
-
- cdesc = setup_text_conflict_desc(left_abspath,
- right_abspath,
- mt->local_abspath,
- left_version,
- right_version,
- result_target,
- detranslated_target,
- get_prop(mt, SVN_PROP_MIME_TYPE),
- FALSE,
- scratch_pool);
-
- SVN_ERR(conflict_func(&result, cdesc, conflict_baton, scratch_pool,
- scratch_pool));
- if (result == NULL)
- return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
- NULL, _("Conflict callback violated API:"
- " returned no results"));
-
- if (result->save_merged)
- {
- SVN_ERR(save_merge_result(work_items,
- mt,
- /* Look for callback's own
- merged-file first: */
- result->merged_file
- ? result->merged_file
- : result_target,
- result_pool, scratch_pool));
- }
- }
-
- SVN_ERR(eval_conflict_func_result(&work_item,
- merge_outcome,
- result->choice,
- mt,
- left_abspath,
- right_abspath,
- result->merged_file
- ? result->merged_file
- : result_target,
- detranslated_target,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
-
- if (result->choice != svn_wc_conflict_choose_postpone)
- /* The conflicts have been dealt with, nothing else
- * to do for us here. */
- return SVN_NO_ERROR;
-
- /* The conflicts have not been dealt with. */
- *merge_outcome = svn_wc_merge_conflict;
-
- return SVN_NO_ERROR;
-}
-
-
/* Attempt a trivial merge of LEFT_ABSPATH and RIGHT_ABSPATH to TARGET_ABSPATH.
- * The merge is trivial if the file at LEFT_ABSPATH equals TARGET_ABSPATH,
- * because in this case the content of RIGHT_ABSPATH can be copied to the
- * target. On success, set *MERGE_OUTCOME to SVN_WC_MERGE_MERGED in case the
+ * The merge is trivial if the file at LEFT_ABSPATH equals the detranslated
+ * form of the target at DETRANSLATED_TARGET_ABSPATH, because in this case
+ * the content of RIGHT_ABSPATH can be copied to the target.
+ * Another trivial case is if DETRANSLATED_TARGET_ABSPATH is identical to
+ * RIGHT_ABSPATH - we can just accept the existing content as merge result.
+ * On success, set *MERGE_OUTCOME to SVN_WC_MERGE_MERGED in case the
* target was changed, or to SVN_WC_MERGE_UNCHANGED if the target was not
* changed. Install work queue items allocated in RESULT_POOL in *WORK_ITEMS.
* On failure, set *MERGE_OUTCOME to SVN_WC_MERGE_NO_MERGE. */
@@ -938,13 +623,18 @@ merge_file_trivial(svn_skel_t **work_ite
const char *left_abspath,
const char *right_abspath,
const char *target_abspath,
+ const char *detranslated_target_abspath,
svn_boolean_t dry_run,
svn_wc__db_t *db,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_skel_t *work_item;
- svn_boolean_t same_contents = FALSE;
+ svn_boolean_t same_left_right;
+ svn_boolean_t same_right_target;
+ svn_boolean_t same_left_target;
svn_node_kind_t kind;
svn_boolean_t is_special;
@@ -957,18 +647,23 @@ merge_file_trivial(svn_skel_t **work_ite
return SVN_NO_ERROR;
}
+ /* Check the files */
+ SVN_ERR(svn_io_files_contents_three_same_p(&same_left_right,
+ &same_right_target,
+ &same_left_target,
+ left_abspath,
+ right_abspath,
+ detranslated_target_abspath,
+ scratch_pool));
+
/* If the LEFT side of the merge is equal to WORKING, then we can
* copy RIGHT directly. */
- SVN_ERR(svn_io_files_contents_same_p(&same_contents, left_abspath,
- target_abspath, scratch_pool));
- if (same_contents)
+ if (same_left_target)
{
/* Check whether the left side equals the right side.
* If it does, there is no change to merge so we leave the target
* unchanged. */
- SVN_ERR(svn_io_files_contents_same_p(&same_contents, left_abspath,
- right_abspath, scratch_pool));
- if (same_contents)
+ if (same_left_right)
{
*merge_outcome = svn_wc_merge_unchanged;
}
@@ -977,6 +672,43 @@ merge_file_trivial(svn_skel_t **work_ite
*merge_outcome = svn_wc_merge_merged;
if (!dry_run)
{
+ const char *wcroot_abspath;
+ svn_boolean_t delete_src = FALSE;
+
+ /* The right_abspath might be outside our working copy. In that
+ case we should copy the file to a safe location before
+ installing to avoid breaking the workqueue.
+
+ This matches the behavior in preserve_pre_merge_files */
+
+ SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath,
+ db, target_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!svn_dirent_is_child(wcroot_abspath, right_abspath, NULL))
+ {
+ svn_stream_t *tmp_src;
+ svn_stream_t *tmp_dst;
+
+ SVN_ERR(svn_stream_open_readonly(&tmp_src, right_abspath,
+ scratch_pool,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__open_writable_base(&tmp_dst, &right_abspath,
+ NULL, NULL,
+ db, target_abspath,
+ scratch_pool,
+ scratch_pool));
+
+ SVN_ERR(svn_stream_copy3(tmp_src, tmp_dst,
+ cancel_func, cancel_baton,
+ scratch_pool));
+
+ /* no need to strdup right_abspath, as the wq_build_()
+ call already does that for us */
+ delete_src = TRUE;
+ }
+
SVN_ERR(svn_wc__wq_build_file_install(
&work_item, db, target_abspath, right_abspath,
FALSE /* use_commit_times */,
@@ -984,11 +716,35 @@ merge_file_trivial(svn_skel_t **work_ite
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item,
result_pool);
+
+ if (delete_src)
+ {
+ SVN_ERR(svn_wc__wq_build_file_remove(
+ &work_item, db, wcroot_abspath,
+ right_abspath,
+ result_pool, scratch_pool));
+ *work_items = svn_wc__wq_merge(*work_items, work_item,
+ result_pool);
+ }
}
}
return SVN_NO_ERROR;
}
+ else
+ {
+ /* Check whether the existing version equals the right side. If it
+ * does, the locally existing, changed file equals the incoming
+ * file, so there is no conflict. For binary files, we historically
+ * conflicted them needlessly, while merge_text_file figured it out
+ * eventually and returned svn_wc_merge_unchanged for them, which
+ * is what we do here. */
+ if (same_right_target)
+ {
+ *merge_outcome = svn_wc_merge_unchanged;
+ return SVN_NO_ERROR;
+ }
+ }
*merge_outcome = svn_wc_merge_no_merge;
return SVN_NO_ERROR;
@@ -998,6 +754,7 @@ merge_file_trivial(svn_skel_t **work_ite
/* XXX Insane amount of parameters... */
static svn_error_t*
merge_text_file(svn_skel_t **work_items,
+ svn_skel_t **conflict_skel,
enum svn_wc_merge_outcome_t *merge_outcome,
const merge_target_t *mt,
const char *left_abspath,
@@ -1006,11 +763,7 @@ merge_text_file(svn_skel_t **work_items,
const char *right_label,
const char *target_label,
svn_boolean_t dry_run,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
const char *detranslated_target_abspath,
- 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,
@@ -1066,22 +819,7 @@ merge_text_file(svn_skel_t **work_items,
if (contains_conflicts && ! dry_run)
{
- SVN_ERR(maybe_resolve_conflicts(work_items,
- mt,
- left_abspath,
- right_abspath,
- left_label,
- right_label,
- target_label,
- merge_outcome,
- left_version,
- right_version,
- result_target,
- detranslated_target_abspath,
- conflict_func, conflict_baton,
- cancel_func, cancel_baton,
- result_pool, scratch_pool));
-
+ *merge_outcome = svn_wc_merge_conflict;
if (*merge_outcome == svn_wc_merge_conflict)
{
const char *left_copy, *right_copy, *target_copy;
@@ -1097,14 +835,18 @@ merge_text_file(svn_skel_t **work_items,
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- /* Track the three conflict files in the metadata.
- * ### TODO WC-NG: Do this outside the work queue: see
- * svn_wc__wq_tmp_build_set_text_conflict_markers()'s doc string. */
- SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(
- &work_item, mt->db, mt->local_abspath,
- left_copy, right_copy, target_copy,
- result_pool, scratch_pool));
- *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
+ /* Track the conflict marker files in the metadata. */
+
+ if (!*conflict_skel)
+ *conflict_skel = svn_wc__conflict_skel_create(result_pool);
+
+ SVN_ERR(svn_wc__conflict_skel_add_text_conflict(*conflict_skel,
+ mt->db, mt->local_abspath,
+ target_copy,
+ left_copy,
+ right_copy,
+ result_pool,
+ scratch_pool));
}
if (*merge_outcome == svn_wc_merge_merged)
@@ -1147,8 +889,8 @@ merge_text_file(svn_skel_t **work_items,
done:
/* Remove the tempfile after use */
- SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- mt->db, result_target,
+ SVN_ERR(svn_wc__wq_build_file_remove(&work_item, mt->db, mt->local_abspath,
+ result_target,
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
@@ -1156,10 +898,10 @@ done:
return SVN_NO_ERROR;
}
-
/* XXX Insane amount of parameters... */
static svn_error_t *
merge_binary_file(svn_skel_t **work_items,
+ svn_skel_t **conflict_skel,
enum svn_wc_merge_outcome_t *merge_outcome,
const merge_target_t *mt,
const char *left_abspath,
@@ -1168,11 +910,7 @@ merge_binary_file(svn_skel_t **work_item
const char *right_label,
const char *target_label,
svn_boolean_t dry_run,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
const char *detranslated_target_abspath,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1182,7 +920,6 @@ merge_binary_file(svn_skel_t **work_item
const char *left_copy, *right_copy;
const char *merge_dirpath, *merge_filename;
const char *conflict_wrk;
- svn_skel_t *work_item;
*work_items = NULL;
@@ -1197,92 +934,6 @@ merge_binary_file(svn_skel_t **work_item
return SVN_NO_ERROR;
}
- /* Give the conflict resolution callback a chance to clean
- up the conflict before we mark the file 'conflicted' */
- if (conflict_func)
- {
- svn_wc_conflict_result_t *result = NULL;
- const svn_wc_conflict_description2_t *cdesc;
- const char *install_from = NULL;
-
- cdesc = setup_text_conflict_desc(left_abspath, right_abspath,
- mt->local_abspath,
- left_version, right_version,
- NULL /* result_target */,
- detranslated_target_abspath,
- get_prop(mt, SVN_PROP_MIME_TYPE),
- TRUE, pool);
-
- SVN_ERR(conflict_func(&result, cdesc, conflict_baton, pool, pool));
- if (result == NULL)
- return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
- NULL, _("Conflict callback violated API:"
- " returned no results"));
-
- switch (result->choice)
- {
- /* For a binary file, there's no merged file to look at,
- unless the conflict-callback did the merging itself. */
- case svn_wc_conflict_choose_base:
- {
- install_from = left_abspath;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- case svn_wc_conflict_choose_theirs_full:
- {
- install_from = right_abspath;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- /* For a binary file, if the response is to use the
- user's file, we do nothing. We also do nothing if
- the response claims to have already resolved the
- problem.*/
- case svn_wc_conflict_choose_mine_full:
- {
- *merge_outcome = svn_wc_merge_merged;
- return SVN_NO_ERROR;
- }
- case svn_wc_conflict_choose_merged:
- {
- if (! result->merged_file)
- {
- /* Callback asked us to choose its own
- merged file, but didn't provide one! */
- return svn_error_create
- (SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
- NULL, _("Conflict callback violated API:"
- " returned no merged file"));
- }
- else
- {
- install_from = result->merged_file;
- *merge_outcome = svn_wc_merge_merged;
- break;
- }
- }
- case svn_wc_conflict_choose_postpone:
- default:
- {
- /* Assume conflict remains, fall through to code below. */
- }
- }
-
- if (install_from != NULL)
- {
- SVN_ERR(svn_wc__wq_build_file_install(work_items,
- mt->db, mt->local_abspath,
- install_from,
- FALSE /* use_commit_times */,
- FALSE /* record_fileinfo */,
- result_pool, scratch_pool));
-
- /* A merge choice was made, so we're done here. */
- return SVN_NO_ERROR;
- }
- }
-
/* reserve names for backups of left and right fulltexts */
SVN_ERR(svn_io_open_uniquely_named(NULL,
&left_copy,
@@ -1328,16 +979,15 @@ merge_binary_file(svn_skel_t **work_item
/* Mark target_abspath's entry as "Conflicted", and start tracking
the backup files in the entry as well. */
- SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(&work_item,
- mt->db,
- mt->local_abspath,
- left_copy,
- right_copy,
- conflict_wrk,
- 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_text_conflict(*conflict_skel,
+ mt->db, mt->local_abspath,
+ conflict_wrk,
+ left_copy,
+ right_copy,
+ result_pool, scratch_pool));
*merge_outcome = svn_wc_merge_conflict; /* a conflict happened */
@@ -1347,12 +997,11 @@ merge_binary_file(svn_skel_t **work_item
/* XXX Insane amount of parameters... */
svn_error_t *
svn_wc__internal_merge(svn_skel_t **work_items,
+ svn_skel_t **conflict_skel,
enum svn_wc_merge_outcome_t *merge_outcome,
svn_wc__db_t *db,
const char *left_abspath,
- const svn_wc_conflict_version_t *left_version,
const char *right_abspath,
- const svn_wc_conflict_version_t *right_version,
const char *target_abspath,
const char *wri_abspath,
const char *left_label,
@@ -1363,8 +1012,6 @@ svn_wc__internal_merge(svn_skel_t **work
const char *diff3_cmd,
const apr_array_header_t *merge_options,
const apr_array_header_t *prop_diff,
- 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,
@@ -1418,13 +1065,15 @@ svn_wc__internal_merge(svn_skel_t **work
SVN_ERR(merge_file_trivial(work_items, merge_outcome,
left_abspath, right_abspath,
- target_abspath, dry_run, db,
+ target_abspath, detranslated_target_abspath,
+ dry_run, db, cancel_func, cancel_baton,
result_pool, scratch_pool));
if (*merge_outcome == svn_wc_merge_no_merge)
{
if (is_binary)
{
SVN_ERR(merge_binary_file(work_items,
+ conflict_skel,
merge_outcome,
&mt,
left_abspath,
@@ -1433,16 +1082,13 @@ svn_wc__internal_merge(svn_skel_t **work
right_label,
target_label,
dry_run,
- left_version,
- right_version,
detranslated_target_abspath,
- conflict_func,
- conflict_baton,
result_pool, scratch_pool));
}
else
{
SVN_ERR(merge_text_file(work_items,
+ conflict_skel,
merge_outcome,
&mt,
left_abspath,
@@ -1451,10 +1097,7 @@ svn_wc__internal_merge(svn_skel_t **work
right_label,
target_label,
dry_run,
- left_version,
- right_version,
detranslated_target_abspath,
- conflict_func, conflict_baton,
cancel_func, cancel_baton,
result_pool, scratch_pool));
}
@@ -1476,7 +1119,8 @@ svn_wc__internal_merge(svn_skel_t **work
svn_error_t *
-svn_wc_merge4(enum svn_wc_merge_outcome_t *merge_outcome,
+svn_wc_merge5(enum svn_wc_merge_outcome_t *merge_content_outcome,
+ enum svn_wc_notify_state_t *merge_props_outcome,
svn_wc_context_t *wc_ctx,
const char *left_abspath,
const char *right_abspath,
@@ -1489,6 +1133,7 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
svn_boolean_t dry_run,
const char *diff3_cmd,
const apr_array_header_t *merge_options,
+ apr_hash_t *original_props,
const apr_array_header_t *prop_diff,
svn_wc_conflict_resolver_func2_t conflict_func,
void *conflict_baton,
@@ -1498,7 +1143,10 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
{
const char *dir_abspath = svn_dirent_dirname(target_abspath, scratch_pool);
svn_skel_t *work_items;
- apr_hash_t *actual_props;
+ svn_skel_t *conflict_skel = NULL;
+ apr_hash_t *pristine_props = NULL;
+ apr_hash_t *actual_props = NULL;
+ apr_hash_t *new_actual_props = NULL;
SVN_ERR_ASSERT(svn_dirent_is_absolute(left_abspath));
SVN_ERR_ASSERT(svn_dirent_is_absolute(right_abspath));
@@ -1508,40 +1156,115 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
if (!dry_run)
SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, scratch_pool));
- /* Sanity check: the merge target must be under revision control,
- * unless the merge target is a copyfrom text, which lives in a
- * temporary file and does not exist in ACTUAL yet. */
+ /* Sanity check: the merge target must be a file under revision control */
{
+ svn_wc__db_status_t status;
svn_kind_t kind;
- svn_boolean_t hidden;
- SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, target_abspath, TRUE,
- scratch_pool));
+ svn_boolean_t had_props;
+ svn_boolean_t props_mod;
+ svn_boolean_t conflicted;
+
+ 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,
+ &conflicted, NULL, &had_props, &props_mod,
+ NULL, NULL, NULL,
+ wc_ctx->db, target_abspath,
+ scratch_pool, scratch_pool));
- if (kind == svn_kind_unknown)
+ if (kind != svn_kind_file || (status != svn_wc__db_status_normal
+ && status != svn_wc__db_status_added))
{
- *merge_outcome = svn_wc_merge_no_merge;
+ *merge_content_outcome = svn_wc_merge_no_merge;
+ if (merge_props_outcome)
+ *merge_props_outcome = svn_wc_notify_state_unchanged;
return SVN_NO_ERROR;
}
- SVN_ERR(svn_wc__db_node_hidden(&hidden, wc_ctx->db, target_abspath,
- scratch_pool));
+ 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,
+ wc_ctx->db, target_abspath,
+ scratch_pool));
+
+ /* We can't install two 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(target_abspath,
+ scratch_pool));
+ }
+ /* else: Conflict was resolved by removing markers */
+ }
+
+ if (merge_props_outcome && had_props)
+ {
+ SVN_ERR(svn_wc__db_read_pristine_props(&pristine_props,
+ wc_ctx->db, target_abspath,
+ scratch_pool, scratch_pool));
+ }
+ else if (merge_props_outcome)
+ pristine_props = apr_hash_make(scratch_pool);
- if (hidden)
+ if (props_mod)
{
- *merge_outcome = svn_wc_merge_no_merge;
- return SVN_NO_ERROR;
+ SVN_ERR(svn_wc__db_read_props(&actual_props,
+ wc_ctx->db, target_abspath,
+ scratch_pool, scratch_pool));
}
+ else if (pristine_props)
+ actual_props = apr_hash_copy(scratch_pool, pristine_props);
+ else
+ actual_props = apr_hash_make(scratch_pool);
}
- SVN_ERR(svn_wc__db_read_props(&actual_props, wc_ctx->db, target_abspath,
- scratch_pool, scratch_pool));
+ if (merge_props_outcome)
+ {
+ int i;
+ apr_hash_t *new_pristine_props;
+ /* The PROPCHANGES may not have non-"normal" properties in it. If entry
+ or wc props were allowed, then the following code would install them
+ into the BASE and/or WORKING properties(!). */
+ for (i = prop_diff->nelts; i--; )
+ {
+ const svn_prop_t *change = &APR_ARRAY_IDX(prop_diff, i, svn_prop_t);
+
+ if (!svn_wc_is_normal_prop(change->name))
+ return svn_error_createf(SVN_ERR_BAD_PROP_KIND, NULL,
+ _("The property '%s' may not be merged "
+ "into '%s'."),
+ change->name,
+ svn_dirent_local_style(target_abspath,
+ scratch_pool));
+ }
+
+ SVN_ERR(svn_wc__merge_props(&conflict_skel,
+ merge_props_outcome,
+ &new_pristine_props, &new_actual_props,
+ wc_ctx->db, target_abspath, svn_kind_file,
+ original_props, pristine_props, actual_props,
+ prop_diff, FALSE /* base_merge */,
+ dry_run,
+ cancel_func, cancel_baton,
+ scratch_pool, scratch_pool));
+ }
/* Queue all the work. */
SVN_ERR(svn_wc__internal_merge(&work_items,
- merge_outcome,
+ &conflict_skel,
+ merge_content_outcome,
wc_ctx->db,
- left_abspath, left_version,
- right_abspath, right_version,
+ left_abspath,
+ right_abspath,
target_abspath,
target_abspath,
left_label, right_label, target_label,
@@ -1550,20 +1273,56 @@ svn_wc_merge4(enum svn_wc_merge_outcome_
diff3_cmd,
merge_options,
prop_diff,
- conflict_func, conflict_baton,
cancel_func, cancel_baton,
scratch_pool, scratch_pool));
/* If this isn't a dry run, then run the work! */
if (!dry_run)
{
- SVN_ERR(svn_wc__db_wq_add(wc_ctx->db, target_abspath, work_items,
- scratch_pool));
- SVN_ERR(svn_wc__wq_run(wc_ctx->db, target_abspath,
- cancel_func, cancel_baton,
- scratch_pool));
- }
+ 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,
+ wc_ctx->db, target_abspath,
+ conflict_skel,
+ scratch_pool, scratch_pool));
+ work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+ }
+
+ if (new_actual_props)
+ SVN_ERR(svn_wc__db_op_set_props(wc_ctx->db, target_abspath,
+ new_actual_props,
+ svn_wc__has_magic_property(prop_diff),
+ conflict_skel, work_items,
+ scratch_pool));
+ else if (conflict_skel)
+ SVN_ERR(svn_wc__db_op_mark_conflict(wc_ctx->db, target_abspath,
+ conflict_skel, work_items,
+ scratch_pool));
+ else if (work_items)
+ SVN_ERR(svn_wc__db_wq_add(wc_ctx->db, target_abspath, work_items,
+ scratch_pool));
+
+ if (work_items)
+ SVN_ERR(svn_wc__wq_run(wc_ctx->db, target_abspath,
+ cancel_func, cancel_baton,
+ scratch_pool));
+
+ if (conflict_skel && conflict_func)
+ SVN_ERR(svn_wc__conflict_invoke_resolver(wc_ctx->db, target_abspath,
+ conflict_skel, merge_options,
+ conflict_func, conflict_baton,
+ scratch_pool));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/node.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/node.c Thu Aug 16 10:17:48 2012
@@ -288,27 +288,18 @@ svn_wc_read_kind(svn_node_kind_t *kind,
svn_boolean_t show_hidden,
apr_pool_t *scratch_pool)
{
- svn_wc__db_status_t db_status;
svn_kind_t db_kind;
- svn_error_t *err;
- err = svn_wc__db_read_info(&db_status, &db_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);
+ SVN_ERR(svn_wc__db_read_kind(&db_kind,
+ wc_ctx->db, local_abspath, TRUE, show_hidden,
+ scratch_pool));
- if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- {
- svn_error_clear(err);
- *kind = svn_node_none;
- return SVN_NO_ERROR;
- }
+ if (db_kind == svn_kind_dir)
+ *kind = svn_node_dir;
+ else if (db_kind == svn_kind_file || db_kind == svn_kind_symlink)
+ *kind = svn_node_file;
else
- SVN_ERR(err);
-
- SVN_ERR(convert_db_kind_to_node_kind(kind, db_kind, db_status, show_hidden));
+ *kind = svn_node_none;
return SVN_NO_ERROR;
}
@@ -876,41 +867,47 @@ svn_wc__node_has_working(svn_boolean_t *
}
-static svn_error_t *
-get_base_rev(svn_revnum_t *base_revision,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool)
+svn_error_t *
+svn_wc__node_get_base(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
+ const char **repos_uuid,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_error_t *err;
- err = svn_wc__db_base_get_info(NULL, NULL, base_revision, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool);
-
- if (!err || err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
- return svn_error_trace(err);
-
- svn_error_clear(err);
-
- *base_revision = SVN_INVALID_REVNUM;
+ err = svn_wc__db_base_get_info(NULL, NULL, revision, repos_relpath,
+ repos_root_url, repos_uuid, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ wc_ctx->db, local_abspath,
+ result_pool, scratch_pool);
+ if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ svn_error_clear(err);
+ if (revision)
+ *revision = SVN_INVALID_REVNUM;
+ if (repos_relpath)
+ *repos_relpath = NULL;
+ if (repos_root_url)
+ *repos_root_url = NULL;
+ if (repos_uuid)
+ *repos_uuid = NULL;
+ return SVN_NO_ERROR;
+ }
+ SVN_ERR(err);
+ SVN_ERR_ASSERT(!revision || SVN_IS_VALID_REVNUM(*revision));
+ SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
+ SVN_ERR_ASSERT(!repos_root_url || *repos_root_url);
+ SVN_ERR_ASSERT(!repos_uuid || *repos_uuid);
return SVN_NO_ERROR;
}
svn_error_t *
-svn_wc__node_get_base_rev(svn_revnum_t *base_revision,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *scratch_pool)
-{
- return svn_error_trace(get_base_rev(base_revision, wc_ctx->db,
- local_abspath, scratch_pool));
-}
-
-svn_error_t *
svn_wc__node_get_pre_ng_status_data(svn_revnum_t *revision,
svn_revnum_t *changed_rev,
apr_time_t *changed_date,
@@ -960,36 +957,54 @@ svn_wc__node_get_pre_ng_status_data(svn_
svn_error_t *
-svn_wc__internal_get_commit_base_rev(svn_revnum_t *commit_base_revision,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool)
+svn_wc__internal_get_commit_base(svn_revnum_t *commit_base_revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
+ const char **repos_uuid,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_status_t status;
svn_boolean_t have_base;
svn_boolean_t have_more_work;
svn_revnum_t revision;
- svn_revnum_t original_revision;
+ svn_revnum_t orig_revision;
+ const char *orig_repos_relpath;
+ const char *orig_repos_root_url;
+ const char *orig_repos_uuid;
*commit_base_revision = SVN_INVALID_REVNUM;
- SVN_ERR(svn_wc__db_read_info(&status, NULL, &revision, NULL, NULL, NULL,
+ SVN_ERR(svn_wc__db_read_info(&status, NULL,
+ &revision, repos_relpath,
+ repos_root_url, repos_uuid,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ &orig_repos_relpath, &orig_repos_root_url,
+ &orig_repos_uuid, &orig_revision,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, &original_revision, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
&have_base, &have_more_work, NULL,
db, local_abspath, scratch_pool, scratch_pool));
if (SVN_IS_VALID_REVNUM(revision))
{
/* We are looking directly at BASE */
- *commit_base_revision = revision;
+ if (commit_base_revision)
+ *commit_base_revision = revision;
return SVN_NO_ERROR;
}
- else if (SVN_IS_VALID_REVNUM(original_revision))
+ else if (SVN_IS_VALID_REVNUM(orig_revision))
{
/* We are looking at a copied node */
- *commit_base_revision = original_revision;
+ if (commit_base_revision)
+ *commit_base_revision = orig_revision;
+ if (repos_relpath)
+ *repos_relpath = orig_repos_relpath;
+ if (repos_root_url)
+ *repos_root_url = orig_repos_root_url;
+ if (repos_uuid)
+ *repos_uuid = orig_repos_uuid;
return SVN_NO_ERROR;
}
@@ -997,8 +1012,9 @@ svn_wc__internal_get_commit_base_rev(svn
{
/* If the node was copied/moved-here, return the copy/move source
revision (not this node's base revision). */
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, commit_base_revision,
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL,
+ repos_relpath, repos_root_url,
+ repos_uuid, commit_base_revision,
NULL, NULL, db, local_abspath,
scratch_pool, scratch_pool));
@@ -1019,10 +1035,10 @@ svn_wc__internal_get_commit_base_rev(svn
{
/* This is a deletion within a copied subtree. Get the copied-from
* revision. */
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL,
- commit_base_revision, NULL, NULL,
- db,
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL,
+ repos_relpath, repos_root_url,
+ repos_uuid, commit_base_revision,
+ NULL, NULL, db,
svn_dirent_dirname(work_del_abspath,
scratch_pool),
scratch_pool, scratch_pool));
@@ -1038,7 +1054,8 @@ svn_wc__internal_get_commit_base_rev(svn
if (have_base && !have_more_work)
{
SVN_ERR(svn_wc__db_base_get_info(&status, NULL, commit_base_revision,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ repos_relpath, repos_root_url,
+ repos_uuid, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool));
@@ -1051,14 +1068,19 @@ svn_wc__internal_get_commit_base_rev(svn
}
svn_error_t *
-svn_wc__node_get_commit_base_rev(svn_revnum_t *commit_base_revision,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *scratch_pool)
-{
- return svn_error_trace(svn_wc__internal_get_commit_base_rev(
- commit_base_revision, wc_ctx->db, local_abspath,
- scratch_pool));
+svn_wc__node_get_commit_base(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
+ const char **repos_uuid,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(svn_wc__internal_get_commit_base(
+ revision, repos_relpath, repos_root_url, repos_uuid,
+ wc_ctx->db, local_abspath,
+ result_pool, scratch_pool));
}
svn_error_t *
@@ -1228,78 +1250,6 @@ svn_wc__node_get_schedule(svn_wc_schedul
}
svn_error_t *
-svn_wc__node_get_conflict_info(const char **conflict_old,
- const char **conflict_new,
- const char **conflict_wrk,
- const char **prejfile,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_boolean_t conflicted;
-
- SVN_ERR(svn_wc__db_read_info(NULL, NULL, 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,
- wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
-
- if (conflict_old)
- *conflict_old = NULL;
- if (conflict_new)
- *conflict_new = NULL;
- if (conflict_wrk)
- *conflict_wrk = NULL;
- if (prejfile)
- *prejfile = NULL;
-
- if (conflicted
- && (conflict_old || conflict_new || conflict_wrk || prejfile))
- {
- const apr_array_header_t *conflicts;
- int j;
- SVN_ERR(svn_wc__db_read_conflicts(&conflicts, wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
-
- for (j = 0; j < conflicts->nelts; j++)
- {
- const svn_wc_conflict_description2_t *cd;
- cd = APR_ARRAY_IDX(conflicts, j,
- const svn_wc_conflict_description2_t *);
-
- switch (cd->kind)
- {
- case svn_wc_conflict_kind_text:
- if (conflict_old)
- *conflict_old = svn_dirent_basename(cd->base_abspath,
- result_pool);
-
- if (conflict_new)
- *conflict_new = svn_dirent_basename(cd->their_abspath,
- result_pool);
-
- if (conflict_wrk)
- *conflict_wrk = svn_dirent_basename(cd->my_abspath,
- result_pool);
- break;
-
- case svn_wc_conflict_kind_property:
- if (prejfile)
- *prejfile = svn_dirent_basename(cd->their_abspath,
- result_pool);
- break;
- case svn_wc_conflict_kind_tree:
- break;
- }
- }
- }
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
svn_wc__node_clear_dav_cache_recursive(svn_wc_context_t *wc_ctx,
const char *local_abspath,
apr_pool_t *scratch_pool)
@@ -1322,18 +1272,18 @@ svn_wc__node_get_lock_tokens_recursive(a
}
svn_error_t *
-svn_wc__get_server_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
return svn_error_trace(
- svn_wc__db_get_server_excluded_subtrees(server_excluded_subtrees,
- wc_ctx->db,
- local_abspath,
- result_pool,
- scratch_pool));
+ svn_wc__db_get_excluded_subtrees(server_excluded_subtrees,
+ wc_ctx->db,
+ local_abspath,
+ result_pool,
+ scratch_pool));
}
svn_error_t *
@@ -1429,6 +1379,15 @@ svn_wc__internal_get_origin(svn_boolean_
return SVN_NO_ERROR; /* Local addition */
}
+ /* We don't know how the following error condition can be fulfilled
+ * but we have seen that happening in the wild. Better to create
+ * an error than a SEGFAULT. */
+ if (status == svn_wc__db_status_incomplete && !original_repos_relpath)
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("Incomplete copy information on path '%s'."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
*repos_relpath = svn_relpath_join(
original_repos_relpath,
svn_dirent_skip_ancestor(op_root_abspath,
@@ -1475,68 +1434,38 @@ svn_wc__node_get_origin(svn_boolean_t *i
}
svn_error_t *
-svn_wc__node_get_commit_status(svn_node_kind_t *kind,
- svn_boolean_t *added,
+svn_wc__node_get_commit_status(svn_boolean_t *added,
svn_boolean_t *deleted,
svn_boolean_t *is_replace_root,
- svn_boolean_t *not_present,
- svn_boolean_t *excluded,
svn_boolean_t *is_op_root,
- svn_boolean_t *symlink,
svn_revnum_t *revision,
- const char **repos_relpath,
svn_revnum_t *original_revision,
const char **original_repos_relpath,
- svn_boolean_t *conflicted,
- const char **changelist,
- svn_boolean_t *props_mod,
- svn_boolean_t *update_root,
- const char **lock_token,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_wc__db_status_t status;
- svn_kind_t db_kind;
- svn_wc__db_lock_t *lock;
- svn_boolean_t had_props;
- svn_boolean_t props_mod_tmp;
svn_boolean_t have_base;
svn_boolean_t have_more_work;
svn_boolean_t op_root;
- if (!props_mod)
- props_mod = &props_mod_tmp;
-
/* ### All of this should be handled inside a single read transaction */
- SVN_ERR(svn_wc__db_read_info(&status, &db_kind, revision, repos_relpath,
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
original_repos_relpath, NULL, NULL,
- original_revision, &lock, NULL, NULL,
- changelist, conflicted,
- &op_root, &had_props, props_mod,
+ original_revision, NULL, NULL, NULL,
+ NULL, NULL,
+ &op_root, NULL, NULL,
&have_base, &have_more_work, NULL,
wc_ctx->db, local_abspath,
result_pool, scratch_pool));
- if (kind)
- {
- if (db_kind == svn_kind_file)
- *kind = svn_node_file;
- else if (db_kind == svn_kind_dir)
- *kind = svn_node_dir;
- else
- *kind = svn_node_unknown;
- }
if (added)
*added = (status == svn_wc__db_status_added);
if (deleted)
*deleted = (status == svn_wc__db_status_deleted);
- if (not_present)
- *not_present = (status == svn_wc__db_status_not_present);
- if (excluded)
- *excluded = (status == svn_wc__db_status_excluded);
if (is_op_root)
*is_op_root = op_root;
@@ -1552,40 +1481,19 @@ svn_wc__node_get_commit_status(svn_node_
*is_replace_root = FALSE;
}
- if (symlink)
- {
- apr_hash_t *props;
- *symlink = FALSE;
-
- if (db_kind == svn_kind_file
- && (had_props || *props_mod))
- {
- SVN_ERR(svn_wc__db_read_props(&props, wc_ctx->db, local_abspath,
- scratch_pool, scratch_pool));
-
- *symlink = ((props != NULL)
- && (apr_hash_get(props, SVN_PROP_SPECIAL,
- APR_HASH_KEY_STRING) != NULL));
- }
- }
-
/* Retrieve some information from BASE which is needed for replacing
- and/or deleting BASE nodes. (We don't need lock here) */
+ and/or deleting BASE nodes. */
if (have_base
- && ((revision && !SVN_IS_VALID_REVNUM(*revision))
- || (update_root && status == svn_wc__db_status_normal)))
+ && !have_more_work
+ && op_root
+ && (revision && !SVN_IS_VALID_REVNUM(*revision)))
{
SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, update_root,
+ NULL, NULL, NULL,
wc_ctx->db, local_abspath,
scratch_pool, scratch_pool));
}
- else if (update_root)
- *update_root = FALSE;
-
- if (lock_token)
- *lock_token = lock ? lock->token : NULL;
return SVN_NO_ERROR;
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/old-and-busted.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/old-and-busted.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/old-and-busted.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/old-and-busted.c Thu Aug 16 10:17:48 2012
@@ -382,7 +382,7 @@ opt_revision_to_string(const char **str,
*str = apr_pstrmemdup(pool, "HEAD", 4);
break;
case svn_opt_revision_number:
- *str = apr_itoa(pool, rev->value.number);
+ *str = apr_ltoa(pool, rev->value.number);
break;
default:
return svn_error_createf