You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/12/02 21:55:18 UTC
svn commit: r1041580 [5/35] - in
/subversion/branches/gpg-agent-password-store: ./ build/ build/ac-macros/
build/generator/ build/generator/templates/ build/win32/
contrib/hook-scripts/ contrib/server-side/ notes/http-and-webdav/
notes/wc-ng/ subversio...
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/externals.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/externals.c Thu Dec 2 20:55:08 2010
@@ -204,7 +204,7 @@ switch_dir_external(const char *path,
SVN_ERR(svn_client__update_internal(NULL, local_abspath,
revision, svn_depth_unknown,
FALSE, FALSE, FALSE,
- timestamp_sleep, TRUE,
+ timestamp_sleep, TRUE, FALSE,
ctx, subpool));
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
@@ -230,7 +230,7 @@ switch_dir_external(const char *path,
subpool));
err = svn_client_relocate2(path, repos_root_url, repos_root,
- ctx, subpool);
+ FALSE, ctx, subpool);
/* If the relocation failed because the new URL points
to another repository, then we need to relegate and
check out a new WC. */
@@ -1392,70 +1392,86 @@ svn_client__do_external_status(svn_clien
return SVN_NO_ERROR;
}
-/* Implements svn_wc_externals_update_t */
+
+/* Implements the `svn_wc_externals_update_t' interface. */
svn_error_t *
-svn_cl__store_externals(void *baton,
- const char *local_abspath,
- const svn_string_t *old_value,
- const svn_string_t *new_value,
- svn_depth_t depth,
- apr_pool_t *scratch_pool)
+svn_client__external_info_gatherer(void *baton,
+ const char *local_abspath,
+ const svn_string_t *old_value,
+ const svn_string_t *new_value,
+ svn_depth_t depth,
+ apr_pool_t *scratch_pool)
{
- struct svn_cl__externals_store *eb = baton;
- apr_pool_t *dup_pool = eb->pool;
+ svn_client__external_func_baton_t *efb = baton;
+
+ local_abspath = apr_pstrdup(efb->result_pool, local_abspath);
- local_abspath = apr_pstrdup(dup_pool, local_abspath);
+ if (efb->externals_old != NULL && old_value != NULL)
+ apr_hash_set(efb->externals_old, local_abspath, APR_HASH_KEY_STRING,
+ apr_pstrndup(efb->result_pool,
+ old_value->data, old_value->len));
+
+ if (efb->externals_new != NULL && new_value != NULL)
+ apr_hash_set(efb->externals_new, local_abspath, APR_HASH_KEY_STRING,
+ apr_pstrndup(efb->result_pool,
+ new_value->data, new_value->len));
- if (eb->externals_old != NULL && old_value != NULL)
- apr_hash_set(eb->externals_new,
- local_abspath, APR_HASH_KEY_STRING,
- apr_pstrndup(dup_pool, old_value->data, old_value->len));
-
- if (eb->externals_new != NULL && new_value != NULL)
- apr_hash_set(eb->externals_new,
- local_abspath, APR_HASH_KEY_STRING,
- apr_pstrndup(dup_pool, new_value->data, new_value->len));
-
- if (eb->depths != NULL)
- apr_hash_set(eb->depths,
- local_abspath, APR_HASH_KEY_STRING,
+ if (efb->ambient_depths != NULL)
+ apr_hash_set(efb->ambient_depths, local_abspath, APR_HASH_KEY_STRING,
svn_depth_to_word(depth));
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_client__external_info_gatherer(void *baton,
- const char *local_abspath,
- const svn_string_t *old_val,
- const svn_string_t *new_val,
- svn_depth_t depth,
- apr_pool_t *scratch_pool)
+/* Callback of type svn_wc_external_update_t. Just squirrels away an
+ svn:externals property value into BATON (which is an apr_hash_t *
+ keyed on local absolute path). */
+static svn_error_t *
+externals_update_func(void *baton,
+ const char *local_abspath,
+ const svn_string_t *old_val,
+ const svn_string_t *new_val,
+ svn_depth_t depth,
+ apr_pool_t *scratch_pool)
{
- svn_client__external_func_baton_t *efb = baton;
- const char *dup_val = NULL;
- const char *dup_path = apr_pstrdup(efb->result_pool, local_abspath);
+ apr_hash_t *externals_hash = baton;
+ apr_pool_t *hash_pool = apr_hash_pool_get(externals_hash);
- if (old_val)
- {
- dup_val = apr_pstrmemdup(efb->result_pool, old_val->data, old_val->len);
+ apr_hash_set(externals_hash, apr_pstrdup(hash_pool, local_abspath),
+ APR_HASH_KEY_STRING, svn_string_dup(new_val, hash_pool));
+ return SVN_NO_ERROR;
+}
- apr_hash_set(efb->externals_old, dup_path, APR_HASH_KEY_STRING, dup_val);
- }
- if (new_val)
- {
- /* In most cases the value is identical */
- if (old_val != new_val)
- dup_val = apr_pstrmemdup(efb->result_pool, new_val->data, new_val->len);
+/* Callback of type svn_wc_status_func4_t. Does nothing. */
+static svn_error_t *
+status_noop_func(void *baton,
+ const char *local_abspath,
+ const svn_wc_status3_t *status,
+ apr_pool_t *scratch_pool)
+{
+ return SVN_NO_ERROR;
+}
- apr_hash_set(efb->externals_new, dup_path, APR_HASH_KEY_STRING, dup_val);
- }
- apr_hash_set(efb->ambient_depths, dup_path, APR_HASH_KEY_STRING,
- svn_depth_to_word(depth));
+svn_error_t *
+svn_client__crawl_for_externals(apr_hash_t **externals_p,
+ const char *local_abspath,
+ svn_depth_t depth,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
+{
+ apr_hash_t *externals_hash = apr_hash_make(result_pool);
+
+ /* Do a status run just to harvest externals definitions. */
+ SVN_ERR(svn_wc_walk_status(ctx->wc_ctx, local_abspath, depth,
+ FALSE, FALSE, NULL, status_noop_func, NULL,
+ externals_update_func, externals_hash,
+ ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool));
+ *externals_p = externals_hash;
return SVN_NO_ERROR;
}
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/info.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/info.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/info.c Thu Dec 2 20:55:08 2010
@@ -167,6 +167,9 @@ build_info_for_entry(svn_info_t **info,
SVN_ERR(svn_wc__node_get_schedule(&tmpinfo->schedule, NULL,
wc_ctx, local_abspath, pool));
+ SVN_ERR(svn_wc_get_wc_root(&tmpinfo->wcroot_abspath, wc_ctx,
+ local_abspath, pool, pool));
+
/* Some random stuffs we don't have wc-ng apis for yet */
SVN_ERR(svn_wc__node_get_info_bits(&tmpinfo->text_time,
&tmpinfo->conflict_old,
@@ -250,6 +253,7 @@ build_info_for_unversioned(svn_info_t **
RECEIVER on all children of DIR, but none of their children; if
svn_depth_files, then invoke RECEIVER on file children of DIR but
not on subdirectories; if svn_depth_infinity, recurse fully.
+ DIR is a relpath, relative to the root of RA_SESSION.
*/
static svn_error_t *
push_dir_info(svn_ra_session_t *ra_session,
@@ -285,7 +289,7 @@ push_dir_info(svn_ra_session_t *ra_sessi
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
- path = svn_uri_join(dir, name, subpool);
+ path = svn_relpath_join(dir, name, subpool);
URL = svn_path_url_add_component2(session_URL, name, subpool);
fs_path = svn_uri_is_child(repos_root, URL, subpool);
@@ -692,6 +696,8 @@ svn_info_dup(const svn_info_t *info, apr
dupinfo->conflict_wrk = apr_pstrdup(pool, info->conflict_wrk);
if (info->prejfile)
dupinfo->prejfile = apr_pstrdup(pool, info->prejfile);
+ if (info->wcroot_abspath)
+ dupinfo->wcroot_abspath = apr_pstrdup(pool, info->wcroot_abspath);
return dupinfo;
}
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/list.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/list.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/list.c Thu Dec 2 20:55:08 2010
@@ -99,7 +99,7 @@ get_dir_contents(apr_uint32_t dirent_fie
if (locks)
{
- const char *abs_path = svn_uri_join(fs_path, path, iterpool);
+ const char *abs_path = svn_fspath__join(fs_path, path, iterpool);
lock = apr_hash_get(locks, abs_path, APR_HASH_KEY_STRING);
}
else
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/locking_commands.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/locking_commands.c Thu Dec 2 20:55:08 2010
@@ -182,6 +182,23 @@ organize_lock_targets(const char **commo
apr_hash_t *rel_targets_ret = apr_hash_make(pool);
apr_pool_t *subpool = svn_pool_create(pool);
svn_boolean_t url_mode;
+ svn_boolean_t wc_present = FALSE, url_present = FALSE;
+
+ /* Check to see if at least one of our paths is a working copy
+ * path or a repository url. */
+ for (i = 0; i < targets->nelts; ++i)
+ {
+ const char *target = APR_ARRAY_IDX(targets, i, const char *);
+ if (! svn_path_is_url(target))
+ wc_present = TRUE;
+ else
+ url_present = TRUE;
+ }
+
+ if (url_present && wc_present)
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Cannot mix repository and working copy "
+ "targets"));
/* All targets must be either urls or paths */
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/log.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/log.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/log.c Thu Dec 2 20:55:08 2010
@@ -395,11 +395,12 @@ svn_client_log5(const apr_array_header_t
const char *target;
target = APR_ARRAY_IDX(targets, i, const char *);
+
if (svn_path_is_url(target) || svn_dirent_is_absolute(target))
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("'%s' is not a relative path"),
- target));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a relative path"),
+ target);
+
APR_ARRAY_PUSH(condensed_targets, const char *) = target;
}
}
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/merge.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/merge.c Thu Dec 2 20:55:08 2010
@@ -1723,13 +1723,14 @@ merge_file_added(const char *local_dir_a
copying 'yours' to 'mine', isn't enough; we need to get
the whole text-base and props installed too, just as if
we had called 'svn cp wc wc'. */
- /* ### would be nice to have cancel/notify funcs to pass */
SVN_ERR(svn_wc_add_repos_file4(
merge_b->ctx->wc_ctx, mine_abspath,
new_base_contents, new_contents,
new_base_props, new_props,
copyfrom_url, copyfrom_rev,
- NULL, NULL, NULL, NULL, subpool));
+ merge_b->ctx->cancel_func,
+ merge_b->ctx->cancel_baton,
+ subpool));
/* ### delete 'yours' ? */
}
@@ -3289,6 +3290,110 @@ fix_deleted_subtree_ranges(const char *u
/*** Determining What Remains To Be Merged ***/
+
+/* Attempt to determine if a working copy path inherits any invalid
+ mergeinfo.
+
+ Query the repository for the mergeinfo TARGET_ABSPATH inherits at its
+ base revision and set *VALIDATED to indicate to the caller if we can
+ determine what portions of that inherited mergeinfo are invalid.
+
+ If no mergeinfo is inherited set *INVALID_INHERITED_MERGEINFO to NULL and
+ *VALIDATED to true.
+
+ If only empty mergeinfo is inherited set *INVALID_INHERITED_MERGEINFO to
+ and empty hash and *VALIDATED to true.
+
+ If non-empty inherited mergeinfo is inherited then, if the server (1.7+)
+ supports inherited mergeinfo validation, remove all valid path-revisions
+ from the raw inherited mergeinfo, set *INVALID_INHERITED_MERGEINFO to the
+ remainder, and set *VALIDATED to true. If the server doesn't support
+ inherited mergeinfo validation then set *INVALID_INHERITED_MERGEINFO to
+ NULL and set *VALIDATED to false.
+
+ Note that if validation occurs, but all inherited mergeinfo describes
+ non-existent paths, then *INVALID_INHERITED_MERGEINFO is set to an empty
+ hash.
+
+ RA_SESSION is an open session that points to TARGET_ABSPATH's repository
+ location or to the location of one of TARGET_ABSPATH's parents. It may
+ be temporarily reparented.
+
+ RESULT_POOL is used to allocate *INVALID_INHERITED_MERGEINFO, SCRATCH_POOL
+ is used for any temporary allocations. */
+static svn_error_t *
+get_invalid_inherited_mergeinfo(svn_mergeinfo_t *invalid_inherited_mergeinfo,
+ svn_boolean_t *validated,
+ svn_ra_session_t *ra_session,
+ const char *target_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_mergeinfo_t repos_raw_inherited;
+ svn_mergeinfo_t repos_validated_inherited;
+ svn_revnum_t base_revision;
+ svn_boolean_t validate_inherited_mergeinfo;
+
+ /* Our starting assumptions. */
+ *invalid_inherited_mergeinfo = NULL;
+ *validated = TRUE;
+
+ SVN_ERR(svn_wc__node_get_base_rev(&base_revision, ctx->wc_ctx,
+ target_abspath, scratch_pool));
+
+ /* If there is no base revision then TARGET_ABSPATH doesn't exist
+ in the repository yet, so we're done. */
+ if (SVN_IS_VALID_REVNUM(base_revision))
+ {
+ const char *target_url;
+ const char *session_url;
+
+ /* Reparent RA_SESSION if necessary. */
+ SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx, target_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_client__ensure_ra_session_url(&session_url, ra_session,
+ target_url, scratch_pool));
+
+ /* Contact the repository to derive the portion of
+ TARGET_ABSPATH's inherited mergeinfo which is non-existent
+ and remove it from */
+ validate_inherited_mergeinfo = FALSE;
+ SVN_ERR(svn_client__get_repos_mergeinfo(
+ ra_session, &repos_raw_inherited, "", base_revision,
+ svn_mergeinfo_inherited, TRUE,
+ &validate_inherited_mergeinfo,
+ scratch_pool));
+
+ if (repos_raw_inherited == NULL)
+ {
+ *invalid_inherited_mergeinfo = NULL;
+ }
+ else if (apr_hash_count(repos_raw_inherited) == 0)
+ {
+ *invalid_inherited_mergeinfo = apr_hash_make(result_pool);
+ }
+ else
+ {
+ SVN_ERR(svn_client__get_repos_mergeinfo(
+ ra_session, &repos_validated_inherited, "", base_revision,
+ svn_mergeinfo_inherited, TRUE,
+ validated,
+ scratch_pool));
+ if (*validated)
+ SVN_ERR(svn_mergeinfo_remove2(invalid_inherited_mergeinfo,
+ repos_validated_inherited,
+ repos_raw_inherited, FALSE,
+ result_pool, scratch_pool));
+ else
+ *invalid_inherited_mergeinfo = NULL;
+ }
+ SVN_ERR(svn_client__ensure_ra_session_url(&session_url, ra_session,
+ session_url, scratch_pool));
+ }
+ return SVN_NO_ERROR;
+}
+
/* Get explicit and/or implicit mergeinfo for the working copy path
TARGET_ABSPATH.
@@ -3299,6 +3404,10 @@ fix_deleted_subtree_ranges(const char *u
If IMPLICIT_MERGEINFO is not NULL then set *IMPLICIT_MERGEINFO
to TARGET_ABSPATH's implicit mergeinfo (a.k.a. natural history).
+ If both RECORDED_MERGEINFO and IMPLICIT_MERGEINFO are not NULL and
+ *RECORDED_MERGEINFO is inherited, then *IMPLICIT_MERGEINFO will be
+ removed from *RECORDED_MERGEINFO.
+
If INDIRECT is not NULL set *INDIRECT to TRUE if *RECORDED_MERGEINFO
is inherited and not explicit. If RECORDED_MERGEINFO is NULL then
INDIRECT is ignored.
@@ -3309,6 +3418,9 @@ fix_deleted_subtree_ranges(const char *u
is older than START, then the base revision is used as the younger
bound in place of START.
+ RA_SESSION is an open session that may be temporarily reparented as
+ needed by this function.
+
Allocate *RECORDED_MERGEINFO and *IMPLICIT_MERGEINFO in RESULT_POOL.
Use SCRATCH_POOL for any temporary allocations. */
static svn_error_t *
@@ -3324,11 +3436,14 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- /* First, we get the real mergeinfo. */
+ svn_boolean_t inherited = FALSE;
+ svn_boolean_t inherited_validated = FALSE;
+
+ /* First, we get the real mergeinfo. We use SCRATCH_POOL throughout this
+ block because we'll make a final copy of *RECORDED_MERGEINFO only after
+ removing any self-referential mergeinfo. */
if (recorded_mergeinfo)
{
- svn_boolean_t inherited;
-
/* ### FIXME: There's probably an RA session we could/should be
### using here instead of having this function possibly spawn
### yet another one. */
@@ -3336,9 +3451,29 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
&inherited, FALSE,
inherit, NULL,
target_abspath,
- ctx, result_pool));
+ ctx, scratch_pool));
if (indirect)
*indirect = inherited;
+
+ /* Issue #3669: Remove any non-existent mergeinfo sources
+ from TARGET_ABSPATH's inherited mergeinfo. */
+ if (inherited)
+ {
+ svn_mergeinfo_t invalid_inherited_mergeinfo;
+
+ SVN_ERR(get_invalid_inherited_mergeinfo(
+ &invalid_inherited_mergeinfo, &inherited_validated,
+ ra_session, target_abspath, ctx,
+ scratch_pool, scratch_pool));
+
+ if (inherited_validated
+ && invalid_inherited_mergeinfo
+ && apr_hash_count(invalid_inherited_mergeinfo))
+ SVN_ERR(svn_mergeinfo_remove2(recorded_mergeinfo,
+ invalid_inherited_mergeinfo,
+ *recorded_mergeinfo, FALSE,
+ scratch_pool, scratch_pool));
+ }
}
if (implicit_mergeinfo)
@@ -3346,7 +3481,6 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
const char *session_url = NULL, *url;
svn_revnum_t target_rev;
svn_opt_revision_t peg_revision;
- apr_pool_t *sesspool = NULL;
svn_error_t *err;
/* Assert that we have sane input. */
@@ -3354,10 +3488,12 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
&& SVN_IS_VALID_REVNUM(end)
&& (start > end));
+ *implicit_mergeinfo = NULL;
+
peg_revision.kind = svn_opt_revision_working;
err = svn_client__derive_location(&url, &target_rev, target_abspath,
&peg_revision, ra_session,
- ctx, result_pool, scratch_pool);
+ ctx, scratch_pool, scratch_pool);
if (err)
{
@@ -3370,7 +3506,6 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
* mergeinfo is empty. */
svn_error_clear(err);
*implicit_mergeinfo = apr_hash_make(result_pool);
- return SVN_NO_ERROR;
}
else
return svn_error_return(err);
@@ -3381,52 +3516,60 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
/* We're asking about a range outside our natural history
altogether. That means our implicit mergeinfo is empty. */
*implicit_mergeinfo = apr_hash_make(result_pool);
- return SVN_NO_ERROR;
}
- /* Temporarily point our RA_SESSION at our target URL so we can
- fetch so-called "implicit mergeinfo" (that is, natural history). */
- if (ra_session)
- {
- SVN_ERR(svn_client__ensure_ra_session_url(&session_url, ra_session,
- url, scratch_pool));
- }
- else
+ if (*implicit_mergeinfo == NULL)
{
- SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
- NULL, NULL,
- FALSE, TRUE,
- ctx, scratch_pool));
- }
-
- /* Do not ask for implicit mergeinfo from TARGET_ABSPATH's future.
- 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;
-
- /* Fetch the implicit mergeinfo. */
- peg_revision.kind = svn_opt_revision_number;
- peg_revision.value.number = target_rev;
- SVN_ERR(svn_client__get_history_as_mergeinfo(implicit_mergeinfo, url,
- &peg_revision, start, end,
- ra_session, ctx,
- result_pool));
+ /* Temporarily point our RA_SESSION at our target URL so we can
+ fetch so-called "implicit mergeinfo" (that is, natural
+ history). */
+ SVN_ERR(svn_client__ensure_ra_session_url(&session_url,
+ ra_session, url,
+ scratch_pool));
- /* If we created an RA_SESSION above, destroy it. Otherwise, if
- reparented an existing session, point it back where it was when
- we were called. */
- if (sesspool)
- {
- svn_pool_destroy(sesspool);
- }
- else if (session_url)
- {
- SVN_ERR(svn_ra_reparent(ra_session, session_url, scratch_pool));
+ /* Do not ask for implicit mergeinfo from TARGET_ABSPATH's future.
+ 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;
+
+ /* Fetch the implicit mergeinfo. */
+ peg_revision.kind = svn_opt_revision_number;
+ peg_revision.value.number = target_rev;
+ SVN_ERR(svn_client__get_history_as_mergeinfo(implicit_mergeinfo,
+ url, &peg_revision,
+ start, end,
+ ra_session, ctx,
+ result_pool));
+
+ /* Return RA_SESSION back to where it was when we were called. */
+ SVN_ERR(svn_client__ensure_ra_session_url(&session_url,
+ ra_session, session_url,
+ scratch_pool));
}
} /*if (implicit_mergeinfo) */
+
+ if (recorded_mergeinfo && *recorded_mergeinfo)
+ {
+ /* Issue #3668: Remove any self-referential mergeinfo from that
+ which TARGET_ABSPATH inherited; but only do this if we were able to
+ validate inherited mergeinfo (issue #3669) or otherwise we end
+ up with fragmented mergeinfo, see
+ http://subversion.tigris.org/issues/show_bug.cgi?id=3668#desc5 */
+ if (implicit_mergeinfo
+ && inherited
+ && inherited_validated)
+ SVN_ERR(svn_mergeinfo_remove2(recorded_mergeinfo,
+ *implicit_mergeinfo,
+ *recorded_mergeinfo, FALSE,
+ result_pool, scratch_pool));
+ else
+ *recorded_mergeinfo = svn_mergeinfo_dup(*recorded_mergeinfo,
+ result_pool);
+ }
+
return SVN_NO_ERROR;
}
@@ -4257,7 +4400,7 @@ populate_remaining_ranges(apr_array_head
svn_mergeinfo_inherited, ra_session,
child->abspath,
MAX(revision1, revision2),
- MIN(revision1, revision2),
+ 0, /* Get all implicit mergeinfo */
merge_b->ctx, pool, pool));
/* If CHILD isn't the merge target find its parent. */
@@ -6642,7 +6785,7 @@ do_file_merge(svn_mergeinfo_catalog_t re
&indirect, svn_mergeinfo_inherited,
merge_b->ra_session1, target_abspath,
MAX(revision1, revision2),
- MIN(revision1, revision2),
+ 0, /* Get all implicit mergeinfo */
ctx, scratch_pool, scratch_pool));
SVN_ERR(svn_ra_reparent(merge_b->ra_session1, url1, scratch_pool));
@@ -7244,11 +7387,11 @@ get_inoperative_immediate_children(apr_h
apr_hash_set(*immediate_children,
apr_pstrdup(result_pool, child->abspath),
APR_HASH_KEY_STRING,
- svn_uri_join(merge_source_repos_abspath,
- svn_dirent_is_child(merge_target_abspath,
- child->abspath,
- iterpool),
- result_pool));
+ svn_fspath__join(merge_source_repos_abspath,
+ svn_dirent_is_child(merge_target_abspath,
+ child->abspath,
+ iterpool),
+ result_pool));
}
svn_pool_destroy(iterpool);
@@ -7424,9 +7567,9 @@ record_mergeinfo_for_dir_merge(svn_merge
if (!child_repos_path)
child_repos_path = "";
- child_merge_src_canon_path = svn_uri_join(mergeinfo_path,
- child_repos_path,
- iterpool);
+ child_merge_src_canon_path = svn_fspath__join(mergeinfo_path,
+ child_repos_path,
+ iterpool);
/* Filter any ranges from each child's natural history before
setting mergeinfo describing the merge. */
SVN_ERR(filter_natural_history_from_mergeinfo(
@@ -7734,7 +7877,7 @@ log_noop_revs(void *baton,
/* Adjust REL_PATH so it is relative to the merge source then use it to
calculate what path in the merge target would be affected by this
revision. */
- rel_path = svn_uri_skip_ancestor(log_gap_baton->source_repos_abs, path);
+ rel_path = svn_fspath__skip_ancestor(log_gap_baton->source_repos_abs, path);
cwmi_path = svn_dirent_join(log_gap_baton->merge_b->target_abspath,
rel_path, pool);
@@ -8028,7 +8171,18 @@ do_directory_merge(svn_mergeinfo_catalog
apr_pool_t *pool)
{
svn_error_t *err = SVN_NO_ERROR;
+
+ /* The range defining the mergeinfo we will record to describe the merge
+ (assuming we are recording mergeinfo
+
+ Note: This may be a subset of REVISION1:REVISION2 if
+ populate_remaining_ranges() determines that some part of
+ REVISION1:REVISION2 has already been wholly merged to TARGET_ABSPATH.
+ Also, the actual editor drive(s) may be a subset of RANGE, if
+ remove_noop_subtree_ranges() and/or fix_deleted_subtree_ranges()
+ further tweak things. */
svn_merge_range_t range;
+
svn_ra_session_t *ra_session;
svn_client__merge_path_t *target_merge_path;
svn_boolean_t is_rollback = (revision1 > revision2);
@@ -8101,17 +8255,22 @@ do_directory_merge(svn_mergeinfo_catalog
if (honor_mergeinfo && !merge_b->reintegrate_merge)
{
- svn_revnum_t start_rev, end_rev;
+ svn_revnum_t new_range_start, start_rev, end_rev;
apr_pool_t *iterpool = svn_pool_create(pool);
- /* The merge target target_wcpath and/or its subtrees may not need all
+ /* The merge target TARGET_ABSPATH and/or its subtrees may not need all
of REVISION1:REVISION2 applied. So examine
NOTIFY_B->CHILDREN_WITH_MERGEINFO to find the oldest starting
revision that actually needs to be merged (for reverse merges this is
- the youngest starting revision). */
- start_rev =
- get_most_inclusive_start_rev(notify_b->children_with_mergeinfo,
- is_rollback);
+ the youngest starting revision).
+
+ We'll do this twice, right now for the start of the mergeinfo we will
+ ultimately record to describe this merge and then later for the
+ start of the actual editor drive. */
+ new_range_start = get_most_inclusive_start_rev(
+ notify_b->children_with_mergeinfo, is_rollback);
+ if (SVN_IS_VALID_REVNUM(new_range_start))
+ range.start = new_range_start;
/* Remove inoperative ranges from any subtrees' remaining_ranges
to spare the expense of noop editor drives. */
@@ -8121,16 +8280,20 @@ do_directory_merge(svn_mergeinfo_catalog
notify_b, merge_b,
pool, iterpool));
+ /* Adjust subtrees' remaining_ranges to deal with issue #3067 */
SVN_ERR(fix_deleted_subtree_ranges(url1, revision1, url2, revision2,
ra_session, notify_b, merge_b, pool));
+ /* remove_noop_subtree_ranges() and/or fix_deleted_subtree_range()
+ may have further refined the starting revision for our editor
+ drive. */
+ start_rev =
+ get_most_inclusive_start_rev(notify_b->children_with_mergeinfo,
+ is_rollback);
+
/* Is there anything to merge? */
if (SVN_IS_VALID_REVNUM(start_rev))
{
- /* Adjust range to describe the start of our most
- inclusive merge. */
- range.start = start_rev;
-
/* Now examine NOTIFY_B->CHILDREN_WITH_MERGEINFO to find the youngest
ending revision that actually needs to be merged (for reverse
merges this is the oldest starting revision). */
@@ -8170,6 +8333,33 @@ do_directory_merge(svn_mergeinfo_catalog
svn_revnum_t next_end_rev;
const char *real_url1 = url1, *real_url2 = url2;
const char *old_sess1_url = NULL, *old_sess2_url = NULL;
+ svn_merge_range_t *first_target_range = APR_ARRAY_IDX(
+ target_merge_path->remaining_ranges, 0, svn_merge_range_t *);
+
+ /* Issue #3324: Stop editor abuse! Don't call
+ drive_merge_report_editor() in such a way that we request an
+ editor with svn_client__get_diff_editor() for some rev X,
+ then call svn_ra_do_diff3() for some revision Y, and then
+ call reporter->set_path(PATH=="") to set the root revision
+ for the editor drive to revision Z where
+ (X != Z && X < Z < Y). This is bogus because the server will
+ send us the diff between X:Y but the client is expecting the
+ diff between Y:Z. See issue #3324 for full details on the
+ problems this can cause. */
+ if (first_target_range
+ && start_rev != first_target_range->start)
+ {
+ if (is_rollback)
+ {
+ if (end_rev < first_target_range->start)
+ end_rev = first_target_range->start;
+ }
+ else
+ {
+ if (end_rev > first_target_range->start)
+ end_rev = first_target_range->start;
+ }
+ }
svn_pool_clear(iterpool);
@@ -8468,11 +8658,11 @@ do_merge(apr_hash_t **modified_subtrees,
SVN_ERR(svn_wc_read_kind(&target_kind, ctx->wc_ctx, target_abspath, FALSE,
pool));
+
if (target_kind != svn_node_dir && target_kind != svn_node_file)
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge target '%s' does not exist in the "
- "working copy"), target_abspath));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge target '%s' does not exist in the "
+ "working copy"), target_abspath);
/* Ensure a known depth. */
if (depth == svn_depth_unknown)
@@ -8815,6 +9005,73 @@ merge_cousins_and_supplement_mergeinfo(c
return SVN_NO_ERROR;
}
+/* Perform checks to determine whether of the working copy at TARGET_ABSPATH
+ * can safely be used as a merge target. Checks are performed according to
+ * the ALLOW_MIXED_REV, ALLOW_LOCAL_MODS, and ALLOW_SWITCHED_SUBTREES
+ * parameters. If any checks fail, raise SVN_ERR_CLIENT_NOT_READY_TO_MERGE.
+ *
+ * E.g. if all the ALLOW_* parameters are FALSE, TARGET_ABSPATH must
+ * be a single-revision, pristine, unswitched working copy.
+ * In other words, it must reflect a subtree of the repostiory as found
+ * at single revision -- although sparse checkouts are permitted. */
+static svn_error_t *
+ensure_wc_is_suitable_merge_target(const char *target_abspath,
+ svn_client_ctx_t *ctx,
+ svn_boolean_t allow_mixed_rev,
+ svn_boolean_t allow_local_mods,
+ svn_boolean_t allow_switched_subtrees,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc_revision_status_t *wc_stat;
+
+ /* Avoid the following status crawl if we don't need it. */
+ if (allow_mixed_rev && allow_local_mods && allow_switched_subtrees)
+ return SVN_NO_ERROR;
+
+ /* Get a WC summary with min/max revisions set to the BASE revision. */
+ SVN_ERR(svn_wc_revision_status2(&wc_stat, ctx->wc_ctx, target_abspath, NULL,
+ FALSE, ctx->cancel_func, ctx->cancel_baton,
+ scratch_pool, scratch_pool));
+
+ if (! allow_switched_subtrees && wc_stat->switched)
+ return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
+ _("Cannot merge into a working copy "
+ "with a switched subtree"));
+
+ if (! allow_local_mods && wc_stat->modified)
+ return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
+ _("Cannot merge into a working copy "
+ "that has local modifications"));
+
+ if (! allow_mixed_rev)
+ {
+ if (! (SVN_IS_VALID_REVNUM(wc_stat->min_rev)
+ && SVN_IS_VALID_REVNUM(wc_stat->max_rev)))
+ {
+ svn_boolean_t is_added;
+
+ /* Allow merge into added nodes. */
+ SVN_ERR(svn_wc__node_is_added(&is_added, ctx->wc_ctx, target_abspath,
+ scratch_pool));
+ if (is_added)
+ return SVN_NO_ERROR;
+ else
+ return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
+ _("Cannot determine revision of working "
+ "copy"));
+ }
+
+ if (wc_stat->min_rev != wc_stat->max_rev)
+ return svn_error_createf(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
+ _("Cannot merge into mixed-revision working "
+ "copy [%lu:%lu]; try updating first"),
+ wc_stat->min_rev, wc_stat->max_rev);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
/*-----------------------------------------------------------------------*/
/*** Public APIs ***/
@@ -8830,6 +9087,7 @@ merge_locked(const char *source1,
svn_boolean_t force,
svn_boolean_t record_only,
svn_boolean_t dry_run,
+ svn_boolean_t allow_mixed_rev,
const apr_array_header_t *merge_options,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
@@ -8866,10 +9124,11 @@ merge_locked(const char *source1,
|| (revision2->kind == svn_opt_revision_unspecified))
return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
_("Not all required revisions are specified"));
+
if (svn_path_is_url(source1) != svn_path_is_url(source2))
- return svn_error_return(svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge sources must both be "
- "either paths or URLs")));
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge sources must both be "
+ "either paths or URLs"));
/* ### FIXME: This function really ought to do a history check on
the left and right sides of the merge source, and -- if one is an
@@ -8899,11 +9158,16 @@ merge_locked(const char *source1,
SVN_ERR(svn_wc_read_kind(&target_kind, ctx->wc_ctx, target_abspath, FALSE,
scratch_pool));
+
if (target_kind != svn_node_dir && target_kind != svn_node_file)
- return svn_error_return(svn_error_createf(
- SVN_ERR_ILLEGAL_TARGET, NULL,
- _("Merge target '%s' does not exist in the "
- "working copy"), target_abspath));
+ return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("Merge target '%s' does not exist in the "
+ "working copy"), target_abspath);
+
+ /* Do not allow merges into mixed-revision working copies. */
+ SVN_ERR(ensure_wc_is_suitable_merge_target(target_abspath, ctx,
+ allow_mixed_rev, TRUE, TRUE,
+ scratch_pool));
/* Determine the working copy target's repository root URL. */
working_rev.kind = svn_opt_revision_working;
@@ -9103,6 +9367,7 @@ struct merge_baton {
svn_boolean_t force;
svn_boolean_t record_only;
svn_boolean_t dry_run;
+ svn_boolean_t allow_mixed_rev;
const apr_array_header_t *merge_options;
svn_client_ctx_t *ctx;
};
@@ -9116,7 +9381,8 @@ merge_cb(void *baton, apr_pool_t *result
SVN_ERR(merge_locked(b->source1, b->revision1, b->source2, b->revision2,
b->target_abspath, b->depth, b->ignore_ancestry,
b->force, b->record_only, b->dry_run,
- b->merge_options, b->ctx, scratch_pool));
+ b->allow_mixed_rev, b->merge_options, b->ctx,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -9144,7 +9410,7 @@ get_target_and_lock_abspath(const char *
}
svn_error_t *
-svn_client_merge3(const char *source1,
+svn_client_merge4(const char *source1,
const svn_opt_revision_t *revision1,
const char *source2,
const svn_opt_revision_t *revision2,
@@ -9154,6 +9420,7 @@ svn_client_merge3(const char *source1,
svn_boolean_t force,
svn_boolean_t record_only,
svn_boolean_t dry_run,
+ svn_boolean_t allow_mixed_rev,
const apr_array_header_t *merge_options,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
@@ -9174,6 +9441,7 @@ svn_client_merge3(const char *source1,
baton.force = force;
baton.record_only = record_only;
baton.dry_run = dry_run;
+ baton.allow_mixed_rev = allow_mixed_rev;
baton.merge_options = merge_options;
baton.ctx = ctx;
@@ -9188,45 +9456,6 @@ svn_client_merge3(const char *source1,
}
-/* If TARGET_WCPATH does not reflect a single-revision, pristine,
- unswitched working copy -- in other words, a subtree found in a
- single revision (although sparse checkouts are permitted) -- raise
- SVN_ERR_CLIENT_NOT_READY_TO_MERGE. */
-static svn_error_t *
-ensure_wc_reflects_repository_subtree(const char *target_abspath,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool)
-{
- svn_wc_revision_status_t *wc_stat;
-
- /* Get a WC summary with min/max revisions set to the BASE revision. */
- SVN_ERR(svn_wc_revision_status2(&wc_stat, ctx->wc_ctx, target_abspath, NULL,
- FALSE, ctx->cancel_func, ctx->cancel_baton,
- scratch_pool, scratch_pool));
-
- if (wc_stat->switched)
- return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
- _("Cannot reintegrate into a working copy "
- "with a switched subtree"));
-
- if (wc_stat->modified)
- return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
- _("Cannot reintegrate into a working copy "
- "that has local modifications"));
-
- if (! (SVN_IS_VALID_REVNUM(wc_stat->min_rev)
- && SVN_IS_VALID_REVNUM(wc_stat->max_rev)))
- return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
- _("Cannot determine revision of working copy"));
-
- if (wc_stat->min_rev != wc_stat->max_rev)
- return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
- _("Cannot reintegrate into mixed-revision "
- "working copy; try updating first"));
-
- return SVN_NO_ERROR;
-}
-
/* Check if mergeinfo for a given path is described explicitly or via
inheritance in a mergeinfo catalog.
@@ -9351,10 +9580,10 @@ log_find_operative_revs(void *baton,
svn_mergeinfo_t log_entry_as_mergeinfo;
/* Easy out: The path is not within the tree of interest. */
- if (!svn_uri_is_ancestor(log_baton->target_abspath, path))
+ if (!svn_fspath__is_ancestor(log_baton->target_abspath, path))
continue;
- rel_path = svn_uri_skip_ancestor(log_baton->target_abspath, path);
+ rel_path = svn_fspath__skip_ancestor(log_baton->target_abspath, path);
source_rel_path = svn_relpath_join(log_baton->source_repos_rel_path,
rel_path, pool);
@@ -9383,8 +9612,8 @@ log_find_operative_revs(void *baton,
&& strcmp(subtree_missing_this_rev, source_rel_path))
{
const char *suffix =
- svn_uri_skip_ancestor(subtree_missing_this_rev,
- source_rel_path);
+ svn_relpath_skip_ancestor(subtree_missing_this_rev,
+ source_rel_path);
missing_path = apr_pstrmemdup(pool, path,
strlen(path) - strlen(suffix) - 1);
}
@@ -9436,9 +9665,9 @@ log_find_operative_revs(void *baton,
of the unmerged revisions in UNMERGED_CATALOG's mergeinfos are "phantoms",
that is, one of the following conditions holds:
- 1) The revision effects no corresponding paths in SOURCE_REPOS_REL_PATH.
+ 1) The revision affects no corresponding paths in SOURCE_REPOS_REL_PATH.
- 2) The revision effects corresponding paths in SOURCE_REPOS_REL_PATH,
+ 2) The revision affects corresponding paths in SOURCE_REPOS_REL_PATH,
but based on the mergeinfo in MERGED_CATALOG, the change was
previously merged.
@@ -9489,7 +9718,7 @@ find_unsynced_ranges(const char *source_
}
}
- /* Find any unmerged revisions which both effect the source and
+ /* Find any unmerged revisions which both affect the source and
are not yet merged to it. */
if (potentially_unmerged_ranges)
{
@@ -9615,10 +9844,10 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
svn_pool_clear(iterpool);
source_path = path + strlen(target_repos_rel_path);
- if (source_path[0] == '/') /* Remove leading '/' for svn_uri_join. */
+ if (source_path[0] == '/') /* Remove leading '/'. */
source_path++;
- source_path = svn_uri_join(source_repos_rel_path, source_path,
- iterpool);
+ source_path = svn_relpath_join(source_repos_rel_path, source_path,
+ iterpool);
source_path_rel_to_session =
svn_relpath_skip_ancestor(source_repos_rel_path, source_path);
@@ -9769,7 +9998,7 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
svn_pool_clear(iterpool);
target_path = source_path + strlen(source_repos_rel_path);
- if (target_path[0] == '/') /* Remove leading '/' for svn_uri_join. */
+ if (target_path[0] == '/') /* Remove leading '/'. */
target_path++;
err = svn_client__repos_location_segments(&segments,
target_ra_session,
@@ -10174,8 +10403,11 @@ merge_reintegrate_locked(const char *sou
svn_dirent_local_style(target_abspath,
scratch_pool));
- SVN_ERR(ensure_wc_reflects_repository_subtree(target_abspath, ctx,
- scratch_pool));
+ /* A reintegrate merge requires the merge target to reflect a subtree
+ * of the repository as found at a single revision. */
+ SVN_ERR(ensure_wc_is_suitable_merge_target(target_abspath, ctx,
+ FALSE, FALSE, FALSE,
+ scratch_pool));
SVN_ERR(svn_wc__node_get_base_rev(&target_base_rev, ctx->wc_ctx,
target_abspath, scratch_pool));
@@ -10391,6 +10623,7 @@ merge_peg_locked(const char *source,
svn_boolean_t force,
svn_boolean_t record_only,
svn_boolean_t dry_run,
+ svn_boolean_t allow_mixed_rev,
const apr_array_header_t *merge_options,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
@@ -10432,6 +10665,10 @@ merge_peg_locked(const char *source,
_("Merge target '%s' does not exist in the "
"working copy"), target_abspath));
+ SVN_ERR(ensure_wc_is_suitable_merge_target(target_abspath, ctx,
+ allow_mixed_rev, TRUE, TRUE,
+ scratch_pool));
+
/* Determine the working copy target's repository root URL. */
working_rev.kind = svn_opt_revision_working;
SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath,
@@ -10494,6 +10731,7 @@ struct merge_peg_baton {
svn_boolean_t force;
svn_boolean_t record_only;
svn_boolean_t dry_run;
+ svn_boolean_t allow_mixed_rev;
const apr_array_header_t *merge_options;
svn_client_ctx_t *ctx;
};
@@ -10507,13 +10745,14 @@ merge_peg_cb(void *baton, apr_pool_t *re
SVN_ERR(merge_peg_locked(b->source, b->ranges_to_merge, b->peg_revision,
b->target_abspath, b->depth, b->ignore_ancestry,
b->force, b->record_only, b->dry_run,
- b->merge_options, b->ctx, scratch_pool));
+ b->allow_mixed_rev, b->merge_options, b->ctx,
+ scratch_pool));
return SVN_NO_ERROR;
}
svn_error_t *
-svn_client_merge_peg3(const char *source,
+svn_client_merge_peg4(const char *source,
const apr_array_header_t *ranges_to_merge,
const svn_opt_revision_t *peg_revision,
const char *target_wcpath,
@@ -10522,6 +10761,7 @@ svn_client_merge_peg3(const char *source
svn_boolean_t force,
svn_boolean_t record_only,
svn_boolean_t dry_run,
+ svn_boolean_t allow_mixed_rev,
const apr_array_header_t *merge_options,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
@@ -10545,6 +10785,7 @@ svn_client_merge_peg3(const char *source
baton.force = force;
baton.record_only = record_only;
baton.dry_run = dry_run;
+ baton.allow_mixed_rev = allow_mixed_rev;
baton.merge_options = merge_options;
baton.ctx = ctx;
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.c?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.c Thu Dec 2 20:55:08 2010
@@ -156,7 +156,7 @@ svn_client__adjust_mergeinfo_source_path
/* Copy inherited mergeinfo into our output hash, adjusting the
merge source as appropriate. */
- path = svn_uri_join(merge_source, rel_path, pool);
+ path = svn_fspath__join(merge_source, rel_path, pool);
copied_rangelist = svn_rangelist_dup(rangelist, pool);
apr_hash_set(adjusted_mergeinfo, path, APR_HASH_KEY_STRING,
copied_rangelist);
@@ -442,17 +442,16 @@ svn_client__get_repos_mergeinfo(svn_ra_s
svn_revnum_t rev,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t squelch_incapable,
+ svn_boolean_t *validate_inherited_mergeinfo,
apr_pool_t *pool)
{
svn_mergeinfo_catalog_t tgt_mergeinfo_cat;
*target_mergeinfo = NULL;
- SVN_ERR(svn_client__get_repos_mergeinfo_catalog(&tgt_mergeinfo_cat,
- ra_session,
- rel_path, rev, inherit,
- squelch_incapable, FALSE,
- pool, pool));
+ SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
+ &tgt_mergeinfo_cat, ra_session, rel_path, rev, inherit,
+ squelch_incapable, FALSE, validate_inherited_mergeinfo, pool, pool));
if (tgt_mergeinfo_cat && apr_hash_count(tgt_mergeinfo_cat))
{
@@ -468,15 +467,17 @@ svn_client__get_repos_mergeinfo(svn_ra_s
}
svn_error_t *
-svn_client__get_repos_mergeinfo_catalog(svn_mergeinfo_catalog_t *mergeinfo_cat,
- svn_ra_session_t *ra_session,
- const char *rel_path,
- svn_revnum_t rev,
- svn_mergeinfo_inheritance_t inherit,
- svn_boolean_t squelch_incapable,
- svn_boolean_t include_descendants,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_client__get_repos_mergeinfo_catalog(
+ svn_mergeinfo_catalog_t *mergeinfo_cat,
+ svn_ra_session_t *ra_session,
+ const char *rel_path,
+ svn_revnum_t rev,
+ svn_mergeinfo_inheritance_t inherit,
+ svn_boolean_t squelch_incapable,
+ svn_boolean_t include_descendants,
+ svn_boolean_t *validate_inherited_mergeinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_error_t *err;
svn_mergeinfo_t repos_mergeinfo;
@@ -486,8 +487,9 @@ svn_client__get_repos_mergeinfo_catalog(
APR_ARRAY_PUSH(rel_paths, const char *) = rel_path;
/* Fetch the mergeinfo. */
- err = svn_ra_get_mergeinfo(ra_session, &repos_mergeinfo, rel_paths, rev,
- inherit, include_descendants, result_pool);
+ err = svn_ra_get_mergeinfo2(ra_session, &repos_mergeinfo, rel_paths, rev,
+ inherit, validate_inherited_mergeinfo,
+ include_descendants, result_pool);
if (err)
{
if (squelch_incapable && err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
@@ -606,6 +608,7 @@ svn_client__get_wc_or_repos_mergeinfo_ca
{
const char *session_url = NULL;
apr_pool_t *sesspool = NULL;
+ svn_boolean_t validate_inherited_mergeinfo = FALSE;
if (ra_session)
{
@@ -624,7 +627,8 @@ svn_client__get_wc_or_repos_mergeinfo_ca
SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
target_mergeinfo_catalog, ra_session,
"", target_rev, inherit,
- TRUE, FALSE, result_pool, scratch_pool));
+ TRUE, FALSE, &validate_inherited_mergeinfo,
+ result_pool, scratch_pool));
if (*target_mergeinfo_catalog
&& apr_hash_get(*target_mergeinfo_catalog, "",
@@ -1027,6 +1031,7 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
if (is_url)
{
svn_mergeinfo_catalog_t tmp_catalog;
+ svn_boolean_t validate_inherited_mergeinfo = FALSE;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", scratch_pool));
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
@@ -1037,14 +1042,10 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
local_abspath, ra_session,
&peg_rev, scratch_pool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, scratch_pool));
- SVN_ERR(svn_client__get_repos_mergeinfo_catalog(&tmp_catalog,
- ra_session,
- "", rev,
- svn_mergeinfo_inherited,
- FALSE,
- include_descendants,
- result_pool,
- scratch_pool));
+ SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
+ &tmp_catalog, ra_session, "", rev, svn_mergeinfo_inherited,
+ FALSE, include_descendants, &validate_inherited_mergeinfo,
+ result_pool, scratch_pool));
/* If we're not querying the root of the repository, the catalog
we fetched will be keyed on paths relative to the session
@@ -1394,7 +1395,7 @@ filter_log_entry_with_rangelist(void *ba
{
merge_source_path =
APR_ARRAY_IDX(fleb->merge_source_paths, i, const char *);
- if (svn_uri_is_ancestor(merge_source_path, path))
+ if (svn_fspath__is_ancestor(merge_source_path, path))
{
/* If MERGE_SOURCE was itself deleted, replaced, or added
in LOG_ENTRY->REVISION then ignore this PATH since you
@@ -1411,11 +1412,11 @@ filter_log_entry_with_rangelist(void *ba
continue;
/* Calculate the target path which PATH would affect if merged. */
- merge_source_rel_target = svn_uri_skip_ancestor(merge_source_path,
- path);
- target_path_affected = svn_uri_join(fleb->abs_repos_target_path,
- merge_source_rel_target,
- iterpool);
+ merge_source_rel_target = svn_fspath__skip_ancestor(merge_source_path,
+ path);
+ target_path_affected = svn_fspath__join(fleb->abs_repos_target_path,
+ merge_source_rel_target,
+ iterpool);
nearest_ancestor_mergeinfo =
find_nearest_ancestor(fleb->depth_first_catalog_index,
Modified: subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.h?rev=1041580&r1=1041579&r2=1041580&view=diff
==============================================================================
--- subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/branches/gpg-agent-password-store/subversion/libsvn_client/mergeinfo.h Thu Dec 2 20:55:08 2010
@@ -155,7 +155,20 @@ svn_client__get_wc_mergeinfo_catalog(svn
If there is no mergeinfo available for REL_PATH, or if the server
doesn't support a mergeinfo capability and SQUELCH_INCAPABLE is
- TRUE, set *TARGET_MERGEINFO to NULL. */
+ TRUE, set *TARGET_MERGEINFO to NULL.
+
+ If the *TARGET_MERGEINFO for REL_PATH path is inherited and
+ *VALIDATE_INHERITED_MERGEINFO is TRUE, then *TARGET_MERGEINFO
+ will only contain merge source path-revisions that actually
+ exist in repository.
+
+ If the *TARGET_MERGEINFO for REL_PATH path is inherited and
+ *VALIDATE_INHERITED_MERGEINFO is TRUE, then request that the server
+ validate the mergeinfo in *TARGET_MERGEINFO, so it contains only merge
+ source path-revisions that actually exist in repository. If validation
+ is requested and the server supports it, then set
+ *VALIDATE_INHERITED_MERGEINFO to TRUE on return. Set it to FALSE in
+ all other cases. */
svn_error_t *
svn_client__get_repos_mergeinfo(svn_ra_session_t *ra_session,
svn_mergeinfo_t *target_mergeinfo,
@@ -163,6 +176,7 @@ svn_client__get_repos_mergeinfo(svn_ra_s
svn_revnum_t rev,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t squelch_incapable,
+ svn_boolean_t *validate_inherited_mergeinfo,
apr_pool_t *pool);
/* If INCLUDE_DESCENDANTS is FALSE, behave exactly like
@@ -176,15 +190,17 @@ svn_client__get_repos_mergeinfo(svn_ra_s
paths of the subtrees. If no mergeinfo is found, then
*TARGET_MERGEINFO_CAT is set to NULL. */
svn_error_t *
-svn_client__get_repos_mergeinfo_catalog(svn_mergeinfo_catalog_t *mergeinfo_cat,
- svn_ra_session_t *ra_session,
- const char *rel_path,
- svn_revnum_t rev,
- svn_mergeinfo_inheritance_t inherit,
- svn_boolean_t squelch_incapable,
- svn_boolean_t include_descendants,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_client__get_repos_mergeinfo_catalog(
+ svn_mergeinfo_catalog_t *mergeinfo_cat,
+ svn_ra_session_t *ra_session,
+ const char *rel_path,
+ svn_revnum_t rev,
+ svn_mergeinfo_inheritance_t inherit,
+ svn_boolean_t squelch_incapable,
+ svn_boolean_t include_descendants,
+ svn_boolean_t *validate_inherited_mergeinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Retrieve the direct mergeinfo for the TARGET_WCPATH from the WC's
mergeinfo prop, or that inherited from its nearest ancestor if the