You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/05/16 22:32:54 UTC
svn commit: r1339349 [9/37] - in /subversion/branches/fix-rdump-editor: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/client-side/vim/
contrib/server-side/ notes/ notes/api-errata...
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/merge.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/merge.c Wed May 16 20:32:43 2012
@@ -58,6 +58,8 @@
#include "private/svn_mergeinfo_private.h"
#include "private/svn_fspath.h"
#include "private/svn_ra_private.h"
+#include "private/svn_client_private.h"
+#include "private/svn_subr_private.h"
#include "svn_private_config.h"
@@ -66,7 +68,8 @@
/* MERGEINFO MERGE SOURCE NORMALIZATION
*
* Nearly any helper function herein that accepts two URL/revision
- * pairs expects one of two things to be true:
+ * pairs (or equivalent struct merge_source_t) expects one of two things
+ * to be true:
*
* 1. that mergeinfo is not being recorded at all for this
* operation, or
@@ -157,24 +160,17 @@
/*** Repos-Diff Editor Callbacks ***/
-/* Repository root and UUID for a repository. */
-typedef struct url_uuid_t
-{
- const char *url;
- const char *uuid;
-} url_uuid_t;
-
/* */
typedef struct merge_source_t
{
/* "left" side URL and revision (inclusive iff youngest) */
- const char *url1;
- svn_revnum_t rev1;
+ const svn_client__pathrev_t *loc1;
/* "right" side URL and revision (inclusive iff youngest) */
- const char *url2;
- svn_revnum_t rev2;
+ const svn_client__pathrev_t *loc2;
+ /* True iff LOC1 is an ancestor of LOC2 or vice-versa (history-wise). */
+ svn_boolean_t ancestral;
} merge_source_t;
/* Description of the merge target root node (a WC working node) */
@@ -186,14 +182,10 @@ typedef struct merge_target_t
/* Node kind of the WC node (at the start of the merge) */
svn_node_kind_t kind;
- /* URL of the node, or NULL if node is locally added */
- const char *url;
-
- /* Revision of the node, or NULL if node is locally added */
- svn_revnum_t rev;
-
- /* Repository root URL and UUID, even if node is locally added */
- url_uuid_t repos_root;
+ /* The repository location of the base node of the target WC. If the node
+ * is locally added, then URL & REV are NULL & SVN_INVALID_REVNUM.
+ * REPOS_ROOT_URL and REPOS_UUID are always valid. */
+ svn_client__pathrev_t loc;
} merge_target_t;
@@ -202,9 +194,6 @@ typedef struct merge_cmd_baton_t {
svn_boolean_t dry_run;
svn_boolean_t record_only; /* Whether to merge only mergeinfo
differences. */
- svn_boolean_t sources_ancestral; /* Whether the left-side merge source is
- an ancestor of the right-side, or
- vice-versa (history-wise). */
svn_boolean_t same_repos; /* Whether the merge source repository
is the same repository as the
target. Defaults to FALSE if DRY_RUN
@@ -214,9 +203,6 @@ typedef struct merge_cmd_baton_t {
svn_boolean_t ignore_ancestry; /* Are we ignoring ancestry (and by
extension, mergeinfo)? FALSE if
SOURCES_ANCESTRAL is FALSE. */
- svn_boolean_t target_missing_child; /* Whether working copy target of the
- merge is missing any immediate
- children. */
svn_boolean_t reintegrate_merge; /* Whether this is a --reintegrate
merge or not. */
const char *added_path; /* Set to the dir path whenever the
@@ -307,7 +293,7 @@ typedef struct merge_cmd_baton_t {
source is in the same repository as the merge target, and ancestry is
being considered. */
#define HONOR_MERGEINFO(merge_b) ((merge_b)->mergeinfo_capable \
- && (merge_b)->sources_ancestral \
+ && (merge_b)->merge_source.ancestral \
&& (merge_b)->same_repos \
&& (! (merge_b)->ignore_ancestry))
@@ -323,53 +309,83 @@ typedef struct merge_cmd_baton_t {
/*** Utilities ***/
+/* Return a new merge_source_t structure, allocated in RESULT_POOL,
+ * initialized with deep copies of LOC1 and LOC2 and ANCESTRAL. */
+static merge_source_t *
+merge_source_create(const svn_client__pathrev_t *loc1,
+ const svn_client__pathrev_t *loc2,
+ svn_boolean_t ancestral,
+ apr_pool_t *result_pool)
+{
+ merge_source_t *s
+ = apr_palloc(result_pool, sizeof(*s));
+
+ s->loc1 = svn_client__pathrev_dup(loc1, result_pool);
+ s->loc2 = svn_client__pathrev_dup(loc2, result_pool);
+ s->ancestral = ancestral;
+ return s;
+}
+
+/* Return a deep copy of SOURCE, allocated in RESULT_POOL. */
+static merge_source_t *
+merge_source_dup(const merge_source_t *source,
+ apr_pool_t *result_pool)
+{
+ merge_source_t *s = apr_palloc(result_pool, sizeof(*s));
+
+ s->loc1 = svn_client__pathrev_dup(source->loc1, result_pool);
+ s->loc2 = svn_client__pathrev_dup(source->loc2, result_pool);
+ s->ancestral = source->ancestral;
+ return s;
+}
+
/* Return SVN_ERR_UNSUPPORTED_FEATURE if URL is not inside the repository
of LOCAL_ABSPATH. Use SCRATCH_POOL for temporary allocations. */
static svn_error_t *
-check_repos_match(merge_cmd_baton_t *merge_b,
+check_repos_match(const merge_target_t *target,
const char *local_abspath,
const char *url,
apr_pool_t *scratch_pool)
{
- if (!svn_uri__is_ancestor(merge_b->target->repos_root.url, url))
+ if (!svn_uri__is_ancestor(target->loc.repos_root_url, url))
return svn_error_createf(
SVN_ERR_UNSUPPORTED_FEATURE, NULL,
_("Url '%s' of '%s' is not in repository '%s'"),
url, svn_dirent_local_style(local_abspath, scratch_pool),
- merge_b->target->repos_root.url);
+ target->loc.repos_root_url);
return SVN_NO_ERROR;
}
-/* Return TRUE iff the repository identified by REPOS_ROOT1 is the same as
- * that identified by REPOS_ROOT2. If STRICT_URLS is true, the URLs must
+/* Return TRUE iff the repository of LOCATION1 is the same as
+ * that of LOCATION2. If STRICT_URLS is true, the URLs must
* match (and the UUIDs, just to be sure), otherwise just the UUIDs must
* match and the URLs can differ (a common case is http versus https). */
static svn_boolean_t
-is_same_repos(const url_uuid_t *repos_root1,
- const url_uuid_t *repos_root2,
+is_same_repos(const svn_client__pathrev_t *location1,
+ const svn_client__pathrev_t *location2,
svn_boolean_t strict_urls)
{
if (strict_urls)
- return (strcmp(repos_root1->url, repos_root2->url) == 0
- && strcmp(repos_root1->uuid, repos_root2->uuid) == 0);
+ return (strcmp(location1->repos_root_url, location2->repos_root_url) == 0
+ && strcmp(location1->repos_uuid, location2->repos_uuid) == 0);
else
- return (strcmp(repos_root1->uuid, repos_root2->uuid) == 0);
+ return (strcmp(location1->repos_uuid, location2->repos_uuid) == 0);
}
-/* If the repository identified by REPOS_ROOT1 is not the same as that
- * identified by REPOS_ROOT2, throw a SVN_ERR_CLIENT_UNRELATED_RESOURCES
+/* If the repository identified of LOCATION1 is not the same as that
+ * of LOCATION2, throw a SVN_ERR_CLIENT_UNRELATED_RESOURCES
* error mentioning PATH1 and PATH2. For STRICT_URLS, see is_same_repos().
*/
static svn_error_t *
-check_same_repos(const url_uuid_t *repos_root1,
+check_same_repos(const svn_client__pathrev_t *location1,
const char *path1,
- const url_uuid_t *repos_root2,
+ const svn_client__pathrev_t *location2,
const char *path2,
svn_boolean_t strict_urls,
apr_pool_t *scratch_pool)
{
- if (! is_same_repos(repos_root1, repos_root2, strict_urls))
+ if (! is_same_repos(location1, location2, strict_urls))
return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
_("'%s' must be from the same repository as "
"'%s'"), path1, path2);
@@ -506,67 +522,63 @@ perform_obstruction_check(svn_wc_notify_
/* Create *LEFT and *RIGHT conflict versions for conflict victim
* at VICTIM_ABSPATH, with kind NODE_KIND, using information obtained
- * from MERGE_B.
- * Allocate returned conflict versions in MERGE_B->POOL. */
+ * from MERGE_SOURCE and TARGET.
+ * Allocate returned conflict versions in POOL. */
static svn_error_t *
make_conflict_versions(const svn_wc_conflict_version_t **left,
const svn_wc_conflict_version_t **right,
const char *victim_abspath,
svn_node_kind_t node_kind,
- merge_cmd_baton_t *merge_b)
+ const merge_source_t *merge_source,
+ const merge_target_t *target,
+ apr_pool_t *pool)
{
- const char *src_repos_url; /* root URL of source repository */
- const char *left_url;
- const char *right_url;
+ const char *child = svn_dirent_skip_ancestor(target->abspath,
+ victim_abspath);
+ const char *left_relpath, *right_relpath;
- SVN_ERR(svn_ra_get_repos_root2(merge_b->ra_session1, &src_repos_url,
- merge_b->pool));
-
- /* Construct the source URLs of the victim. */
- {
- const char *child = svn_dirent_skip_ancestor(merge_b->target->abspath,
- victim_abspath);
- SVN_ERR_ASSERT(child != NULL);
- left_url = svn_path_url_add_component2(merge_b->merge_source.url1,
- child, merge_b->pool);
- right_url = svn_path_url_add_component2(merge_b->merge_source.url2,
- child, merge_b->pool);
- }
+ SVN_ERR_ASSERT(child != NULL);
+ left_relpath = svn_client__pathrev_relpath(merge_source->loc1,
+ pool);
+ right_relpath = svn_client__pathrev_relpath(merge_source->loc2,
+ pool);
*left = svn_wc_conflict_version_create(
- src_repos_url,
- svn_uri_skip_ancestor(src_repos_url, left_url, merge_b->pool),
- merge_b->merge_source.rev1, node_kind, merge_b->pool);
+ merge_source->loc1->repos_root_url,
+ svn_relpath_join(left_relpath, child, pool),
+ merge_source->loc1->rev, node_kind, pool);
*right = svn_wc_conflict_version_create(
- src_repos_url,
- svn_uri_skip_ancestor(src_repos_url, right_url, merge_b->pool),
- merge_b->merge_source.rev2, node_kind, merge_b->pool);
+ merge_source->loc2->repos_root_url,
+ svn_relpath_join(right_relpath, child, pool),
+ merge_source->loc2->rev, node_kind, pool);
return SVN_NO_ERROR;
}
-/* Set *CONFLICT to a new tree-conflict description allocated in MERGE_B->pool,
- * populated with information from MERGE_B and the other parameters.
+/* Set *CONFLICT to a new tree-conflict description allocated in POOL,
+ * populated with information from the other parameters.
* See tree_conflict() for the other parameters.
*/
static svn_error_t*
make_tree_conflict(svn_wc_conflict_description2_t **conflict,
- merge_cmd_baton_t *merge_b,
const char *victim_abspath,
svn_node_kind_t node_kind,
svn_wc_conflict_action_t action,
- svn_wc_conflict_reason_t reason)
+ svn_wc_conflict_reason_t reason,
+ const merge_source_t *merge_source,
+ const merge_target_t *target,
+ apr_pool_t *pool)
{
const svn_wc_conflict_version_t *left;
const svn_wc_conflict_version_t *right;
SVN_ERR(make_conflict_versions(&left, &right, victim_abspath, node_kind,
- merge_b));
+ merge_source, target, pool));
*conflict = svn_wc_conflict_description_create_tree2(
victim_abspath, node_kind, svn_wc_operation_merge,
- left, right, merge_b->pool);
+ left, right, pool);
(*conflict)->action = action;
(*conflict)->reason = reason;
@@ -607,8 +619,10 @@ tree_conflict(merge_cmd_baton_t *merge_b
svn_wc_conflict_description2_t *conflict;
/* There is no existing tree conflict so it is safe to add one. */
- SVN_ERR(make_tree_conflict(&conflict, merge_b, victim_abspath,
- node_kind, action, reason));
+ SVN_ERR(make_tree_conflict(&conflict, victim_abspath,
+ node_kind, action, reason,
+ &merge_b->merge_source, merge_b->target,
+ merge_b->pool));
SVN_ERR(svn_wc__add_tree_conflict(merge_b->ctx->wc_ctx, conflict,
merge_b->pool));
@@ -641,8 +655,10 @@ tree_conflict_on_add(merge_cmd_baton_t *
/* Construct the new conflict first compare the new conflict with
a possibly existing one. */
- SVN_ERR(make_tree_conflict(&conflict, merge_b, victim_abspath,
- node_kind, action, reason));
+ SVN_ERR(make_tree_conflict(&conflict, victim_abspath,
+ node_kind, action, reason,
+ &merge_b->merge_source, merge_b->target,
+ merge_b->pool));
SVN_ERR(svn_wc__get_tree_conflict(&existing_conflict, merge_b->ctx->wc_ctx,
victim_abspath, merge_b->pool,
@@ -857,9 +873,9 @@ filter_self_referential_mergeinfo(apr_ar
apr_array_header_t *adjusted_props;
int i;
apr_pool_t *iterpool;
- svn_boolean_t is_added;
- const char *target_base_url;
- svn_revnum_t target_base_rev;
+ svn_boolean_t is_copy;
+ const char *repos_relpath;
+ svn_client__pathrev_t target_base;
/* Issue #3383: We don't want mergeinfo from a foreign repos.
@@ -883,14 +899,17 @@ filter_self_referential_mergeinfo(apr_ar
/* If this is a merge from the same repository and PATH itself has been
added there is no need to filter. */
- SVN_ERR(svn_wc__node_is_added(&is_added, ctx->wc_ctx, target_abspath, pool));
- if (is_added)
- return SVN_NO_ERROR;
+ SVN_ERR(svn_wc__node_get_origin(&is_copy, &target_base.rev, &repos_relpath,
+ &target_base.repos_root_url,
+ &target_base.repos_uuid, NULL,
+ ctx->wc_ctx, target_abspath, FALSE,
+ pool, pool));
+
+ if (is_copy || !repos_relpath)
+ return SVN_NO_ERROR; /* A copy or a local addition */
- SVN_ERR(svn_client_url_from_path2(&target_base_url, target_abspath,
- ctx, pool, pool));
- SVN_ERR(svn_wc__node_get_base_rev(&target_base_rev, ctx->wc_ctx,
- target_abspath, pool));
+ target_base.url = svn_path_url_add_component2(target_base.repos_root_url,
+ repos_relpath, pool);
adjusted_props = apr_array_make(pool, (*props)->nelts, sizeof(svn_prop_t));
iterpool = svn_pool_create(pool);
@@ -960,7 +979,7 @@ filter_self_referential_mergeinfo(apr_ar
the cost of a roundtrip communication with the repository. */
SVN_ERR(split_mergeinfo_on_revision(&younger_mergeinfo,
&mergeinfo,
- target_base_rev,
+ target_base.rev,
iterpool));
/* Filter self-referential mergeinfo from younger_mergeinfo. */
@@ -989,7 +1008,7 @@ filter_self_referential_mergeinfo(apr_ar
for (j = 0; j < rangelist->nelts; j++)
{
svn_error_t *err2;
- const char *start_url;
+ svn_client__pathrev_t *start_loc;
svn_merge_range_t *range =
APR_ARRAY_IDX(rangelist, j, svn_merge_range_t *);
@@ -1001,8 +1020,8 @@ filter_self_referential_mergeinfo(apr_ar
/* Check if PATH@BASE_REVISION exists at
RANGE->START on the same line of history.
(start+1 because RANGE->start is not inclusive.) */
- err2 = svn_client__repos_location(&start_url, ra_session,
- target_base_url, target_base_rev,
+ err2 = svn_client__repos_location(&start_loc, ra_session,
+ &target_base,
range->start + 1,
ctx, iterpool, iterpool);
if (err2)
@@ -1049,7 +1068,7 @@ filter_self_referential_mergeinfo(apr_ar
PATH@RANGE->END actually belong to some other
line of history and we want to record this
mergeinfo, not filter it. */
- if (strcmp(start_url, merge_source_url) != 0)
+ if (strcmp(start_loc->url, merge_source_url) != 0)
{
APR_ARRAY_PUSH(adjusted_rangelist,
svn_merge_range_t *) = range;
@@ -1078,8 +1097,8 @@ filter_self_referential_mergeinfo(apr_ar
svn_mergeinfo_t implicit_mergeinfo;
SVN_ERR(svn_client__get_history_as_mergeinfo(
- &implicit_mergeinfo, NULL, target_base_url,
- target_base_rev, target_base_rev, SVN_INVALID_REVNUM,
+ &implicit_mergeinfo, NULL,
+ &target_base, target_base.rev, SVN_INVALID_REVNUM,
ra_session, ctx, iterpool));
/* Remove PATH's implicit mergeinfo from the incoming mergeinfo. */
@@ -1120,31 +1139,33 @@ filter_self_referential_mergeinfo(apr_ar
return SVN_NO_ERROR;
}
-/* Used for both file and directory property merges. */
+/* Prepare a set of property changes PROPCHANGES to be used for a merge
+ operation on LOCAL_ABSPATH. Store the result in *PROP_UPDATES.
+
+ Store information on where mergeinfo is updated in MERGE_B.
+
+ Used for both file and directory property merges. */
static svn_error_t *
-merge_props_changed(svn_wc_notify_state_t *state,
- svn_boolean_t *tree_conflicted,
- const char *local_abspath,
- const apr_array_header_t *propchanges,
- apr_hash_t *original_props,
- void *baton,
- apr_pool_t *scratch_pool)
+prepare_merge_props_changed(const apr_array_header_t **prop_updates,
+ const char *local_abspath,
+ const apr_array_header_t *propchanges,
+ merge_cmd_baton_t *merge_b,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_array_header_t *props;
- merge_cmd_baton_t *merge_b = baton;
- svn_client_ctx_t *ctx = merge_b->ctx;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR(svn_categorize_props(propchanges, NULL, NULL, &props,
- scratch_pool));
+ result_pool));
/* If we are only applying mergeinfo changes then we need to do
additional filtering of PROPS so it contains only mergeinfo changes. */
if (merge_b->record_only && props->nelts)
{
apr_array_header_t *mergeinfo_props =
- apr_array_make(scratch_pool, 1, sizeof(svn_prop_t));
+ apr_array_make(result_pool, 1, sizeof(svn_prop_t));
int i;
for (i = 0; i < props->nelts; i++)
@@ -1164,15 +1185,13 @@ merge_props_changed(svn_wc_notify_state_
definition, 'svn merge' shouldn't touch any data within .svn/ */
if (props->nelts)
{
- svn_error_t *err;
-
/* If this is a forward merge then don't add new mergeinfo to
PATH that is already part of PATH's own history, see
http://svn.haxx.se/dev/archive-2008-09/0006.shtml. If the
merge sources are not ancestral then there is no concept of a
'forward' or 'reverse' merge and we filter unconditionally. */
- if (merge_b->merge_source.rev1 < merge_b->merge_source.rev2
- || !merge_b->sources_ancestral)
+ if (merge_b->merge_source.loc1->rev < merge_b->merge_source.loc2->rev
+ || !merge_b->merge_source.ancestral)
SVN_ERR(filter_self_referential_mergeinfo(&props,
local_abspath,
HONOR_MERGEINFO(merge_b),
@@ -1180,88 +1199,67 @@ merge_props_changed(svn_wc_notify_state_
merge_b->reintegrate_merge,
merge_b->ra_session2,
merge_b->ctx,
- scratch_pool));
+ result_pool));
+ }
+ *prop_updates = props;
- err = svn_wc_merge_props3(state, ctx->wc_ctx, local_abspath, NULL, NULL,
- original_props, props, merge_b->dry_run,
- ctx->conflict_func2, ctx->conflict_baton2,
- ctx->cancel_func, ctx->cancel_baton,
- scratch_pool);
+ /* If this is not a dry run then make a record in BATON if we find a
+ PATH where mergeinfo is added where none existed previously or PATH
+ is having its existing mergeinfo deleted. */
+ if (!merge_b->dry_run && props->nelts)
+ {
+ int i;
- /* If this is not a dry run then make a record in BATON if we find a
- PATH where mergeinfo is added where none existed previously or PATH
- is having its existing mergeinfo deleted. */
- if (!merge_b->dry_run)
+ for (i = 0; i < props->nelts; ++i)
{
- int i;
+ svn_prop_t *prop = &APR_ARRAY_IDX(props, i, svn_prop_t);
- for (i = 0; i < props->nelts; ++i)
+ if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
{
- svn_prop_t *prop = &APR_ARRAY_IDX(props, i, svn_prop_t);
-
- if (strcmp(prop->name, SVN_PROP_MERGEINFO) == 0)
- {
- /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
- svn_boolean_t has_pristine_mergeinfo = FALSE;
- apr_hash_t *pristine_props;
-
- SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
- ctx->wc_ctx,
- local_abspath,
- scratch_pool,
- scratch_pool));
+ /* Does LOCAL_ABSPATH have any pristine mergeinfo? */
+ svn_boolean_t has_pristine_mergeinfo = FALSE;
+ apr_hash_t *pristine_props;
+
+ SVN_ERR(svn_wc_get_pristine_props(&pristine_props,
+ merge_b->ctx->wc_ctx,
+ local_abspath,
+ scratch_pool,
+ scratch_pool));
- if (pristine_props
- && apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
- APR_HASH_KEY_STRING))
- has_pristine_mergeinfo = TRUE;
+ if (pristine_props
+ && apr_hash_get(pristine_props, SVN_PROP_MERGEINFO,
+ APR_HASH_KEY_STRING))
+ has_pristine_mergeinfo = TRUE;
- if (!has_pristine_mergeinfo && prop->value)
- {
- /* If BATON->PATHS_WITH_NEW_MERGEINFO needs to be
- allocated do so in BATON->POOL so it has a
- sufficient lifetime. */
- if (!merge_b->paths_with_new_mergeinfo)
- merge_b->paths_with_new_mergeinfo =
- apr_hash_make(merge_b->pool);
-
- apr_hash_set(merge_b->paths_with_new_mergeinfo,
- apr_pstrdup(merge_b->pool, local_abspath),
- APR_HASH_KEY_STRING, local_abspath);
- }
- else if (has_pristine_mergeinfo && !prop->value)
- {
- /* If BATON->PATHS_WITH_DELETED_MERGEINFO needs to be
- allocated do so in BATON->POOL so it has a
- sufficient lifetime. */
- if (!merge_b->paths_with_deleted_mergeinfo)
- merge_b->paths_with_deleted_mergeinfo =
- apr_hash_make(merge_b->pool);
-
- apr_hash_set(merge_b->paths_with_deleted_mergeinfo,
- apr_pstrdup(merge_b->pool, local_abspath),
- APR_HASH_KEY_STRING, local_abspath);
- }
+ if (!has_pristine_mergeinfo && prop->value)
+ {
+ /* If BATON->PATHS_WITH_NEW_MERGEINFO needs to be
+ allocated do so in BATON->POOL so it has a
+ sufficient lifetime. */
+ if (!merge_b->paths_with_new_mergeinfo)
+ merge_b->paths_with_new_mergeinfo =
+ apr_hash_make(merge_b->pool);
+
+ apr_hash_set(merge_b->paths_with_new_mergeinfo,
+ apr_pstrdup(merge_b->pool, local_abspath),
+ APR_HASH_KEY_STRING, local_abspath);
+ }
+ else if (has_pristine_mergeinfo && !prop->value)
+ {
+ /* If BATON->PATHS_WITH_DELETED_MERGEINFO needs to be
+ allocated do so in BATON->POOL so it has a
+ sufficient lifetime. */
+ if (!merge_b->paths_with_deleted_mergeinfo)
+ merge_b->paths_with_deleted_mergeinfo =
+ apr_hash_make(merge_b->pool);
+
+ apr_hash_set(merge_b->paths_with_deleted_mergeinfo,
+ apr_pstrdup(merge_b->pool, local_abspath),
+ APR_HASH_KEY_STRING, local_abspath);
}
}
}
-
- if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
- || err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS))
- {
- /* If the entry doesn't exist in the wc, this is a tree-conflict. */
- if (state)
- *state = svn_wc_notify_state_missing;
- if (tree_conflicted)
- *tree_conflicted = TRUE;
- svn_error_clear(err);
- return SVN_NO_ERROR;
- }
- else if (err)
- return svn_error_trace(err);
}
- else if (state)
- *state = svn_wc_notify_state_unchanged;
return SVN_NO_ERROR;
}
@@ -1278,12 +1276,15 @@ merge_dir_props_changed(svn_wc_notify_st
apr_pool_t *scratch_pool)
{
merge_cmd_baton_t *merge_b = diff_baton;
+ const apr_array_header_t *props;
const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
local_relpath, scratch_pool);
svn_wc_notify_state_t obstr_state;
+ svn_boolean_t is_deleted;
+ svn_node_kind_t kind;
- SVN_ERR(perform_obstruction_check(&obstr_state, NULL, NULL,
- NULL,
+ SVN_ERR(perform_obstruction_check(&obstr_state, NULL, &is_deleted,
+ &kind,
merge_b, local_abspath, svn_node_dir,
scratch_pool));
@@ -1294,6 +1295,26 @@ merge_dir_props_changed(svn_wc_notify_st
return SVN_NO_ERROR;
}
+ if (kind != svn_node_dir || is_deleted)
+ {
+ svn_wc_conflict_reason_t reason;
+
+ if (is_deleted)
+ reason = svn_wc_conflict_reason_deleted;
+ else
+ reason = svn_wc_conflict_reason_missing;
+
+ SVN_ERR(tree_conflict(merge_b, local_abspath, svn_node_file,
+ svn_wc_conflict_action_edit, reason));
+
+ if (tree_conflicted)
+ *tree_conflicted = TRUE;
+ if (state)
+ *state = svn_wc_notify_state_missing;
+
+ return SVN_NO_ERROR;
+ }
+
if (dir_was_added
&& merge_b->dry_run
&& dry_run_added_p(merge_b, local_abspath))
@@ -1301,13 +1322,26 @@ merge_dir_props_changed(svn_wc_notify_st
return SVN_NO_ERROR; /* We can't do a real prop merge for added dirs */
}
- return svn_error_trace(merge_props_changed(state,
- tree_conflicted,
- local_abspath,
- propchanges,
- original_props,
- diff_baton,
- scratch_pool));
+ SVN_ERR(prepare_merge_props_changed(&props, local_abspath, propchanges,
+ merge_b, scratch_pool, scratch_pool));
+
+ /* We only want to merge "regular" version properties: by
+ definition, 'svn merge' shouldn't touch any pristine data */
+ if (props->nelts)
+ {
+ svn_client_ctx_t *ctx = merge_b->ctx;
+
+ SVN_ERR(svn_wc_merge_props3(state, ctx->wc_ctx, local_abspath,
+ NULL, NULL, original_props, props,
+ merge_b->dry_run,
+ ctx->conflict_func2, ctx->conflict_baton2,
+ ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool));
+ }
+ else if (state)
+ *state = svn_wc_notify_state_unchanged;
+
+ return SVN_NO_ERROR;
}
/* Contains any state collected while resolving conflicts. */
@@ -1461,12 +1495,15 @@ merge_file_changed(svn_wc_notify_state_t
apr_pool_t *scratch_pool)
{
merge_cmd_baton_t *merge_b = baton;
- const char *mine_abspath = svn_dirent_join(merge_b->target->abspath,
- mine_relpath, scratch_pool);
+ svn_client_ctx_t *ctx = merge_b->ctx;
+ const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
+ mine_relpath, scratch_pool);
svn_node_kind_t wc_kind;
svn_boolean_t is_deleted;
+ const svn_wc_conflict_version_t *left;
+ const svn_wc_conflict_version_t *right;
- SVN_ERR_ASSERT(mine_abspath && svn_dirent_is_absolute(mine_abspath));
+ SVN_ERR_ASSERT(local_abspath && svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(!older_abspath || svn_dirent_is_absolute(older_abspath));
SVN_ERR_ASSERT(!yours_abspath || svn_dirent_is_absolute(yours_abspath));
@@ -1479,7 +1516,7 @@ merge_file_changed(svn_wc_notify_state_t
SVN_ERR(perform_obstruction_check(&obstr_state, NULL,
&is_deleted, &wc_kind,
- merge_b, mine_abspath, svn_node_unknown,
+ merge_b, local_abspath, svn_node_unknown,
scratch_pool));
if (obstr_state != svn_wc_notify_state_inapplicable)
{
@@ -1497,7 +1534,7 @@ merge_file_changed(svn_wc_notify_state_t
/* Other easy outs: if the merge target isn't under version
control, or is just missing from disk, fogettaboutit. There's no
- way svn_wc_merge4() can do the merge. */
+ way svn_wc_merge5() can do the merge. */
if (wc_kind != svn_node_file || is_deleted)
{
const char *moved_to_abspath;
@@ -1513,8 +1550,8 @@ merge_file_changed(svn_wc_notify_state_t
* a conflict. Non-inheritable mergeinfo will be recorded, allowing
* future merges into non-shallow working copies to merge changes
* we missed this time around. */
- SVN_ERR(svn_wc__node_get_depth(&parent_depth, merge_b->ctx->wc_ctx,
- svn_dirent_dirname(mine_abspath,
+ SVN_ERR(svn_wc__node_get_depth(&parent_depth, ctx->wc_ctx,
+ svn_dirent_dirname(local_abspath,
scratch_pool),
scratch_pool));
if (parent_depth < svn_depth_files
@@ -1532,12 +1569,15 @@ merge_file_changed(svn_wc_notify_state_t
* #2282. See also notes/tree-conflicts/detection.txt
*/
err = svn_wc__node_was_moved_away(&moved_to_abspath, NULL,
- merge_b->ctx->wc_ctx, mine_abspath,
+ ctx->wc_ctx, local_abspath,
scratch_pool, scratch_pool);
if (err)
{
if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- svn_error_clear(err);
+ {
+ svn_error_clear(err);
+ moved_to_abspath = NULL;
+ }
else
return svn_error_trace(err);
}
@@ -1546,7 +1586,7 @@ merge_file_changed(svn_wc_notify_state_t
{
/* File has been moved away locally -- apply incoming
* changes at the new location. */
- mine_abspath = moved_to_abspath;
+ local_abspath = moved_to_abspath;
}
else
{
@@ -1556,7 +1596,7 @@ merge_file_changed(svn_wc_notify_state_t
reason = svn_wc_conflict_reason_deleted;
else
reason = svn_wc_conflict_reason_missing;
- SVN_ERR(tree_conflict(merge_b, mine_abspath, svn_node_file,
+ SVN_ERR(tree_conflict(merge_b, local_abspath, svn_node_file,
svn_wc_conflict_action_edit, reason));
if (tree_conflicted)
*tree_conflicted = TRUE;
@@ -1582,31 +1622,37 @@ merge_file_changed(svn_wc_notify_state_t
*/
/* This callback is essentially no more than a wrapper around
- svn_wc_merge4(). Thank goodness that all the
+ svn_wc_merge5(). Thank goodness that all the
diff-editor-mechanisms are doing the hard work of getting the
fulltexts! */
- /* Do property merge before text merge so that keyword expansion takes
- into account the new property values. */
+ if (prop_state)
+ *prop_state = svn_wc_notify_state_unchanged;
+
if (prop_changes->nelts > 0)
{
- svn_boolean_t tree_conflicted2 = FALSE;
-
- SVN_ERR(merge_props_changed(prop_state, &tree_conflicted2,
- mine_abspath, prop_changes, original_props,
- baton, scratch_pool));
+ /* Filter entry-props and unneeded properties in case of a record only
+ merge */
+ SVN_ERR(prepare_merge_props_changed(&prop_changes, local_abspath,
+ prop_changes, merge_b,
+ scratch_pool, scratch_pool));
+ }
- /* If the prop change caused a tree-conflict, just bail. */
- if (tree_conflicted2)
- {
- if (tree_conflicted != NULL)
- *tree_conflicted = TRUE;
+ SVN_ERR(make_conflict_versions(&left, &right, local_abspath,
+ svn_node_file, &merge_b->merge_source, merge_b->target, merge_b->pool));
- return SVN_NO_ERROR;
- }
+ /* Do property merge now, if we are not going to perform a text merge */
+ if ((merge_b->record_only || !older_abspath) && prop_changes->nelts)
+ {
+ SVN_ERR(svn_wc_merge_props3(prop_state, ctx->wc_ctx, local_abspath,
+ left, right,
+ original_props, prop_changes,
+ merge_b->dry_run,
+ ctx->conflict_func2,
+ ctx->conflict_baton2,
+ ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool));
}
- else if (prop_state)
- *prop_state = svn_wc_notify_state_unchanged;
/* Easy out: We are only applying mergeinfo differences. */
if (merge_b->record_only)
@@ -1619,7 +1665,7 @@ merge_file_changed(svn_wc_notify_state_t
if (older_abspath)
{
svn_boolean_t has_local_mods;
- enum svn_wc_merge_outcome_t merge_outcome;
+ enum svn_wc_merge_outcome_t content_outcome;
/* xgettext: the '.working', '.merge-left.r%ld' and
'.merge-right.r%ld' strings are used to tag onto a file
@@ -1632,40 +1678,39 @@ merge_file_changed(svn_wc_notify_state_t
_(".merge-right.r%ld"),
yours_rev);
conflict_resolver_baton_t conflict_baton = { 0 };
- const svn_wc_conflict_version_t *left;
- const svn_wc_conflict_version_t *right;
- SVN_ERR(svn_wc_text_modified_p2(&has_local_mods, merge_b->ctx->wc_ctx,
- mine_abspath, FALSE, scratch_pool));
+ SVN_ERR(svn_wc_text_modified_p2(&has_local_mods, ctx->wc_ctx,
+ local_abspath, FALSE, scratch_pool));
- conflict_baton.wrapped_func = merge_b->ctx->conflict_func2;
- conflict_baton.wrapped_baton = merge_b->ctx->conflict_baton2;
+ conflict_baton.wrapped_func = ctx->conflict_func2;
+ conflict_baton.wrapped_baton = ctx->conflict_baton2;
conflict_baton.conflicted_paths = &merge_b->conflicted_paths;
conflict_baton.pool = merge_b->pool;
- SVN_ERR(make_conflict_versions(&left, &right, mine_abspath,
- svn_node_file, merge_b));
- SVN_ERR(svn_wc_merge4(&merge_outcome, merge_b->ctx->wc_ctx,
- older_abspath, yours_abspath, mine_abspath,
+ /* Do property merge and text merge in one step so that keyword expansion
+ takes into account the new property values. */
+ SVN_ERR(svn_wc_merge5(&content_outcome, prop_state, ctx->wc_ctx,
+ older_abspath, yours_abspath, local_abspath,
left_label, right_label, target_label,
left, right,
merge_b->dry_run, merge_b->diff3_cmd,
- merge_b->merge_options, prop_changes,
+ merge_b->merge_options,
+ original_props, prop_changes,
conflict_resolver, &conflict_baton,
- merge_b->ctx->cancel_func,
- merge_b->ctx->cancel_baton,
+ ctx->cancel_func,
+ ctx->cancel_baton,
scratch_pool));
if (content_state)
{
- if (merge_outcome == svn_wc_merge_conflict)
+ if (content_outcome == svn_wc_merge_conflict)
*content_state = svn_wc_notify_state_conflicted;
else if (has_local_mods
- && merge_outcome != svn_wc_merge_unchanged)
+ && content_outcome != svn_wc_merge_unchanged)
*content_state = svn_wc_notify_state_merged;
- else if (merge_outcome == svn_wc_merge_merged)
+ else if (content_outcome == svn_wc_merge_merged)
*content_state = svn_wc_notify_state_changed;
- else if (merge_outcome == svn_wc_merge_no_merge)
+ else if (content_outcome == svn_wc_merge_no_merge)
*content_state = svn_wc_notify_state_missing;
else /* merge_outcome == svn_wc_merge_unchanged */
*content_state = svn_wc_notify_state_unchanged;
@@ -1733,13 +1778,13 @@ merge_file_added(svn_wc_notify_state_t *
merge-from-foreign-repository scenario) or wrong place in the
right repository (in the same-repos scenario). So we'll
strip them. (Is this a layering violation?) */
- if (svn_property_kind(NULL, prop->name) == svn_prop_wc_kind)
+ if (svn_property_kind2(prop->name) == svn_prop_wc_kind)
continue;
/* And in the foreign repository merge case, we only want
regular properties. */
if ((! merge_b->same_repos)
- && (svn_property_kind(NULL, prop->name) != svn_prop_regular_kind))
+ && (svn_property_kind2(prop->name) != svn_prop_regular_kind))
continue;
/* Issue #3383: We don't want mergeinfo from a foreign repository. */
@@ -1799,11 +1844,11 @@ merge_file_added(svn_wc_notify_state_t *
mine_abspath);
SVN_ERR_ASSERT(child != NULL);
copyfrom_url = svn_path_url_add_component2(
- merge_b->merge_source.url2,
+ merge_b->merge_source.loc2->url,
child, scratch_pool);
copyfrom_rev = rev2;
- SVN_ERR(check_repos_match(merge_b, mine_abspath, copyfrom_url,
- scratch_pool));
+ SVN_ERR(check_repos_match(merge_b->target, mine_abspath,
+ copyfrom_url, scratch_pool));
new_base_props = file_props;
new_props = NULL; /* inherit from new_base_props */
SVN_ERR(svn_stream_open_readonly(&new_base_contents,
@@ -2194,11 +2239,11 @@ merge_dir_added(svn_wc_notify_state_t *s
add. */
if (merge_b->same_repos)
{
- copyfrom_url = svn_path_url_add_component2(merge_b->merge_source.url2,
+ copyfrom_url = svn_path_url_add_component2(merge_b->merge_source.loc2->url,
child, scratch_pool);
copyfrom_rev = rev;
- SVN_ERR(check_repos_match(merge_b, parent_abspath, copyfrom_url,
+ SVN_ERR(check_repos_match(merge_b->target, parent_abspath, copyfrom_url,
scratch_pool));
}
@@ -2665,10 +2710,8 @@ typedef struct notification_receiver_bat
MERGE_B->REINTEGRATE_MERGE are both false. */
apr_hash_t *skipped_abspaths;
- /* A list of the absolute root paths of any added subtrees which might
- require their own explicit mergeinfo. Is NULL if
- MERGE_B->SOURCES_ANCESTRAL and MERGE_B->REINTEGRATE_MERGE are both
- false. */
+ /* A hash of (const char *) absolute WC paths mapped to the same which
+ represent the roots of subtrees added by the merge. May be NULL. */
apr_hash_t *added_abspaths;
/* A list of tree conflict victim absolute paths which may be NULL. Is NULL
@@ -2741,20 +2784,21 @@ find_nearest_ancestor(const apr_array_he
static void
notify_merge_begin(const char *target_abspath,
const svn_merge_range_t *range,
- merge_cmd_baton_t *merge_b,
+ svn_boolean_t same_repos,
+ svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- if (merge_b->ctx->notify_func2)
+ if (ctx->notify_func2)
{
svn_wc_notify_t *n
= svn_wc_create_notify(target_abspath,
- merge_b->same_repos
+ same_repos
? svn_wc_notify_merge_begin
: svn_wc_notify_foreign_merge_begin,
pool);
n->merge_range = range ? svn_merge_range_dup(range, pool) : NULL;
- merge_b->ctx->notify_func2(merge_b->ctx->notify_baton2, n, pool);
+ ctx->notify_func2(ctx->notify_baton2, n, pool);
}
}
@@ -2804,6 +2848,67 @@ notify_merge_completed(const char *targe
}
}
+/* Helper for notification_receiver: Cache the roots of subtrees added under
+ TARGET_ABSPATH.
+
+ If *ADDED_ABSPATHS is not null, then it is a hash of (const char *)
+ absolute WC paths mapped to the same. If it is null, then allocate a
+ new hash in RESULT_POOL.
+
+ If ADDED_ABSPATH is a subtree of TARGET_ABSPATH, is not already found in
+ *ADDED_ABSPATHS, nor is a subtree of any path already found within the
+ hash, then add a copy of ADDED_ABSPATH to *ADDED_ABSPATHS.
+
+ All additions to *ADDED_ABSPATHS are allocated in RESULT_POOL.
+ SCRATCH_POOL is used for temporary allocations. */
+static void
+update_the_list_of_added_subtrees(const char *target_abspath,
+ const char *added_abspath,
+ apr_hash_t **added_abspaths,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_boolean_t root_of_added_subtree = TRUE;
+
+ /* Stash the root path of any added subtrees. */
+ if (*added_abspaths == NULL)
+ {
+ /* The first added path is always a root. */
+ *added_abspaths = apr_hash_make(result_pool);
+ }
+ else
+ {
+ apr_pool_t *subpool = svn_pool_create(scratch_pool);
+ const char *added_path_parent =
+ svn_dirent_dirname(added_abspath, subpool);
+
+ /* Is NOTIFY->PATH the root of an added subtree? */
+ while (strcmp(target_abspath, added_path_parent))
+ {
+ if (apr_hash_get(*added_abspaths,
+ added_path_parent,
+ APR_HASH_KEY_STRING))
+ {
+ root_of_added_subtree = FALSE;
+ break;
+ }
+
+ added_path_parent = svn_dirent_dirname(
+ added_path_parent, subpool);
+ }
+
+ svn_pool_destroy(subpool);
+ }
+
+ if (root_of_added_subtree)
+ {
+ const char *added_root_path = apr_pstrdup(result_pool,
+ added_abspath);
+ apr_hash_set(*added_abspaths, added_root_path,
+ APR_HASH_KEY_STRING, added_root_path);
+ }
+}
+
/* Is the notification the result of a real operative merge? */
#define IS_OPERATIVE_NOTIFICATION(notify) \
(notify->content_state == svn_wc_notify_state_conflicted \
@@ -2885,7 +2990,7 @@ notification_receiver(void *baton, const
}
/* Update the lists of merged, skipped, tree-conflicted and added paths. */
- if (notify_b->merge_b->sources_ancestral
+ if (notify_b->merge_b->merge_source.ancestral
|| notify_b->merge_b->reintegrate_merge)
{
if (notify->content_state == svn_wc_notify_state_merged
@@ -2932,37 +3037,27 @@ notification_receiver(void *baton, const
if (notify->action == svn_wc_notify_update_add)
{
- svn_boolean_t is_root_of_added_subtree = FALSE;
- const char *added_path = apr_pstrdup(notify_b->pool,
- notify_abspath);
- const char *added_path_parent = NULL;
+ update_the_list_of_added_subtrees(notify_b->merge_b->target->abspath,
+ notify_abspath,
+ &(notify_b->added_abspaths),
+ notify_b->pool, pool);
+ }
- /* Stash the root path of any added subtrees. */
- if (notify_b->added_abspaths == NULL)
- {
- notify_b->added_abspaths = apr_hash_make(notify_b->pool);
- is_root_of_added_subtree = TRUE;
- }
- else
- {
- added_path_parent = svn_dirent_dirname(added_path, pool);
- /* ### Bug. Testing whether its immediate parent is in the
- * hash isn't enough: this is letting every other level of
- * the added subtree hierarchy into the hash. */
- if (!apr_hash_get(notify_b->added_abspaths, added_path_parent,
- APR_HASH_KEY_STRING))
- is_root_of_added_subtree = TRUE;
- }
- if (is_root_of_added_subtree)
- apr_hash_set(notify_b->added_abspaths, added_path,
- APR_HASH_KEY_STRING, added_path);
+ if (notify->action == svn_wc_notify_update_delete
+ && notify_b->added_abspaths)
+ {
+ /* Issue #4166: If a previous merge added NOTIFY_ABSPATH, but we
+ are now deleting it, then remove it from the list of added
+ paths. */
+ apr_hash_set(notify_b->added_abspaths, notify_abspath,
+ APR_HASH_KEY_STRING, NULL);
}
}
/* Notify that a merge is beginning, if we haven't already done so.
* (A single-file merge is notified separately: see single_file_merge_notify().) */
/* If our merge sources are ancestors of one another... */
- if (notify_b->merge_b->sources_ancestral)
+ if (notify_b->merge_b->merge_source.ancestral)
{
/* See if this is an operative directory merge. */
if (!(notify_b->is_single_file_merge) && is_operative_notification)
@@ -2997,7 +3092,8 @@ notification_receiver(void *baton, const
notify_merge_begin(child->abspath,
APR_ARRAY_IDX(child->remaining_ranges, 0,
svn_merge_range_t *),
- notify_b->merge_b, pool);
+ notify_b->merge_b->same_repos,
+ notify_b->merge_b->ctx, pool);
}
}
}
@@ -3008,7 +3104,8 @@ notification_receiver(void *baton, const
&& is_operative_notification)
{
notify_merge_begin(notify_b->merge_b->target->abspath, NULL,
- notify_b->merge_b, pool);
+ notify_b->merge_b->same_repos,
+ notify_b->merge_b->ctx, pool);
}
if (notify_b->wrapped_func)
@@ -3334,9 +3431,9 @@ adjust_deleted_subtree_ranges(svn_client
/* Helper for do_directory_merge().
- SOURCE and MERGE_B are cascaded from the arguments of the same name in
- do_directory_merge(). RA_SESSION is the session for the younger of
- SOURCE->url1@rev1 and SOURCE->url2@rev2.
+ SOURCE is cascaded from the argument of the same name in
+ do_directory_merge(). TARGET is the merge target. RA_SESSION is the
+ session for the younger of SOURCE->url1@rev1 and SOURCE->url2@rev2.
Adjust the subtrees in CHILDREN_WITH_MERGEINFO so that we don't
later try to describe invalid paths in drive_merge_report_editor().
@@ -3348,15 +3445,16 @@ adjust_deleted_subtree_ranges(svn_client
*/
static svn_error_t *
fix_deleted_subtree_ranges(const merge_source_t *source,
+ const merge_target_t *target,
svn_ra_session_t *ra_session,
apr_array_header_t *children_with_mergeinfo,
- merge_cmd_baton_t *merge_b,
+ svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
int i;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- svn_boolean_t is_rollback = source->rev2 < source->rev1;
+ svn_boolean_t is_rollback = source->loc2->rev < source->loc1->rev;
/* CHILDREN_WITH_MERGEINFO is sorted in depth-first order, so
start at index 1 to examine only subtrees. */
@@ -3422,24 +3520,23 @@ fix_deleted_subtree_ranges(const merge_s
{
const char *child_primary_source_url;
const char *child_repos_src_path =
- svn_dirent_is_child(merge_b->target->abspath, child->abspath,
- iterpool);
+ svn_dirent_is_child(target->abspath, child->abspath, iterpool);
/* This loop is only processing subtrees, so CHILD->ABSPATH
better be a proper child of the merge target. */
SVN_ERR_ASSERT(child_repos_src_path);
child_primary_source_url =
- svn_path_url_add_component2((source->rev1 < source->rev2)
- ? source->url2 : source->url1,
+ svn_path_url_add_component2((source->loc1->rev < source->loc2->rev)
+ ? source->loc2->url : source->loc1->url,
child_repos_src_path, iterpool);
SVN_ERR(adjust_deleted_subtree_ranges(child, parent,
- source->rev1, source->rev2,
+ source->loc1->rev,
+ source->loc2->rev,
child_primary_source_url,
ra_session,
- merge_b->ctx, result_pool,
- iterpool));
+ ctx, result_pool, iterpool));
}
}
@@ -3508,9 +3605,7 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
if (implicit_mergeinfo)
{
- const char *repos_root;
- const char *repos_relpath;
- svn_revnum_t target_rev;
+ svn_client__pathrev_t *target;
/* Assert that we have sane input. */
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(start) && SVN_IS_VALID_REVNUM(end)
@@ -3518,21 +3613,16 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
/* Retrieve the origin (original_*) of the node, or just the
url if the node was not copied. */
- SVN_ERR(svn_wc__node_get_origin(FALSE, &target_rev, &repos_relpath,
- &repos_root, NULL, NULL,
- ctx->wc_ctx, target_abspath, FALSE,
- scratch_pool, scratch_pool));
-
- if (! repos_relpath)
- {
- /* We've been asked to operate on a target which has no location
- * in the repository. Either it's unversioned (but attempts to
- * merge into unversioned targets should not get as far as here),
- * or it is locally added, in which case the target's implicit
- * mergeinfo is empty. */
+ SVN_ERR(svn_client__wc_node_get_origin(&target, target_abspath, ctx,
+ scratch_pool, scratch_pool));
+
+ if (! target)
+ {
+ /* We've been asked to operate on a locally added target, so its
+ * implicit mergeinfo is empty. */
*implicit_mergeinfo = apr_hash_make(result_pool);
}
- else if (target_rev <= end)
+ else if (target->rev <= end)
{
/* We're asking about a range outside our natural history
altogether. That means our implicit mergeinfo is empty. */
@@ -3540,11 +3630,6 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
}
else
{
- const char *url;
-
- url = svn_path_url_add_component2(repos_root, repos_relpath,
- scratch_pool);
-
/* Fetch so-called "implicit mergeinfo" (that is, natural
history). */
@@ -3552,14 +3637,13 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
TARGET_ABSPATH might not even exist, and even if it does the
working copy is *at* TARGET_REV so its implicit history ends
at TARGET_REV! */
- if (target_rev < start)
- start = target_rev;
+ if (target->rev < start)
+ start = target->rev;
/* Fetch the implicit mergeinfo. */
SVN_ERR(svn_client__get_history_as_mergeinfo(implicit_mergeinfo,
NULL,
- url, target_rev,
- start, end,
+ target, start, end,
ra_session, ctx,
result_pool));
}
@@ -3712,10 +3796,13 @@ ensure_implicit_mergeinfo(svn_client__me
REVISION1 and REVISION2 describe the merge range requested from
MERGEINFO_PATH.
- TARGET_MERGEINFO is the CHILD->ABSPATH's explicit or inherited mergeinfo.
- TARGET_MERGEINFO should be NULL if there is no explicit or inherited
- mergeinfo on CHILD->ABSPATH or an empty hash if CHILD->ABSPATH has empty
- mergeinfo.
+ TARGET_RANGELIST is the portion of CHILD->ABSPATH's explicit or inherited
+ mergeinfo that intersects with the merge history described by
+ MERGEINFO_PATH@REVISION1:MERGEINFO_PATH@REVISION2. TARGET_RANGELIST
+ should be NULL if there is no explicit or inherited mergeinfo on
+ CHILD->ABSPATH or an empty list if CHILD->ABSPATH has empty mergeinfo or
+ explicit mergeinfo that exclusively describes non-intersecting history
+ with MERGEINFO_PATH@REVISION1:MERGEINFO_PATH@REVISION2.
SCRATCH_POOL is used for all temporary allocations.
@@ -3728,7 +3815,7 @@ static svn_error_t *
filter_merged_revisions(svn_client__merge_path_t *parent,
svn_client__merge_path_t *child,
const char *mergeinfo_path,
- svn_mergeinfo_t target_mergeinfo,
+ apr_array_header_t *target_rangelist,
svn_revnum_t revision1,
svn_revnum_t revision2,
svn_boolean_t child_inherits_implicit,
@@ -3737,7 +3824,7 @@ filter_merged_revisions(svn_client__merg
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- apr_array_header_t *requested_rangelist, *target_rangelist,
+ apr_array_header_t *requested_rangelist,
*target_implicit_rangelist, *explicit_rangelist;
/* Convert REVISION1 and REVISION2 to a rangelist.
@@ -3762,12 +3849,8 @@ filter_merged_revisions(svn_client__merg
our svn_rangelist_* APIs to work properly. */
SVN_ERR(svn_rangelist_reverse(requested_rangelist, scratch_pool));
- if (target_mergeinfo)
- target_rangelist = apr_hash_get(target_mergeinfo,
- mergeinfo_path, APR_HASH_KEY_STRING);
- else
- target_rangelist = NULL;
-
+ /* Set EXPLICIT_RANGELIST to the list of source-range revs that are
+ already recorded as merged to target. */
if (target_rangelist)
{
/* Return the intersection of the revs which are both already
@@ -3851,16 +3934,12 @@ filter_merged_revisions(svn_client__merg
}
else /* This is a forward merge */
{
- if (target_mergeinfo)
- target_rangelist = apr_hash_get(target_mergeinfo, mergeinfo_path,
- APR_HASH_KEY_STRING);
- else
- target_rangelist = NULL;
-
- /* See earlier comment preceding svn_rangelist_intersect() for
- why we don't consider inheritance here. */
+ /* Set EXPLICIT_RANGELIST to the list of source-range revs that are
+ NOT already recorded as merged to target. */
if (target_rangelist)
{
+ /* See earlier comment preceding svn_rangelist_intersect() for
+ why we don't consider inheritance here. */
SVN_ERR(svn_rangelist_remove(&explicit_rangelist,
target_rangelist,
requested_rangelist, FALSE,
@@ -3992,48 +4071,50 @@ calculate_remaining_ranges(svn_client__m
apr_pool_t *scratch_pool)
{
const char *mergeinfo_path;
- const char *primary_url = (source->rev1 < source->rev2)
- ? source->url2 : source->url1;
- svn_mergeinfo_t adjusted_target_mergeinfo = NULL;
+ const char *primary_url = (source->loc1->rev < source->loc2->rev)
+ ? source->loc2->url : source->loc1->url;
+ /* Intersection of TARGET_MERGEINFO and the merge history
+ described by SOURCE. */
+ apr_array_header_t *target_rangelist;
svn_revnum_t child_base_revision;
+ /* Since this function should only be called when honoring mergeinfo and
+ * SOURCE adheres to the requirements noted in 'MERGEINFO MERGE SOURCE
+ * NORMALIZATION', SOURCE must be 'ancestral'. */
+ SVN_ERR_ASSERT(source->ancestral);
+
/* Determine which of the requested ranges to consider merging... */
SVN_ERR(svn_ra__get_fspath_relative_to_root(ra_session, &mergeinfo_path,
primary_url, result_pool));
- /* Consider: CHILD might have explicit mergeinfo '/MERGEINFO_PATH:M-N'
- where M-N fall into the gap in SOURCE's natural
- history allowed by 'MERGEINFO MERGE SOURCE NORMALIZATION'. If this is
- the case, then '/MERGEINFO_PATH:N' actually refers to a completely
- different line of history than SOURCE and we
- *don't* want to consider those revisions merged already. */
- if (implicit_src_gap && child->pre_merge_mergeinfo)
- {
- apr_array_header_t *explicit_mergeinfo_gap_ranges =
- apr_hash_get(child->pre_merge_mergeinfo, mergeinfo_path,
- APR_HASH_KEY_STRING);
-
- if (explicit_mergeinfo_gap_ranges)
- {
- svn_mergeinfo_t gap_mergeinfo = apr_hash_make(scratch_pool);
-
- apr_hash_set(gap_mergeinfo, mergeinfo_path, APR_HASH_KEY_STRING,
- implicit_src_gap);
- SVN_ERR(svn_mergeinfo_remove2(&adjusted_target_mergeinfo,
- gap_mergeinfo, target_mergeinfo,
- FALSE, result_pool, scratch_pool));
- }
- }
+ /* Set TARGET_RANGELIST to the portion of TARGET_MERGEINFO that refers
+ to SOURCE (excluding any gap in SOURCE): first get all ranges from
+ TARGET_MERGEINFO that refer to the path of SOURCE, and then prune
+ any ranges that lie in the gap in SOURCE.
+
+ ### [JAF] In fact, that may still leave some ranges that lie entirely
+ outside the range of SOURCE; it seems we don't care about that. */
+ if (target_mergeinfo)
+ target_rangelist = apr_hash_get(target_mergeinfo, mergeinfo_path,
+ APR_HASH_KEY_STRING);
else
+ target_rangelist = NULL;
+ if (implicit_src_gap && target_rangelist)
{
- adjusted_target_mergeinfo = target_mergeinfo;
+ /* Remove any mergeinfo referring to the 'gap' in SOURCE, as that
+ mergeinfo doesn't really refer to SOURCE at all but instead
+ refers to locations that are non-existent or on a different
+ line of history. (Issue #3242.) */
+ SVN_ERR(svn_rangelist_remove(&target_rangelist,
+ implicit_src_gap, target_rangelist,
+ FALSE, result_pool));
}
/* Initialize CHILD->REMAINING_RANGES and filter out revisions already
merged (or, in the case of reverse merges, ranges not yet merged). */
SVN_ERR(filter_merged_revisions(parent, child, mergeinfo_path,
- adjusted_target_mergeinfo,
- source->rev1, source->rev2,
+ target_rangelist,
+ source->loc1->rev, source->loc2->rev,
child_inherits_implicit,
ra_session, ctx, result_pool,
scratch_pool));
@@ -4064,22 +4145,24 @@ calculate_remaining_ranges(svn_client__m
So in the name of user friendliness, return an error suggesting a helpful
course of action.
*/
- SVN_ERR(svn_wc__node_get_base_rev(&child_base_revision, ctx->wc_ctx,
- child->abspath, scratch_pool));
+ SVN_ERR(svn_wc__node_get_base(&child_base_revision, NULL, NULL, NULL,
+ ctx->wc_ctx, child->abspath,
+ scratch_pool, scratch_pool));
/* If CHILD has no base revision then it hasn't been committed yet, so it
can't have any "future" history. */
if (SVN_IS_VALID_REVNUM(child_base_revision)
&& ((child->remaining_ranges)->nelts == 0) /* Inoperative merge */
- && (source->rev2 < source->rev1) /* Reverse merge */
- && (child_base_revision <= source->rev2)) /* From CHILD's future */
+ && (source->loc2->rev < source->loc1->rev) /* Reverse merge */
+ && (child_base_revision <= source->loc2->rev)) /* From CHILD's future */
{
/* Hmmm, an inoperative reverse merge from the "future". If it is
from our own future return a helpful error. */
svn_error_t *err;
- const char *start_url;
+ svn_client__pathrev_t *start_loc;
- err = svn_client__repos_location(&start_url,
- ra_session, source->url1, source->rev1,
+ err = svn_client__repos_location(&start_loc,
+ ra_session,
+ source->loc1,
child_base_revision,
ctx, scratch_pool, scratch_pool);
if (err)
@@ -4096,7 +4179,7 @@ calculate_remaining_ranges(svn_client__m
SVN_ERR(svn_wc__node_get_url(&url, ctx->wc_ctx, child->abspath,
scratch_pool, scratch_pool));
- if (strcmp(start_url, url) == 0)
+ if (strcmp(start_loc->url, url) == 0)
return svn_error_create(SVN_ERR_CLIENT_MERGE_UPDATE_REQUIRED, NULL,
_("Cannot reverse-merge a range from a "
"path's own future history; try "
@@ -4109,7 +4192,7 @@ calculate_remaining_ranges(svn_client__m
/* Helper for populate_remaining_ranges().
- SOURCE and MERGE_B are cascaded from the arguments of the same name in
+ SOURCE is cascaded from the arguments of the same name in
populate_remaining_ranges().
Note: The following comments assume a forward merge, i.e. SOURCE->rev1
@@ -4138,14 +4221,13 @@ find_gaps_in_merge_source_history(svn_re
svn_revnum_t *gap_end,
const merge_source_t *source,
svn_ra_session_t *ra_session,
- merge_cmd_baton_t *merge_b,
+ svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
svn_mergeinfo_t implicit_src_mergeinfo;
- svn_revnum_t young_rev = MAX(source->rev1, source->rev2);
- svn_revnum_t old_rev = MIN(source->rev1, source->rev2);
- const char *primary_url = (source->rev1 < source->rev2)
- ? source->url2 : source->url1;
+ svn_revnum_t old_rev = MIN(source->loc1->rev, source->loc2->rev);
+ const svn_client__pathrev_t *primary_src
+ = (source->loc1->rev < source->loc2->rev) ? source->loc2 : source->loc1;
const char *merge_src_fspath;
apr_array_header_t *rangelist;
@@ -4154,12 +4236,13 @@ find_gaps_in_merge_source_history(svn_re
/* Get SOURCE as mergeinfo. */
SVN_ERR(svn_client__get_history_as_mergeinfo(&implicit_src_mergeinfo, NULL,
- primary_url, young_rev,
- young_rev, old_rev, ra_session,
- merge_b->ctx, scratch_pool));
+ primary_src,
+ primary_src->rev, old_rev,
+ ra_session,
+ ctx, scratch_pool));
SVN_ERR(svn_ra__get_fspath_relative_to_root(
- ra_session, &merge_src_fspath, primary_url, scratch_pool));
+ ra_session, &merge_src_fspath, primary_src->url, scratch_pool));
rangelist = apr_hash_get(implicit_src_mergeinfo,
merge_src_fspath,
APR_HASH_KEY_STRING);
@@ -4194,7 +4277,7 @@ find_gaps_in_merge_source_history(svn_re
/* As mentioned above, multiple gaps *shouldn't* be possible. */
SVN_ERR_ASSERT(apr_hash_count(implicit_src_mergeinfo) == 1);
- *gap_start = MIN(source->rev1, source->rev2);
+ *gap_start = MIN(source->loc1->rev, source->loc2->rev);
*gap_end = (APR_ARRAY_IDX(rangelist,
rangelist->nelts - 1,
svn_merge_range_t *))->start;
@@ -4202,8 +4285,8 @@ find_gaps_in_merge_source_history(svn_re
else if (apr_hash_count(implicit_src_mergeinfo) > 1) /* Rename */
{
apr_array_header_t *requested_rangelist =
- svn_rangelist__initialize(MIN(source->rev1, source->rev2),
- MAX(source->rev1, source->rev2),
+ svn_rangelist__initialize(MIN(source->loc1->rev, source->loc2->rev),
+ MAX(source->loc1->rev, source->loc2->rev),
TRUE, scratch_pool);
apr_array_header_t *implicit_rangelist =
apr_array_make(scratch_pool, 2, sizeof(svn_merge_range_t *));
@@ -4292,8 +4375,10 @@ populate_remaining_ranges(apr_array_head
NULL, /* child->inherited_mergeinfo */
svn_mergeinfo_inherited, ra_session,
child->abspath,
- MAX(source->rev1, source->rev2),
- MIN(source->rev1, source->rev2),
+ MAX(source->loc1->rev,
+ source->loc2->rev),
+ MIN(source->loc1->rev,
+ source->loc2->rev),
merge_b->ctx, result_pool,
iterpool));
}
@@ -4314,13 +4399,14 @@ populate_remaining_ranges(apr_array_head
child_inherits_implicit = (parent && !child->switched);
SVN_ERR(ensure_implicit_mergeinfo(parent, child,
child_inherits_implicit,
- source->rev1, source->rev2,
+ source->loc1->rev,
+ source->loc2->rev,
ra_session, merge_b->ctx,
result_pool, iterpool));
}
- child->remaining_ranges = svn_rangelist__initialize(source->rev1,
- source->rev2,
+ child->remaining_ranges = svn_rangelist__initialize(source->loc1->rev,
+ source->loc2->rev,
TRUE,
result_pool);
}
@@ -4342,7 +4428,7 @@ populate_remaining_ranges(apr_array_head
non-existent paths to the editor. */
SVN_ERR(find_gaps_in_merge_source_history(&gap_start, &gap_end,
source,
- ra_session, merge_b,
+ ra_session, merge_b->ctx,
iterpool));
/* Stash any gap in the merge command baton, we'll need it later when
@@ -4353,10 +4439,11 @@ populate_remaining_ranges(apr_array_head
for (i = 0; i < children_with_mergeinfo->nelts; i++)
{
- const char *child_repos_path;
- merge_source_t child_source = *source;
svn_client__merge_path_t *child =
APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *);
+ const char *child_repos_path
+ = svn_dirent_skip_ancestor(merge_b->target->abspath, child->abspath);
+ merge_source_t child_source;
svn_client__merge_path_t *parent = NULL;
svn_boolean_t child_inherits_implicit;
@@ -4367,15 +4454,20 @@ populate_remaining_ranges(apr_array_head
if (child->absent)
continue;
- svn_pool_clear(iterpool);
-
- child_repos_path = svn_dirent_skip_ancestor(merge_b->target->abspath,
- child->abspath);
SVN_ERR_ASSERT(child_repos_path != NULL);
- child_source.url1 = svn_path_url_add_component2(source->url1, child_repos_path,
- iterpool);
- child_source.url2 = svn_path_url_add_component2(source->url2, child_repos_path,
- iterpool);
+ child_source.loc1 = svn_client__pathrev_join_relpath(
+ source->loc1, child_repos_path, iterpool);
+ child_source.loc2 = svn_client__pathrev_join_relpath(
+ source->loc2, child_repos_path, iterpool);
+ /* ### Is the child 'ancestral' over the same revision range? It's
+ * not necessarily true that a child is 'ancestral' if the parent is,
+ * nor that it's not if the parent is not. However, here we claim
+ * that it is. Before we had this 'ancestral' field that we need to
+ * set explicitly, the claim was implicit. Either way, the impact is
+ * that we might pass calculate_remaining_ranges() a source that is
+ * not in fact 'ancestral' (despite its 'ancestral' field being true),
+ * contrary to its doc-string. */
+ child_source.ancestral = source->ancestral;
/* Get the explicit/inherited mergeinfo for CHILD. If CHILD is the
merge target then also get its implicit mergeinfo. Otherwise defer
@@ -4388,8 +4480,8 @@ populate_remaining_ranges(apr_array_head
&(child->inherited_mergeinfo),
svn_mergeinfo_inherited, ra_session,
child->abspath,
- MAX(source->rev1, source->rev2),
- MIN(source->rev1, source->rev2),
+ MAX(source->loc1->rev, source->loc2->rev),
+ MIN(source->loc1->rev, source->loc2->rev),
merge_b->ctx, result_pool, iterpool));
/* If CHILD isn't the merge target find its parent. */
@@ -4440,7 +4532,7 @@ populate_remaining_ranges(apr_array_head
/* If this is a reverse merge reorder CHILD->REMAINING_RANGES
so it will work with the svn_rangelist_* APIs below. */
- if (source->rev1 > source->rev2)
+ if (source->loc1->rev > source->loc2->rev)
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges, iterpool));
for (j = 0; j < child->remaining_ranges->nelts; j++)
@@ -4482,7 +4574,7 @@ populate_remaining_ranges(apr_array_head
result_pool));
}
- if (source->rev1 > source->rev2) /* Reverse merge */
+ if (source->loc1->rev > source->loc2->rev) /* Reverse merge */
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges, iterpool));
}
}
@@ -4655,7 +4747,7 @@ update_wc_mergeinfo(svn_mergeinfo_catalo
IS_ROLLBACK is true if the caller is recording a reverse merge and false
otherwise. RANGELIST is the set of revisions being merged from
- MERGEINFO_PATH to MERGE_B->TARGET_ABSPATH. */
+ MERGEINFO_PATH to MERGE_B->target. */
static svn_error_t *
record_skips(const char *mergeinfo_path,
const apr_array_header_t *rangelist,
@@ -4774,7 +4866,7 @@ remove_absent_children(const char *targe
false then for each path (if any) in MERGE_B->PATHS_WITH_DELETED_MERGEINFO
remove that path from CHILDREN_WITH_MERGEINFO by setting that
child to NULL. The one exception is for the merge target itself,
- MERGE_B->TARGET_ABSPATH, this must always be present in
+ MERGE_B->target->abspath, this must always be present in
CHILDREN_WITH_MERGEINFO so this is never removed by this
function. */
static void
@@ -4862,7 +4954,7 @@ remove_children_with_deleted_mergeinfo(m
URL in the repository of SOURCE; they may be temporarily reparented within
this function.
- If MERGE_B->sources_ancestral is set, then SOURCE->url1@rev1 must be a
+ If SOURCE->ancestral is set, then SOURCE->url1@rev1 must be a
historical ancestor of SOURCE->url2@rev2, or vice-versa (see
`MERGEINFO MERGE SOURCE NORMALIZATION' for more requirements around
SOURCE in this case).
@@ -4883,11 +4975,11 @@ drive_merge_report_editor(const char *ta
svn_revnum_t target_start;
svn_boolean_t honor_mergeinfo = HONOR_MERGEINFO(merge_b);
const char *old_sess1_url, *old_sess2_url;
- svn_boolean_t is_rollback = source->rev1 > source->rev2;
+ svn_boolean_t is_rollback = source->loc1->rev > source->loc2->rev;
/* Start with a safe default starting revision for the editor and the
merge target. */
- target_start = source->rev1;
+ target_start = source->loc1->rev;
/* If we are honoring mergeinfo the starting revision for the merge target
might not be SOURCE->rev1, in fact the merge target might not need *any*
@@ -4913,7 +5005,7 @@ drive_merge_report_editor(const char *ta
if (child->remaining_ranges->nelts == 0)
{
/* The merge target doesn't need anything merged. */
- target_start = source->rev2;
+ target_start = source->loc2->rev;
}
else
{
@@ -4924,11 +5016,11 @@ drive_merge_report_editor(const char *ta
svn_merge_range_t *range =
APR_ARRAY_IDX(child->remaining_ranges, 0,
svn_merge_range_t *);
- if ((!is_rollback && range->start > source->rev2)
- || (is_rollback && range->start < source->rev2))
+ if ((!is_rollback && range->start > source->loc2->rev)
+ || (is_rollback && range->start < source->loc2->rev))
{
/* Merge target's first remaining range doesn't intersect. */
- target_start = source->rev2;
+ target_start = source->loc2->rev;
}
else
{
@@ -4941,18 +5033,18 @@ drive_merge_report_editor(const char *ta
SVN_ERR(svn_client__ensure_ra_session_url(&old_sess1_url,
merge_b->ra_session1,
- source->url1, scratch_pool));
+ source->loc1->url, scratch_pool));
/* Temporarily point our second RA session to SOURCE->url1, too. We use
this to request individual file contents. */
SVN_ERR(svn_client__ensure_ra_session_url(&old_sess2_url,
merge_b->ra_session2,
- source->url1, scratch_pool));
+ source->loc1->url, scratch_pool));
/* Get the diff editor and a reporter with which to, ultimately,
drive it. */
SVN_ERR(svn_client__get_diff_editor(&diff_editor, &diff_edit_baton,
depth,
- merge_b->ra_session2, source->rev1,
+ merge_b->ra_session2, source->loc1->rev,
FALSE /* walk_deleted_dirs */,
TRUE /* text_deltas */,
&merge_callbacks, merge_b,
@@ -4961,10 +5053,10 @@ drive_merge_report_editor(const char *ta
notification_receiver, notify_b,
scratch_pool));
SVN_ERR(svn_ra_do_diff3(merge_b->ra_session1,
- &reporter, &report_baton, source->rev2,
+ &reporter, &report_baton, source->loc2->rev,
"", depth, merge_b->ignore_ancestry,
TRUE, /* text_deltas */
- source->url2, diff_editor, diff_edit_baton,
+ source->loc2->url, diff_editor, diff_edit_baton,
scratch_pool));
/* Drive the reporter. */
@@ -5009,8 +5101,8 @@ drive_merge_report_editor(const char *ta
{
range = APR_ARRAY_IDX(child->remaining_ranges, 0,
svn_merge_range_t *);
- if ((!is_rollback && range->start > source->rev2)
- || (is_rollback && range->start < source->rev2))
+ if ((!is_rollback && range->start > source->loc2->rev)
+ || (is_rollback && range->start < source->loc2->rev))
{
/* This child's first remaining range comes after the range
we are currently merging, so skip it. We expect to get
@@ -5048,14 +5140,14 @@ drive_merge_report_editor(const char *ta
SVN_ERR_ASSERT(child_repos_path);
if ((child->remaining_ranges->nelts == 0)
- || (is_rollback && (range->start < source->rev2))
- || (!is_rollback && (range->start > source->rev2)))
+ || (is_rollback && (range->start < source->loc2->rev))
+ || (!is_rollback && (range->start > source->loc2->rev)))
{
/* Nothing to merge to this child. We'll claim we have
it up to date so the server doesn't send us
anything. */
SVN_ERR(reporter->set_path(report_baton, child_repos_path,
- source->rev2, depth, FALSE,
+ source->loc2->rev, depth, FALSE,
NULL, iterpool));
}
else
@@ -5210,8 +5302,8 @@ remove_first_range_from_remaining_ranges
and set *PROPS to a new hash of its properties.
RA_SESSION is a session open to the correct repository, which will be
- temporarily reparented to URL which is the URL of the file itself,
- and REV is the revision to get.
+ temporarily reparented to the URL of the file itself. LOCATION is the
+ repository location of the file.
The new temporary file will be created as a sibling of WC_TARGET.
WC_TARGET should be the local path to the working copy of the file, but
@@ -5227,8 +5319,7 @@ static svn_error_t *
single_file_merge_get_file(const char **filename,
apr_hash_t **props,
svn_ra_session_t *ra_session,
- const char *url,
- svn_revnum_t rev,
+ const svn_client__pathrev_t *location,
const char *wc_target,
apr_pool_t *pool)
{
@@ -5239,9 +5330,9 @@ single_file_merge_get_file(const char **
svn_dirent_dirname(wc_target, pool),
svn_io_file_del_none, pool, pool));
- SVN_ERR(svn_client__ensure_ra_session_url(&old_sess_url, ra_session, url,
+ SVN_ERR(svn_client__ensure_ra_session_url(&old_sess_url, ra_session, location->url,
pool));
- SVN_ERR(svn_ra_get_file(ra_session, "", rev,
+ SVN_ERR(svn_ra_get_file(ra_session, "", location->rev,
stream, NULL, props, pool));
SVN_ERR(svn_ra_reparent(ra_session, old_sess_url, pool));
@@ -5274,8 +5365,9 @@ single_file_merge_notify(notification_re
if (IS_OPERATIVE_NOTIFICATION(notify) && (! *header_sent))
{
notify_merge_begin(notify_baton->merge_b->target->abspath,
- (notify_baton->merge_b->sources_ancestral ? r : NULL),
- notify_baton->merge_b, pool);
+ (notify_baton->merge_b->merge_source.ancestral ? r : NULL),
+ notify_baton->merge_b->same_repos,
+ notify_baton->merge_b->ctx, pool);
*header_sent = TRUE;
}
notification_receiver(notify_baton, notify, pool);
@@ -5345,14 +5437,16 @@ insert_child_to_merge(apr_array_header_t
/* Helper for get_mergeinfo_paths().
- CHILDREN_WITH_MERGEINFO, MERGE_CMD_BATON, DEPTH, and POOL are
+ CHILDREN_WITH_MERGEINFO, DEPTH, and POOL are
all cascaded from the arguments of the same name to get_mergeinfo_paths().
+ TARGET is the merge target.
+
*CHILD is the element in in CHILDREN_WITH_MERGEINFO that
get_mergeinfo_paths() is iterating over and *CURR_INDEX is index for
*CHILD.
- If CHILD->ABSPATH is equal to MERGE_CMD_BATON->TARGET_ABSPATH do nothing.
+ If CHILD->ABSPATH is equal to MERGE_CMD_BATON->target->abspath do nothing.
Else if CHILD->ABSPATH is switched or absent then make sure its immediate
(as opposed to nearest) parent in CHILDREN_WITH_MERGEINFO is marked as
missing a child. If the immediate parent does not exist in
@@ -5366,10 +5460,11 @@ insert_child_to_merge(apr_array_header_t
static svn_error_t *
insert_parent_and_sibs_of_sw_absent_del_subtree(
apr_array_header_t *children_with_mergeinfo,
- merge_cmd_baton_t *merge_cmd_baton,
+ const merge_target_t *target,
int *curr_index,
svn_client__merge_path_t *child,
svn_depth_t depth,
+ svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
svn_client__merge_path_t *parent;
@@ -5380,7 +5475,7 @@ insert_parent_and_sibs_of_sw_absent_del_
if (!(child->absent
|| (child->switched
- && strcmp(merge_cmd_baton->target->abspath,
+ && strcmp(target->abspath,
child->abspath) != 0)))
return SVN_NO_ERROR;
@@ -5404,7 +5499,7 @@ insert_parent_and_sibs_of_sw_absent_del_
} /*(parent == NULL) */
/* Add all of PARENT's non-missing children that are not already present.*/
- SVN_ERR(svn_wc__node_get_children(&children, merge_cmd_baton->ctx->wc_ctx,
+ SVN_ERR(svn_wc__node_get_children(&children, ctx->wc_ctx,
parent_abspath, FALSE, pool, pool));
iterpool = svn_pool_create(pool);
for (i = 0; i < children->nelts; i++)
@@ -5426,7 +5521,7 @@ insert_parent_and_sibs_of_sw_absent_del_
svn_node_kind_t child_kind;
SVN_ERR(svn_wc_read_kind(&child_kind,
- merge_cmd_baton->ctx->wc_ctx,
+ ctx->wc_ctx,
child_abspath, FALSE, iterpool));
if (child_kind != svn_node_file)
continue;
@@ -5619,14 +5714,14 @@ get_wc_explicit_mergeinfo_catalog(apr_ha
/* Helper for do_directory_merge() when performing merge-tracking aware
merges.
- Walk of the working copy tree rooted at MERGE_CMD_BATON->TARGET_ABSPATH to
+ Walk of the working copy tree rooted at TARGET->abspath to
depth DEPTH. Create an svn_client__merge_path_t * for any path which meets
one or more of the following criteria:
1) Path has working svn:mergeinfo.
2) Path is switched.
3) Path is a subtree of the merge target (i.e. is not equal to
- MERGE_CMD_BATON->TARGET_ABSPATH) and has no mergeinfo of its own but
+ TARGET->abspath) and has no mergeinfo of its own but
its immediate parent has mergeinfo with non-inheritable ranges. If
this isn't a dry-run and the merge is between differences in the same
repository, then this function will set working mergeinfo on the path
@@ -5638,10 +5733,10 @@ get_wc_explicit_mergeinfo_catalog(apr_ha
sibling is switched, absent, scheduled for deletion, or missing due to
a sparse checkout.
6) Path is absent from disk due to an authz restriction.
- 7) Path is equal to MERGE_CMD_BATON->TARGET_ABSPATH.
+ 7) Path is equal to TARGET->abspath.
8) Path is an immediate *directory* child of
- MERGE_CMD_BATON->TARGET_ABSPATH and DEPTH is svn_depth_immediates.
- 9) Path is an immediate *file* child of MERGE_CMD_BATON->TARGET_ABSPATH
+ TARGET->abspath and DEPTH is svn_depth_immediates.
+ 9) Path is an immediate *file* child of TARGET->abspath
and DEPTH is svn_depth_files.
10) Path is at a depth of 'empty' or 'files'.
[... 2939 lines stripped ...]