Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/copy.c view on Meta::CPAN
svn_client__copy_pair_t *);
svn_node_kind_t dst_kind, dst_parent_kind;
svn_pool_clear(iterpool);
/* If DST_PATH does not exist, then its basename will become a new
file or dir added to its parent (possibly an implicit '.').
Else, just error out. */
SVN_ERR(svn_wc_read_kind2(&dst_kind, ctx->wc_ctx,
pair->dst_abspath_or_url,
FALSE /* show_deleted */,
TRUE /* show_hidden */,
iterpool));
if (dst_kind != svn_node_none)
{
svn_boolean_t is_excluded;
svn_boolean_t is_server_excluded;
SVN_ERR(svn_wc__node_is_not_present(NULL, &is_excluded,
&is_server_excluded, ctx->wc_ctx,
pair->dst_abspath_or_url, FALSE,
iterpool));
if (is_excluded || is_server_excluded)
{
return svn_error_createf(
SVN_ERR_WC_OBSTRUCTED_UPDATE,
NULL, _("Path '%s' exists, but is excluded"),
svn_dirent_local_style(pair->dst_abspath_or_url, iterpool));
}
else
return svn_error_createf(
SVN_ERR_ENTRY_EXISTS, NULL,
_("Path '%s' already exists"),
svn_dirent_local_style(pair->dst_abspath_or_url,
scratch_pool));
}
/* Check that there is no unversioned obstruction */
if (metadata_only)
dst_kind = svn_node_none;
else
SVN_ERR(svn_io_check_path(pair->dst_abspath_or_url, &dst_kind,
iterpool));
if (dst_kind != svn_node_none)
{
if (is_move
&& copy_pairs->nelts == 1
&& strcmp(svn_dirent_dirname(pair->src_abspath_or_url, iterpool),
svn_dirent_dirname(pair->dst_abspath_or_url,
iterpool)) == 0)
{
const char *dst;
char *dst_apr;
apr_status_t apr_err;
/* We have a rename inside a directory, which might collide
just because the case insensivity of the filesystem makes
the source match the destination. */
SVN_ERR(svn_path_cstring_from_utf8(&dst,
pair->dst_abspath_or_url,
scratch_pool));
apr_err = apr_filepath_merge(&dst_apr, NULL, dst,
APR_FILEPATH_TRUENAME, iterpool);
if (!apr_err)
{
/* And now bring it back to our canonical format */
SVN_ERR(svn_path_cstring_to_utf8(&dst, dst_apr, iterpool));
dst = svn_dirent_canonicalize(dst, iterpool);
}
/* else: Don't report this error; just report the normal error */
if (!apr_err && strcmp(dst, pair->src_abspath_or_url) == 0)
{
/* Ok, we have a single case only rename. Get out of here */
svn_dirent_split(&pair->dst_parent_abspath, &pair->base_name,
pair->dst_abspath_or_url, result_pool);
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
}
return svn_error_createf(
SVN_ERR_ENTRY_EXISTS, NULL,
_("Path '%s' already exists as unversioned node"),
svn_dirent_local_style(pair->dst_abspath_or_url,
scratch_pool));
}
svn_dirent_split(&pair->dst_parent_abspath, &pair->base_name,
pair->dst_abspath_or_url, result_pool);
/* Make sure the destination parent is a directory and produce a clear
error message if it is not. */
SVN_ERR(svn_wc_read_kind2(&dst_parent_kind,
ctx->wc_ctx, pair->dst_parent_abspath,
FALSE, TRUE,
iterpool));
if (make_parents && dst_parent_kind == svn_node_none)
{
SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath,
TRUE, ctx, iterpool));
}
else if (dst_parent_kind != svn_node_dir)
{
return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
_("Path '%s' is not a directory"),
svn_dirent_local_style(
pair->dst_parent_abspath, scratch_pool));
}
SVN_ERR(svn_io_check_path(pair->dst_parent_abspath,
&dst_parent_kind, scratch_pool));
if (dst_parent_kind != svn_node_dir)
return svn_error_createf(SVN_ERR_WC_MISSING, NULL,
_("Path '%s' is not a directory"),
svn_dirent_local_style(
pair->dst_parent_abspath, scratch_pool));
}
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
static svn_error_t *
( run in 0.711 second using v1.01-cache-2.11-cpan-e93a5daba3e )