Author: philip
Date: Thu Apr 8 12:56:16 2010
New Revision: 931918
URL: http://svn.apache.org/viewvc?rev=931918&view=rev
Log:
Remove an access baton from client merge.
* subversion/libsvn_client/merge.c
(merge_reintegrate_locked): Renamed from svn_client_merge_reintegrate,
parameter target_wcpath renamed to target_abspath, parameter pool
renamed to scratch_pool, remove access baton.
(struct merge_reintegrate_baton, merge_reintegrate_cb): New
(svn_client_merge_reintegrate): Gutted, uses svn_wc__call_with_write_lock.
Modified:
subversion/trunk/subversion/libsvn_client/merge.c
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=931918&r1=931917&r2=931918&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Apr 8 12:56:16 2010
@@ -9516,16 +9516,15 @@ get_subtree_mergeinfo_walk_cb(const char
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_client_merge_reintegrate(const char *source,
- const svn_opt_revision_t *peg_revision,
- const char *target_wcpath,
- svn_boolean_t dry_run,
- const apr_array_header_t *merge_options,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+static svn_error_t *
+merge_reintegrate_locked(const char *source,
+ const svn_opt_revision_t *peg_revision,
+ const char *target_abspath,
+ svn_boolean_t dry_run,
+ const apr_array_header_t *merge_options,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool)
{
- svn_wc_adm_access_t *adm_access;
const char *wc_repos_root, *source_repos_root;
svn_opt_revision_t working_revision;
svn_ra_session_t *ra_session;
@@ -9540,47 +9539,44 @@ svn_client_merge_reintegrate(const char
svn_boolean_t use_sleep = FALSE;
svn_error_t *err;
struct get_subtree_mergeinfo_walk_baton wb;
- const char *target_abspath;
const char *target_url;
svn_revnum_t target_base_rev;
- SVN_ERR(svn_dirent_get_absolute(&target_abspath, target_wcpath, pool));
-
- /* Open an admistrative session with the working copy. */
- SVN_ERR(svn_wc__adm_probe_in_context(&adm_access, ctx->wc_ctx,
- target_abspath,
- (! dry_run), -1, ctx->cancel_func,
- ctx->cancel_baton, pool));
-
/* Make sure we're dealing with a real URL. */
- SVN_ERR(svn_client_url_from_path2(&url2, source, ctx, pool, pool));
+ SVN_ERR(svn_client_url_from_path2(&url2, source, ctx,
+ scratch_pool, scratch_pool));
if (! url2)
return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
_("'%s' has no URL"),
- svn_dirent_local_style(source, pool));
+ svn_dirent_local_style(source, scratch_pool));
/* Determine the working copy target's repository root URL. */
working_revision.kind = svn_opt_revision_working;
SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath,
- &working_revision, ctx, pool, pool));
+ &working_revision, ctx,
+ scratch_pool, scratch_pool));
/* Open an RA session to our source URL, and determine its root URL. */
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, wc_repos_root,
NULL, NULL,
- FALSE, FALSE, ctx, pool));
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_repos_root, pool));
+ FALSE, FALSE, ctx,
+ scratch_pool));
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_repos_root,
scratch_pool));
/* source_repos_root and wc_repos_root are required to be the same,
as mergeinfo doesn't come into play for cross-repository merging. */
if (strcmp(source_repos_root, wc_repos_root) != 0)
return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
_("'%s' must be from the same repository as "
- "'%s'"), svn_dirent_local_style(source, pool),
- svn_dirent_local_style(target_wcpath, pool));
+ "'%s'"), svn_dirent_local_style(source,
+ scratch_pool),
+ svn_dirent_local_style(target_abspath,
+ scratch_pool));
- SVN_ERR(ensure_wc_reflects_repository_subtree(target_abspath, ctx, pool));
+ SVN_ERR(ensure_wc_reflects_repository_subtree(target_abspath, ctx,
+ scratch_pool));
SVN_ERR(svn_wc__node_get_base_rev(&target_base_rev, ctx->wc_ctx,
- target_abspath, pool));
+ target_abspath, scratch_pool));
/* As the WC tree is "pure", use its last-updated-to revision as
the default revision for the left side of our merge, since that's
@@ -9590,11 +9586,12 @@ svn_client_merge_reintegrate(const char
SVN_ERR(svn_client__path_relative_to_root(&source_repos_rel_path,
ctx->wc_ctx, url2, NULL, FALSE,
- ra_session, pool, pool));
+ ra_session,
+ scratch_pool, scratch_pool));
SVN_ERR(svn_client__path_relative_to_root(&target_repos_rel_path,
ctx->wc_ctx, target_abspath,
wc_repos_root, FALSE, ra_session,
- pool, pool));
+ scratch_pool, scratch_pool));
/* Can't reintegrate to or from the root of the repository. */
if (svn_path_is_empty(source_repos_rel_path)
@@ -9606,17 +9603,18 @@ svn_client_merge_reintegrate(const char
/* Find all the subtree's in TARGET_WCPATH that have explicit mergeinfo. */
wb.target_abspath = target_abspath;
wb.target_repos_root = wc_repos_root;
- wb.subtrees_with_mergeinfo = apr_hash_make(pool);
+ wb.subtrees_with_mergeinfo = apr_hash_make(scratch_pool);
wb.ctx = ctx;
SVN_ERR(svn_wc__node_walk_children(ctx->wc_ctx, target_abspath, TRUE,
get_subtree_mergeinfo_walk_cb, &wb,
svn_depth_infinity,
ctx->cancel_func, ctx->cancel_baton,
- pool));
+ scratch_pool));
SVN_ERR(svn_client__get_revision_number(&rev2, NULL, ctx->wc_ctx,
source_repos_rel_path,
- ra_session, peg_revision, pool));
+ ra_session, peg_revision,
+ scratch_pool));
SVN_ERR(calculate_left_hand_side(&url1, &rev1,
&merged_to_source_mergeinfo_catalog,
@@ -9629,13 +9627,13 @@ svn_client_merge_reintegrate(const char
rev2,
ra_session,
ctx,
- pool));
+ scratch_pool));
SVN_ERR(svn_client__get_youngest_common_ancestor(&yc_ancestor_path,
&yc_ancestor_rev,
url2, rev2,
url1, rev1,
- ctx, pool));
+ ctx, scratch_pool));
if (!(yc_ancestor_path && SVN_IS_VALID_REVNUM(yc_ancestor_rev)))
return svn_error_createf(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
@@ -9647,14 +9645,14 @@ svn_client_merge_reintegrate(const char
/* Have we actually merged anything to the source from the
target? If so, make sure we've merged a contiguous
prefix. */
- final_unmerged_catalog = apr_hash_make(pool);
+ final_unmerged_catalog = apr_hash_make(scratch_pool);
SVN_ERR(find_unsynced_ranges(source_repos_rel_path,
yc_ancestor_path,
unmerged_to_source_mergeinfo_catalog,
merged_to_source_mergeinfo_catalog,
final_unmerged_catalog,
- ra_session, pool, pool));
+ ra_session, scratch_pool, scratch_pool));
if (apr_hash_count(final_unmerged_catalog))
{
@@ -9663,9 +9661,10 @@ svn_client_merge_reintegrate(const char
SVN_ERR(svn_mergeinfo__catalog_to_formatted_string(
&source_mergeinfo_cat_string,
final_unmerged_catalog,
- " ", " Missing ranges: ", pool));
+ " ", " Missing ranges: ", scratch_pool));
SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx,
- target_abspath, pool, pool));
+ target_abspath,
+ scratch_pool, scratch_pool));
return svn_error_createf(SVN_ERR_CLIENT_NOT_READY_TO_MERGE,
NULL,
_("Reintegrate can only be used if "
@@ -9696,18 +9695,68 @@ svn_client_merge_reintegrate(const char
svn_depth_infinity,
FALSE, FALSE, FALSE, dry_run,
merge_options, &use_sleep,
- ctx, pool);
+ ctx, scratch_pool);
if (use_sleep)
- svn_io_sleep_for_timestamps(target_wcpath, pool);
+ svn_io_sleep_for_timestamps(target_abspath, scratch_pool);
if (err)
return svn_error_return(err);
- /* Shutdown the administrative session. */
- return svn_wc_adm_close2(adm_access, pool);
+ return SVN_NO_ERROR;
}
+struct merge_reintegrate_baton {
+ const char *source;
+ const svn_opt_revision_t *peg_revision;
+ const char *target_abspath;
+ svn_boolean_t dry_run;
+ const apr_array_header_t *merge_options;
+ svn_client_ctx_t *ctx;
+};
+
+/* Implements svn_wc__with_write_lock_func_t. */
+static svn_error_t *
+merge_reintegrate_cb(void *baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct merge_reintegrate_baton *b = baton;
+
+ SVN_ERR(merge_reintegrate_locked(b->source, b->peg_revision,
+ b->target_abspath, b->dry_run,
+ b->merge_options, b->ctx,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_client_merge_reintegrate(const char *source,
+ const svn_opt_revision_t *peg_revision,
+ const char *target_wcpath,
+ svn_boolean_t dry_run,
+ const apr_array_header_t *merge_options,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ const char *target_abspath, *lock_abspath;
+ struct merge_reintegrate_baton baton;
+
+ SVN_ERR(get_target_and_lock_abspath(&target_abspath, &lock_abspath,
+ target_wcpath, ctx, pool));
+
+ baton.source = source;
+ baton.peg_revision = peg_revision;
+ baton.target_abspath = target_abspath;
+ baton.dry_run = dry_run;
+ baton.merge_options = merge_options;
+ baton.ctx = ctx;
+
+ SVN_ERR(svn_wc__call_with_write_lock(merge_reintegrate_cb, &baton,
+ ctx->wc_ctx, lock_abspath, pool, pool));
+ return SVN_NO_ERROR;
+}
static svn_error_t *