You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2018/11/12 15:59:39 UTC
svn commit: r1846446 - in /subversion/trunk/subversion:
include/private/svn_client_private.h libsvn_client/copy.c
libsvn_client/copy_foreign.c tests/libsvn_client/client-test.c
Author: julianfoad
Date: Mon Nov 12 15:59:39 2018
New Revision: 1846446
URL: http://svn.apache.org/viewvc?rev=1846446&view=rev
Log:
Simplify svn_client__copy_foreign().
Simplify by requiring the caller to hold a WC write lock. The only real
caller already did, and the test callers now do.
* subversion/include/private/svn_client_private.h
(svn_client__copy_foreign): Remove 'already_locked' parameter, and
document the requirement for a WC write lock.
(svn_client__repos_to_wc_copy_dir): Tweak similar comment in the same way.
* subversion/libsvn_client/copy.c
(repos_to_wc_copy_single): Don't pass that parameter.
* subversion/libsvn_client/copy_foreign.c
(svn_client__copy_foreign): Remove the ability to acquire and release a
WC write lock.
* subversion/tests/libsvn_client/client-test.c
(test_foreign_repos_copy): Acquire and release a write lock here.
Modified:
subversion/trunk/subversion/include/private/svn_client_private.h
subversion/trunk/subversion/libsvn_client/copy.c
subversion/trunk/subversion/libsvn_client/copy_foreign.c
subversion/trunk/subversion/tests/libsvn_client/client-test.c
Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1846446&r1=1846445&r2=1846446&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Mon Nov 12 15:59:39 2018
@@ -289,6 +289,9 @@ svn_client__wc_node_get_origin(svn_clien
*
* If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent
* create missing parent directories
+ *
+ * The caller should be holding a WC write lock that allows DST_ABSPATH to
+ * be created, such as on the parent of DST_ABSPATH.
*/
svn_error_t *
svn_client__copy_foreign(const char *url,
@@ -297,7 +300,6 @@ svn_client__copy_foreign(const char *url
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t make_parents,
- svn_boolean_t already_locked,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
@@ -415,7 +417,8 @@ svn_client__get_diff_summarize_callbacks
/* Copy a directory tree from SRC_URL @ SRC_PEG_REVISION, operative revision
* SRC_OP_REVISION, to DST_ABSPATH in a WC.
*
- * The caller should be holding a WC lock on the parent of dst_abspath.
+ * The caller should be holding a WC write lock that allows DST_ABSPATH to
+ * be created, such as on the parent of DST_ABSPATH.
*
* If RA_SESSION is NOT NULL, it may be used to avoid creating a new
* session. The session may point to a different URL after returning.
Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1846446&r1=1846445&r2=1846446&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Mon Nov 12 15:59:39 2018
@@ -2487,7 +2487,6 @@ repos_to_wc_copy_single(svn_boolean_t *t
&pair->src_op_revision,
svn_depth_infinity,
FALSE /* make_parents */,
- TRUE /* already_locked */,
ctx, pool));
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_client/copy_foreign.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy_foreign.c?rev=1846446&r1=1846445&r2=1846446&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy_foreign.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy_foreign.c Mon Nov 12 15:59:39 2018
@@ -452,7 +452,6 @@ svn_client__copy_foreign(const char *url
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t make_parents,
- svn_boolean_t already_locked,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
@@ -537,37 +536,19 @@ svn_client__copy_foreign(const char *url
}
}
- if (!already_locked)
- SVN_WC__CALL_WITH_WRITE_LOCK(
- svn_wc_add_from_disk3(ctx->wc_ctx, dst_abspath, props,
+ SVN_ERR(svn_wc_add_from_disk3(ctx->wc_ctx, dst_abspath, props,
TRUE /* skip checks */,
ctx->notify_func2, ctx->notify_baton2,
- scratch_pool),
- ctx->wc_ctx, dir_abspath, FALSE, scratch_pool);
- else
- SVN_ERR(svn_wc_add_from_disk3(ctx->wc_ctx, dst_abspath, props,
- TRUE /* skip checks */,
- ctx->notify_func2, ctx->notify_baton2,
- scratch_pool));
+ scratch_pool));
}
else
{
- if (!already_locked)
- SVN_WC__CALL_WITH_WRITE_LOCK(
- copy_foreign_dir(ra_session, loc,
+ SVN_ERR(copy_foreign_dir(ra_session, loc,
ctx->wc_ctx, dst_abspath,
depth,
ctx->notify_func2, ctx->notify_baton2,
ctx->cancel_func, ctx->cancel_baton,
- scratch_pool),
- ctx->wc_ctx, dir_abspath, FALSE, scratch_pool);
- else
- SVN_ERR(copy_foreign_dir(ra_session, loc,
- ctx->wc_ctx, dst_abspath,
- depth,
- ctx->notify_func2, ctx->notify_baton2,
- ctx->cancel_func, ctx->cancel_baton,
- scratch_pool));
+ scratch_pool));
}
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=1846446&r1=1846445&r2=1846446&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Mon Nov 12 15:59:39 2018
@@ -756,19 +756,22 @@ test_foreign_repos_copy(const svn_test_o
SVN_ERR(svn_client_checkout3(NULL, repos_url, wc_path, &peg_rev, &rev,
svn_depth_infinity, FALSE, FALSE, ctx, pool));
- SVN_ERR(svn_client__copy_foreign(svn_path_url_add_component2(repos2_url, "A",
- pool),
- svn_dirent_join(wc_path, "A-copied", pool),
- &peg_rev, &rev, svn_depth_infinity, FALSE, FALSE,
- ctx, pool));
+ SVN_WC__CALL_WITH_WRITE_LOCK(
+ svn_client__copy_foreign(svn_path_url_add_component2(repos2_url, "A",
+ pool),
+ svn_dirent_join(wc_path, "A-copied", pool),
+ &peg_rev, &rev, svn_depth_infinity, FALSE,
+ ctx, pool),
+ ctx->wc_ctx, wc_path, FALSE, pool);
- SVN_ERR(svn_client__copy_foreign(svn_path_url_add_component2(repos2_url,
- "iota",
- pool),
- svn_dirent_join(wc_path, "iota-copied", pool),
- &peg_rev, &rev, svn_depth_infinity, FALSE, FALSE,
- ctx, pool));
+ SVN_WC__CALL_WITH_WRITE_LOCK(
+ svn_client__copy_foreign(svn_path_url_add_component2(repos2_url, "iota",
+ pool),
+ svn_dirent_join(wc_path, "iota-copied", pool),
+ &peg_rev, &rev, svn_depth_infinity, FALSE,
+ ctx, pool),
+ ctx->wc_ctx, wc_path, FALSE, pool);
return SVN_NO_ERROR;
}