summaryrefslogtreecommitdiff
path: root/subversion/libsvn_client/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_client/copy.c')
-rw-r--r--subversion/libsvn_client/copy.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/subversion/libsvn_client/copy.c b/subversion/libsvn_client/copy.c
index af6a75b836985..b2e3a44d797b9 100644
--- a/subversion/libsvn_client/copy.c
+++ b/subversion/libsvn_client/copy.c
@@ -1711,13 +1711,9 @@ repos_to_repos_copy(const apr_array_header_t *copy_pairs,
SVN_ERR(svn_ra_check_path(ra_session, dst_rel, SVN_INVALID_REVNUM,
&dst_kind, pool));
if (dst_kind != svn_node_none)
- {
- const char *path = svn_uri_skip_ancestor(repos_root,
- pair->dst_abspath_or_url,
- pool);
- return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
- _("Path '/%s' already exists"), path);
- }
+ return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+ _("Path '%s' already exists"),
+ pair->dst_abspath_or_url);
/* More info for our INFO structure. */
info->src_path = src_rel; /* May be NULL, if outside RA session scope */
@@ -2433,10 +2429,10 @@ repos_to_wc_copy_single(svn_boolean_t *timestamp_sleep,
*timestamp_sleep = TRUE;
- /* Schedule dst_path for addition in parent, with copy history.
- Don't send any notification here.
- Then remove the temporary checkout's .svn dir in preparation for
- moving the rest of it into the final destination. */
+ /* Schedule dst_path for addition in parent, with copy history.
+ Don't send any notification here.
+ Then remove the temporary checkout's .svn dir in preparation for
+ moving the rest of it into the final destination. */
SVN_ERR(svn_wc_copy3(ctx->wc_ctx, tmp_abspath, dst_abspath,
TRUE /* metadata_only */,
ctx->cancel_func, ctx->cancel_baton,
@@ -2451,7 +2447,7 @@ repos_to_wc_copy_single(svn_boolean_t *timestamp_sleep,
pool));
/* Move the temporary disk tree into place. */
- SVN_ERR(svn_io_file_rename(tmp_abspath, dst_abspath, pool));
+ SVN_ERR(svn_io_file_rename2(tmp_abspath, dst_abspath, FALSE, pool));
}
else
{
@@ -2580,7 +2576,7 @@ repos_to_wc_copy_single(svn_boolean_t *timestamp_sleep,
static svn_error_t *
repos_to_wc_copy_locked(svn_boolean_t *timestamp_sleep,
const apr_array_header_t *copy_pairs,
- const char *top_dst_path,
+ const char *top_dst_abspath,
svn_boolean_t ignore_externals,
svn_boolean_t pin_externals,
const apr_hash_t *externals_to_pin,
@@ -2600,39 +2596,25 @@ repos_to_wc_copy_locked(svn_boolean_t *timestamp_sleep,
/* Decide whether the two repositories are the same or not. */
{
- svn_error_t *src_err, *dst_err;
- const char *parent;
const char *parent_abspath;
const char *src_uuid, *dst_uuid;
/* Get the repository uuid of SRC_URL */
- src_err = svn_ra_get_uuid2(ra_session, &src_uuid, iterpool);
- if (src_err && src_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
- return svn_error_trace(src_err);
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &src_uuid, iterpool));
/* Get repository uuid of dst's parent directory, since dst may
not exist. ### TODO: we should probably walk up the wc here,
in case the parent dir has an imaginary URL. */
if (copy_pairs->nelts == 1)
- parent = svn_dirent_dirname(top_dst_path, scratch_pool);
+ parent_abspath = svn_dirent_dirname(top_dst_abspath, scratch_pool);
else
- parent = top_dst_path;
-
- SVN_ERR(svn_dirent_get_absolute(&parent_abspath, parent, scratch_pool));
- dst_err = svn_client_get_repos_root(NULL /* root_url */, &dst_uuid,
- parent_abspath, ctx,
- iterpool, iterpool);
- if (dst_err && dst_err->apr_err != SVN_ERR_RA_NO_REPOS_UUID)
- return dst_err;
-
- /* If either of the UUIDs are nonexistent, then at least one of
- the repositories must be very old. Rather than punish the
- user, just assume the repositories are different, so no
- copy-history is attempted. */
- if (src_err || dst_err || (! src_uuid) || (! dst_uuid))
- same_repositories = FALSE;
- else
- same_repositories = (strcmp(src_uuid, dst_uuid) == 0);
+ parent_abspath = top_dst_abspath;
+
+ SVN_ERR(svn_client_get_repos_root(NULL /* root_url */, &dst_uuid,
+ parent_abspath, ctx,
+ iterpool, iterpool));
+ /* ### Also check repos_root_url? */
+ same_repositories = (strcmp(src_uuid, dst_uuid) == 0);
}
/* Perform the move for each of the copy_pairs. */
@@ -2668,7 +2650,7 @@ repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
apr_pool_t *pool)
{
svn_ra_session_t *ra_session;
- const char *top_src_url, *top_dst_path;
+ const char *top_src_url, *top_dst_abspath;
apr_pool_t *iterpool = svn_pool_create(pool);
const char *lock_abspath;
int i;
@@ -2693,13 +2675,13 @@ repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
pair->src_abspath_or_url = apr_pstrdup(pool, src);
}
- SVN_ERR(get_copy_pair_ancestors(copy_pairs, &top_src_url, &top_dst_path,
+ SVN_ERR(get_copy_pair_ancestors(copy_pairs, &top_src_url, &top_dst_abspath,
NULL, pool));
- lock_abspath = top_dst_path;
+ lock_abspath = top_dst_abspath;
if (copy_pairs->nelts == 1)
{
top_src_url = svn_uri_dirname(top_src_url, pool);
- lock_abspath = svn_dirent_dirname(top_dst_path, pool);
+ lock_abspath = svn_dirent_dirname(top_dst_abspath, pool);
}
/* Open a repository session to the longest common src ancestor. We do not
@@ -2771,7 +2753,7 @@ repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
SVN_WC__CALL_WITH_WRITE_LOCK(
repos_to_wc_copy_locked(timestamp_sleep,
- copy_pairs, top_dst_path, ignore_externals,
+ copy_pairs, top_dst_abspath, ignore_externals,
pin_externals, externals_to_pin,
ra_session, ctx, pool),
ctx->wc_ctx, lock_abspath, FALSE, pool);