Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/copy.c view on Meta::CPAN
SVN_ERR(svn_ra_reparent(cukb->session, url, scratch_pool));
SVN_ERR(svn_ra_check_path(cukb->session, "", revision,
kind, scratch_pool));
}
return SVN_NO_ERROR;
}
/* ### Copy ...
* COMMIT_INFO_P is ...
* COPY_PAIRS is ... such that each 'src_abspath_or_url' is a local abspath
* and each 'dst_abspath_or_url' is a URL.
* MAKE_PARENTS is ...
* REVPROP_TABLE is ...
* CTX is ... */
static svn_error_t *
wc_to_repos_copy(const apr_array_header_t *copy_pairs,
svn_boolean_t make_parents,
const apr_hash_t *revprop_table,
svn_commit_callback2_t commit_callback,
void *commit_baton,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
const char *message;
const char *top_src_path, *top_dst_url;
struct check_url_kind_baton cukb;
const char *top_src_abspath;
svn_ra_session_t *ra_session;
const svn_delta_editor_t *editor;
apr_hash_t *relpath_map = NULL;
void *edit_baton;
svn_client__committables_t *committables;
apr_array_header_t *commit_items;
apr_pool_t *iterpool;
apr_array_header_t *new_dirs = NULL;
apr_hash_t *commit_revprops;
svn_client__copy_pair_t *first_pair;
apr_pool_t *session_pool = svn_pool_create(scratch_pool);
int i;
/* Find the common root of all the source paths */
SVN_ERR(get_copy_pair_ancestors(copy_pairs, &top_src_path, NULL, NULL,
scratch_pool));
/* Do we need to lock the working copy? 1.6 didn't take a write
lock, but what happens if the working copy changes during the copy
operation? */
iterpool = svn_pool_create(scratch_pool);
/* Determine the longest common ancestor for the destinations, and open an RA
session to that location. */
/* ### But why start by getting the _parent_ of the first one? */
/* --- That works because multiple destinations always point to the same
* directory. I'm rather wondering why we need to find a common
* destination parent here at all, instead of simply getting
* top_dst_url from get_copy_pair_ancestors() above?
* It looks like the entire block of code hanging off this comment
* is redundant. */
first_pair = APR_ARRAY_IDX(copy_pairs, 0, svn_client__copy_pair_t *);
top_dst_url = svn_uri_dirname(first_pair->dst_abspath_or_url, scratch_pool);
for (i = 1; i < copy_pairs->nelts; i++)
{
svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
svn_client__copy_pair_t *);
top_dst_url = svn_uri_get_longest_ancestor(top_dst_url,
pair->dst_abspath_or_url,
scratch_pool);
}
SVN_ERR(svn_dirent_get_absolute(&top_src_abspath, top_src_path, scratch_pool));
/* Open a session to help while determining the exact targets */
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_dst_url,
top_src_abspath, NULL,
FALSE /* write_dav_props */,
TRUE /* read_dav_props */,
ctx,
session_pool, session_pool));
/* If requested, determine the nearest existing parent of the destination,
and reparent the ra session there. */
if (make_parents)
{
new_dirs = apr_array_make(scratch_pool, 0, sizeof(const char *));
SVN_ERR(find_absent_parents2(ra_session, &top_dst_url, new_dirs,
scratch_pool));
}
/* Figure out the basename that will result from each copy and check to make
sure it doesn't exist already. */
for (i = 0; i < copy_pairs->nelts; i++)
{
svn_node_kind_t dst_kind;
const char *dst_rel;
svn_client__copy_pair_t *pair =
APR_ARRAY_IDX(copy_pairs, i, svn_client__copy_pair_t *);
svn_pool_clear(iterpool);
dst_rel = svn_uri_skip_ancestor(top_dst_url, pair->dst_abspath_or_url,
iterpool);
SVN_ERR(svn_ra_check_path(ra_session, dst_rel, SVN_INVALID_REVNUM,
&dst_kind, iterpool));
if (dst_kind != svn_node_none)
{
return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
_("Path '%s' already exists"),
pair->dst_abspath_or_url);
}
}
if (SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx))
{
/* Produce a list of new paths to add, and provide it to the
mechanism used to acquire a log message. */
svn_client_commit_item3_t *item;
const char *tmp_file;
commit_items = apr_array_make(scratch_pool, copy_pairs->nelts,
( run in 1.032 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )