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 *pair = APR_ARRAY_IDX(copy_pairs, i,
svn_client__copy_pair_t *);
item = svn_client_commit_item3_create(scratch_pool);
item->url = pair->dst_abspath_or_url;
item->state_flags = SVN_CLIENT_COMMIT_ITEM_ADD;
APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
}
SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
ctx, scratch_pool));
if (! message)
{
svn_pool_destroy(iterpool);
svn_pool_destroy(session_pool);
return SVN_NO_ERROR;
}
}
else
message = "";
cukb.session = ra_session;
SVN_ERR(svn_ra_get_repos_root2(ra_session, &cukb.repos_root_url, session_pool));
cukb.should_reparent = FALSE;
/* Crawl the working copy for commit items. */
/* ### TODO: Pass check_url_func for issue #3314 handling */
SVN_ERR(svn_client__get_copy_committables(&committables,
copy_pairs,
check_url_kind, &cukb,
ctx, scratch_pool, iterpool));
/* The committables are keyed by the repository root */
commit_items = svn_hash_gets(committables->by_repository,
cukb.repos_root_url);
SVN_ERR_ASSERT(commit_items != NULL);
if (cukb.should_reparent)
SVN_ERR(svn_ra_reparent(ra_session, top_dst_url, session_pool));
/* If we are creating intermediate directories, tack them onto the list
of committables. */
if (make_parents)
{
for (i = 0; i < new_dirs->nelts; i++)
{
const char *url = APR_ARRAY_IDX(new_dirs, i, const char *);
svn_client_commit_item3_t *item;
item = svn_client_commit_item3_create(scratch_pool);
item->url = url;
item->state_flags = SVN_CLIENT_COMMIT_ITEM_ADD;
item->incoming_prop_changes = apr_array_make(scratch_pool, 1,
sizeof(svn_prop_t *));
APR_ARRAY_PUSH(commit_items, svn_client_commit_item3_t *) = item;
}
}
/* ### TODO: This extra loop would be unnecessary if this code lived
### in svn_client__get_copy_committables(), which is incidentally
### only used above (so should really be in this source file). */
for (i = 0; i < copy_pairs->nelts; i++)
{
apr_hash_t *mergeinfo, *wc_mergeinfo;
svn_client__copy_pair_t *pair = APR_ARRAY_IDX(copy_pairs, i,
svn_client__copy_pair_t *);
svn_client_commit_item3_t *item =
APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
svn_client__pathrev_t *src_origin;
svn_pool_clear(iterpool);
SVN_ERR(svn_client__wc_node_get_origin(&src_origin,
pair->src_abspath_or_url,
ctx, iterpool, iterpool));
/* Set the mergeinfo for the destination to the combined merge
info known to the WC and the repository. */
item->outgoing_prop_changes = apr_array_make(scratch_pool, 1,
sizeof(svn_prop_t *));
/* Repository mergeinfo (or NULL if it's locally added)... */
if (src_origin)
SVN_ERR(svn_client__get_repos_mergeinfo(
&mergeinfo, ra_session, src_origin->url, src_origin->rev,
svn_mergeinfo_inherited, TRUE /*sqelch_inc.*/, iterpool));
else
mergeinfo = NULL;
/* ... and WC mergeinfo. */
SVN_ERR(svn_client__parse_mergeinfo(&wc_mergeinfo, ctx->wc_ctx,
pair->src_abspath_or_url,
iterpool, iterpool));
if (wc_mergeinfo && mergeinfo)
SVN_ERR(svn_mergeinfo_merge2(mergeinfo, wc_mergeinfo, iterpool,
iterpool));
else if (! mergeinfo)
mergeinfo = wc_mergeinfo;
if (mergeinfo)
{
/* Push a mergeinfo prop representing MERGEINFO onto the
* OUTGOING_PROP_CHANGES array. */
svn_prop_t *mergeinfo_prop
= apr_palloc(item->outgoing_prop_changes->pool,
sizeof(svn_prop_t));
svn_string_t *prop_value;
SVN_ERR(svn_mergeinfo_to_string(&prop_value, mergeinfo,
item->outgoing_prop_changes->pool));
mergeinfo_prop->name = SVN_PROP_MERGEINFO;
mergeinfo_prop->value = prop_value;
APR_ARRAY_PUSH(item->outgoing_prop_changes, svn_prop_t *)
= mergeinfo_prop;
}
}
/* Sort and condense our COMMIT_ITEMS. */
SVN_ERR(svn_client__condense_commit_items(&top_dst_url,
commit_items, scratch_pool));
src/subversion/subversion/libsvn_client/copy.c view on Meta::CPAN
SVN_ERR(svn_ra_get_file(ra_session, src_rel, pair->src_revnum,
new_base_contents,
&pair->src_revnum, &new_props, pool));
if (new_props && ! same_repositories)
svn_hash_sets(new_props, SVN_PROP_MERGEINFO, NULL);
*timestamp_sleep = TRUE;
SVN_ERR(svn_wc_add_repos_file4(
ctx->wc_ctx, dst_abspath,
new_base_contents, NULL, new_props, NULL,
same_repositories ? pair->src_abspath_or_url : NULL,
same_repositories ? pair->src_revnum : SVN_INVALID_REVNUM,
ctx->cancel_func, ctx->cancel_baton,
pool));
}
/* Record the implied mergeinfo (before the notification callback
is invoked for the root node). */
SVN_ERR(svn_client__get_repos_mergeinfo(
&src_mergeinfo, ra_session,
pair->src_abspath_or_url, pair->src_revnum,
svn_mergeinfo_inherited, TRUE /*squelch_incapable*/, pool));
SVN_ERR(extend_wc_mergeinfo(dst_abspath, src_mergeinfo, ctx, pool));
/* Do our own notification for the root node, even if we could possibly
have delegated it. See also issue #1552.
### Maybe this notification should mention the mergeinfo change. */
if (ctx->notify_func2)
{
svn_wc_notify_t *notify = svn_wc_create_notify(
dst_abspath, svn_wc_notify_add, pool);
notify->kind = pair->src_kind;
(*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
}
return SVN_NO_ERROR;
}
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,
svn_boolean_t ignore_externals,
svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
int i;
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. */
{
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);
/* 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);
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);
}
/* Perform the move for each of the copy_pairs. */
for (i = 0; i < copy_pairs->nelts; i++)
{
/* Check for cancellation */
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
svn_pool_clear(iterpool);
SVN_ERR(repos_to_wc_copy_single(timestamp_sleep,
APR_ARRAY_IDX(copy_pairs, i,
svn_client__copy_pair_t *),
same_repositories,
ignore_externals,
ra_session, ctx, iterpool));
}
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
static svn_error_t *
repos_to_wc_copy(svn_boolean_t *timestamp_sleep,
const apr_array_header_t *copy_pairs,
( run in 0.709 second using v1.01-cache-2.11-cpan-524268b4103 )