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/22 22:14:51 UTC
svn commit: r1847207 - 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: Thu Nov 22 22:14:51 2018
New Revision: 1847207
URL: http://svn.apache.org/viewvc?rev=1847207&view=rev
Log:
Deduplicate the make-parents functionality in 'copy' code.
And the verification that WC target paths are suitable.
* subversion/include/private/svn_client_private.h,
subversion/libsvn_client/copy_foreign.c
(svn_client__copy_foreign): Remove all that functionality, as it was done
already by 'verify_dsts', and remove the 'make_parents' parameter.
* subversion/libsvn_client/copy.c
(svn_client__repos_to_wc_copy_dir): Update the call to ...copy_foreign.
(repos_to_wc_copy): Remove all that functionality; from now on it is going
to have been done already by 'verify_dsts'.
(repos_to_wc_copy_locked): Move the 'verify_dsts' call up from here...
(try_copy): ... to here and let it make missing parents.
* subversion/tests/libsvn_client/client-test.c
(test_foreign_repos_copy): Update calls to ...copy_foreign.
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=1847207&r1=1847206&r2=1847207&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Thu Nov 22 22:14:51 2018
@@ -299,7 +299,6 @@ svn_error_t *
svn_client__copy_foreign(const svn_client__pathrev_t *loc,
const char *dst_abspath,
svn_depth_t depth,
- svn_boolean_t make_parents,
svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1847207&r1=1847206&r2=1847207&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Thu Nov 22 22:14:51 2018
@@ -2377,7 +2377,6 @@ svn_client__repos_to_wc_copy_dir(svn_boo
SVN_ERR(svn_client__copy_foreign(location,
dst_abspath,
svn_depth_infinity,
- FALSE /* make_parents */,
ra_session,
ctx, scratch_pool));
@@ -2656,12 +2655,6 @@ repos_to_wc_copy_locked(svn_boolean_t *t
svn_boolean_t same_repositories;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- /* We've already checked for physical obstruction by a working file.
- But there could also be logical obstruction by an entry whose
- working file happens to be missing.*/
- SVN_ERR(verify_wc_dsts(copy_pairs, FALSE, FALSE, FALSE /* metadata_only */,
- ctx, scratch_pool, iterpool));
-
/* Decide whether the two repositories are the same or not. */
{
const char *parent_abspath;
@@ -2710,7 +2703,6 @@ repos_to_wc_copy_locked(svn_boolean_t *t
static svn_error_t *
repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
const apr_array_header_t *copy_pairs,
- svn_boolean_t make_parents,
svn_boolean_t ignore_externals,
svn_boolean_t pin_externals,
const apr_hash_t *externals_to_pin,
@@ -2764,8 +2756,6 @@ repos_to_wc_copy(svn_boolean_t *timestam
{
svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
svn_client__copy_pair_t *);
- svn_node_kind_t dst_parent_kind, dst_kind;
- const char *dst_parent;
const char *src_rel;
svn_pool_clear(iterpool);
@@ -2789,43 +2779,6 @@ repos_to_wc_copy(svn_boolean_t *timestam
_("Path '%s' not found in head revision"),
pair->src_abspath_or_url);
}
-
- /* Figure out about dst. */
- SVN_ERR(svn_io_check_path(pair->dst_abspath_or_url, &dst_kind,
- iterpool));
- if (dst_kind != svn_node_none)
- {
- return svn_error_createf(
- SVN_ERR_ENTRY_EXISTS, NULL,
- _("Path '%s' already exists"),
- svn_dirent_local_style(pair->dst_abspath_or_url, pool));
- }
-
- /* Make sure the destination parent is a directory and produce a clear
- error message if it is not. */
- dst_parent = svn_dirent_dirname(pair->dst_abspath_or_url, iterpool);
- SVN_ERR(svn_io_check_path(dst_parent, &dst_parent_kind, iterpool));
- if (make_parents && dst_parent_kind == svn_node_none)
- {
- SVN_ERR(svn_client__make_local_parents(dst_parent, TRUE, ctx,
- iterpool));
- }
- else if (make_parents && dst_parent_kind == svn_node_dir)
- {
- SVN_ERR(svn_wc_read_kind2(&dst_parent_kind, ctx->wc_ctx, dst_parent,
- FALSE, TRUE, iterpool));
- if (dst_parent_kind == svn_node_none)
- {
- SVN_ERR(svn_client__make_local_parents(dst_parent, TRUE, ctx,
- iterpool));
- }
- }
- else if (dst_parent_kind != svn_node_dir)
- {
- return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
- _("Path '%s' is not a directory"),
- svn_dirent_local_style(dst_parent, pool));
- }
}
svn_pool_destroy(iterpool);
@@ -3180,9 +3133,13 @@ try_copy(svn_boolean_t *timestamp_sleep,
}
else if ((srcs_are_urls) && (! dst_is_url))
{
+ SVN_ERR(verify_wc_dsts(copy_pairs, make_parents,
+ FALSE, FALSE /* metadata_only */,
+ ctx, pool, pool));
+
return svn_error_trace(
repos_to_wc_copy(timestamp_sleep,
- copy_pairs, make_parents, ignore_externals,
+ copy_pairs, ignore_externals,
pin_externals, externals_to_pin, ctx, pool));
}
else
Modified: subversion/trunk/subversion/libsvn_client/copy_foreign.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy_foreign.c?rev=1847207&r1=1847206&r2=1847207&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy_foreign.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy_foreign.c Thu Nov 22 22:14:51 2018
@@ -106,14 +106,11 @@ svn_error_t *
svn_client__copy_foreign(const svn_client__pathrev_t *loc,
const char *dst_abspath,
svn_depth_t depth,
- svn_boolean_t make_parents,
svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
svn_node_kind_t kind;
- svn_node_kind_t wc_kind;
- const char *dir_abspath;
SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
@@ -127,37 +124,6 @@ svn_client__copy_foreign(const svn_clien
_("'%s' is not a valid location inside a repository"),
loc->url);
- /* The target path must not exist (at least not as a versioned node) */
- SVN_ERR(svn_wc_read_kind2(&wc_kind, ctx->wc_ctx, dst_abspath, FALSE, TRUE,
- scratch_pool));
- if (wc_kind != svn_node_none)
- {
- return svn_error_createf(
- SVN_ERR_ENTRY_EXISTS, NULL,
- _("'%s' is already under version control"),
- svn_dirent_local_style(dst_abspath, scratch_pool));
- }
-
- /* Either the target path's parent must be a versioned directory already
- or we must create it if MAKE_PARENTS is true */
- dir_abspath = svn_dirent_dirname(dst_abspath, scratch_pool);
- SVN_ERR(svn_wc_read_kind2(&wc_kind, ctx->wc_ctx, dir_abspath,
- FALSE, FALSE, scratch_pool));
- if (wc_kind == svn_node_none)
- {
- if (make_parents)
- SVN_ERR(svn_client__make_local_parents(dir_abspath, make_parents, ctx,
- scratch_pool));
-
- SVN_ERR(svn_wc_read_kind2(&wc_kind, ctx->wc_ctx, dir_abspath,
- FALSE, FALSE, scratch_pool));
- }
- if (wc_kind != svn_node_dir)
- return svn_error_createf(
- SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("Can't add '%s', because no parent directory is found"),
- svn_dirent_local_style(dst_abspath, scratch_pool));
-
if (kind == svn_node_file)
{
svn_stream_t *target;
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=1847207&r1=1847206&r2=1847207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Thu Nov 22 22:14:51 2018
@@ -767,7 +767,7 @@ test_foreign_repos_copy(const svn_test_o
SVN_WC__CALL_WITH_WRITE_LOCK(
svn_client__copy_foreign(loc,
svn_dirent_join(wc_path, "A-copied", pool),
- svn_depth_infinity, FALSE,
+ svn_depth_infinity,
ra_session, ctx, pool),
ctx->wc_ctx, wc_path, FALSE, pool);
@@ -775,7 +775,7 @@ test_foreign_repos_copy(const svn_test_o
SVN_WC__CALL_WITH_WRITE_LOCK(
svn_client__copy_foreign(loc,
svn_dirent_join(wc_path, "iota-copied", pool),
- svn_depth_infinity, FALSE,
+ svn_depth_infinity,
ra_session, ctx, pool),
ctx->wc_ctx, wc_path, FALSE, pool);