Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/merge.c view on Meta::CPAN
REVISION1:(N - 1) as-is and set the subset of CHILD->REMAINING_RANGES
that intersects with (N - 1):REVISION2 equal to PARENT->REMAINING_RANGES'
intersection with (N - 1):REVISION2.
If PRIMARY_URL@REVISION1 doesn't exist but PRIMARY_URL@REVISION2 does,
then find the revision 'M' in which PRIMARY_URL@REVISION2 came into
existence. Leave the subset of CHILD->REMAINING_RANGES that intersects with
(M - 1):REVISION2 as-is and set the subset of CHILD->REMAINING_RANGES
that intersects with REVISION1:(M - 1) equal to PARENT->REMAINING_RANGES'
intersection with REVISION1:(M - 1).
For reverse merges (REVISION1 > REVISION2)
If PRIMARY_URL@REVISION1 exists but PRIMARY_URL@REVISION2 doesn't, then
find the revision 'N' in which PRIMARY_URL@REVISION1 came into existence.
Leave the subset of CHILD->REMAINING_RANGES that intersects with
REVISION2:(N - 1) as-is and set the subset of CHILD->REMAINING_RANGES
that intersects with (N - 1):REVISION1 equal to PARENT->REMAINING_RANGES'
intersection with (N - 1):REVISION1.
If PRIMARY_URL@REVISION1 doesn't exist but PRIMARY_URL@REVISION2 does,
then find the revision 'M' in which PRIMARY_URL@REVISION2 came into
existence. Leave the subset of CHILD->REMAINING_RANGES that intersects with
REVISION2:(M - 1) as-is and set the subset of CHILD->REMAINING_RANGES
that intersects with (M - 1):REVISION1 equal to PARENT->REMAINING_RANGES'
intersection with REVISION1:(M - 1).
SCRATCH_POOL is used for all temporary allocations. Changes to CHILD are
allocated in RESULT_POOL. */
static svn_error_t *
adjust_deleted_subtree_ranges(svn_client__merge_path_t *child,
svn_client__merge_path_t *parent,
svn_revnum_t revision1,
svn_revnum_t revision2,
const char *primary_url,
svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_boolean_t is_rollback = revision2 < revision1;
svn_revnum_t younger_rev = is_rollback ? revision1 : revision2;
svn_revnum_t peg_rev = younger_rev;
svn_revnum_t older_rev = is_rollback ? revision2 : revision1;
apr_array_header_t *segments;
svn_error_t *err;
SVN_ERR_ASSERT(parent->remaining_ranges);
err = svn_client__repos_location_segments(&segments, ra_session,
primary_url, peg_rev,
younger_rev, older_rev, ctx,
scratch_pool);
/* If PRIMARY_URL@peg_rev doesn't exist then
svn_client__repos_location_segments() typically returns an
SVN_ERR_FS_NOT_FOUND error, but if it doesn't exist for a
forward merge over ra_neon then we get SVN_ERR_RA_DAV_REQUEST_FAILED.
http://subversion.tigris.org/issues/show_bug.cgi?id=3137 fixed some of
the cases where different RA layers returned different error codes to
signal the "path not found"...but it looks like there is more to do.
### Do we still need to special case for ra_neon (since it no longer
exists)? */
if (err)
{
if (err->apr_err == SVN_ERR_FS_NOT_FOUND
|| err->apr_err == SVN_ERR_RA_DAV_REQUEST_FAILED)
{
/* PRIMARY_URL@peg_rev doesn't exist. Check if PRIMARY_URL@older_rev
exists, if neither exist then the editor can simply ignore this
subtree. */
const char *rel_source_path; /* PRIMARY_URL relative to RA_SESSION */
svn_node_kind_t kind;
svn_error_clear(err);
err = NULL;
SVN_ERR(svn_ra_get_path_relative_to_session(
ra_session, &rel_source_path, primary_url, scratch_pool));
SVN_ERR(svn_ra_check_path(ra_session, rel_source_path,
older_rev, &kind, scratch_pool));
if (kind == svn_node_none)
{
/* Neither PRIMARY_URL@peg_rev nor PRIMARY_URL@older_rev exist,
so there is nothing to merge. Set CHILD->REMAINING_RANGES
identical to PARENT's. */
child->remaining_ranges =
svn_rangelist_dup(parent->remaining_ranges, scratch_pool);
}
else
{
svn_rangelist_t *deleted_rangelist;
svn_revnum_t rev_primary_url_deleted;
/* PRIMARY_URL@older_rev exists, so it was deleted at some
revision prior to peg_rev, find that revision. */
SVN_ERR(svn_ra_get_deleted_rev(ra_session, rel_source_path,
older_rev, younger_rev,
&rev_primary_url_deleted,
scratch_pool));
/* PRIMARY_URL@older_rev exists and PRIMARY_URL@peg_rev doesn't,
so svn_ra_get_deleted_rev() should always find the revision
PRIMARY_URL@older_rev was deleted. */
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(rev_primary_url_deleted));
/* If this is a reverse merge reorder CHILD->REMAINING_RANGES and
PARENT->REMAINING_RANGES so both will work with the
svn_rangelist_* APIs below. */
if (is_rollback)
{
/* svn_rangelist_reverse operates in place so it's safe
to use our scratch_pool. */
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges,
scratch_pool));
SVN_ERR(svn_rangelist_reverse(parent->remaining_ranges,
scratch_pool));
}
( run in 0.537 second using v1.01-cache-2.11-cpan-d7f47b0818f )