3792
3859
younger_rev, older_rev, ctx,
3795
/* If PRIMARY_URL@peg_rev doesn't exist then
3796
svn_client__repos_location_segments() typically returns an
3797
SVN_ERR_FS_NOT_FOUND error, but if it doesn't exist for a
3798
forward merge over ra_neon then we get SVN_ERR_RA_DAV_REQUEST_FAILED.
3799
http://subversion.tigris.org/issues/show_bug.cgi?id=3137 fixed some of
3800
the cases where different RA layers returned different error codes to
3801
signal the "path not found"...but it looks like there is more to do.
3803
### Do we still need to special case for ra_neon (since it no longer
3807
if (err->apr_err == SVN_ERR_FS_NOT_FOUND
3808
|| err->apr_err == SVN_ERR_RA_DAV_REQUEST_FAILED)
3864
const char *rel_source_path; /* PRIMARY_URL relative to RA_SESSION */
3865
svn_node_kind_t kind;
3867
if (err->apr_err != SVN_ERR_FS_NOT_FOUND)
3868
return svn_error_trace(err);
3870
svn_error_clear(err);
3872
/* PRIMARY_URL@peg_rev doesn't exist. Check if PRIMARY_URL@older_rev
3873
exists, if neither exist then the editor can simply ignore this
3876
SVN_ERR(svn_ra_get_path_relative_to_session(
3877
ra_session, &rel_source_path, primary_url, scratch_pool));
3879
SVN_ERR(svn_ra_check_path(ra_session, rel_source_path,
3880
older_rev, &kind, scratch_pool));
3881
if (kind == svn_node_none)
3810
/* PRIMARY_URL@peg_rev doesn't exist. Check if PRIMARY_URL@older_rev
3811
exists, if neither exist then the editor can simply ignore this
3813
const char *rel_source_path; /* PRIMARY_URL relative to RA_SESSION */
3814
svn_node_kind_t kind;
3816
svn_error_clear(err);
3819
SVN_ERR(svn_ra_get_path_relative_to_session(
3820
ra_session, &rel_source_path, primary_url, scratch_pool));
3822
SVN_ERR(svn_ra_check_path(ra_session, rel_source_path,
3823
older_rev, &kind, scratch_pool));
3824
if (kind == svn_node_none)
3826
/* Neither PRIMARY_URL@peg_rev nor PRIMARY_URL@older_rev exist,
3827
so there is nothing to merge. Set CHILD->REMAINING_RANGES
3828
identical to PARENT's. */
3829
child->remaining_ranges =
3830
svn_rangelist_dup(parent->remaining_ranges, scratch_pool);
3834
svn_rangelist_t *deleted_rangelist;
3835
svn_revnum_t rev_primary_url_deleted;
3837
/* PRIMARY_URL@older_rev exists, so it was deleted at some
3838
revision prior to peg_rev, find that revision. */
3839
SVN_ERR(svn_ra_get_deleted_rev(ra_session, rel_source_path,
3840
older_rev, younger_rev,
3841
&rev_primary_url_deleted,
3844
/* PRIMARY_URL@older_rev exists and PRIMARY_URL@peg_rev doesn't,
3845
so svn_ra_get_deleted_rev() should always find the revision
3846
PRIMARY_URL@older_rev was deleted. */
3847
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(rev_primary_url_deleted));
3849
/* If this is a reverse merge reorder CHILD->REMAINING_RANGES and
3850
PARENT->REMAINING_RANGES so both will work with the
3851
svn_rangelist_* APIs below. */
3854
/* svn_rangelist_reverse operates in place so it's safe
3855
to use our scratch_pool. */
3856
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges,
3858
SVN_ERR(svn_rangelist_reverse(parent->remaining_ranges,
3862
/* Find the intersection of CHILD->REMAINING_RANGES with the
3863
range over which PRIMARY_URL@older_rev exists (ending at
3864
the youngest revision at which it still exists). */
3865
SVN_ERR(rangelist_intersect_range(&child->remaining_ranges,
3866
child->remaining_ranges,
3868
rev_primary_url_deleted - 1,
3870
scratch_pool, scratch_pool));
3872
/* Merge into CHILD->REMAINING_RANGES the intersection of
3873
PARENT->REMAINING_RANGES with the range beginning when
3874
PRIMARY_URL@older_rev was deleted until younger_rev. */
3875
SVN_ERR(rangelist_intersect_range(&deleted_rangelist,
3876
parent->remaining_ranges,
3877
rev_primary_url_deleted - 1,
3880
scratch_pool, scratch_pool));
3881
SVN_ERR(svn_rangelist_merge2(child->remaining_ranges,
3882
deleted_rangelist, scratch_pool,
3885
/* Return CHILD->REMAINING_RANGES and PARENT->REMAINING_RANGES
3886
to reverse order if necessary. */
3889
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges,
3891
SVN_ERR(svn_rangelist_reverse(parent->remaining_ranges,
3883
/* Neither PRIMARY_URL@peg_rev nor PRIMARY_URL@older_rev exist,
3884
so there is nothing to merge. Set CHILD->REMAINING_RANGES
3885
identical to PARENT's. */
3886
child->remaining_ranges =
3887
svn_rangelist_dup(parent->remaining_ranges, scratch_pool);
3898
return svn_error_trace(err);
3891
svn_rangelist_t *deleted_rangelist;
3892
svn_revnum_t rev_primary_url_deleted;
3894
/* PRIMARY_URL@older_rev exists, so it was deleted at some
3895
revision prior to peg_rev, find that revision. */
3896
SVN_ERR(svn_ra_get_deleted_rev(ra_session, rel_source_path,
3897
older_rev, younger_rev,
3898
&rev_primary_url_deleted,
3901
/* PRIMARY_URL@older_rev exists and PRIMARY_URL@peg_rev doesn't,
3902
so svn_ra_get_deleted_rev() should always find the revision
3903
PRIMARY_URL@older_rev was deleted. */
3904
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(rev_primary_url_deleted));
3906
/* If this is a reverse merge reorder CHILD->REMAINING_RANGES and
3907
PARENT->REMAINING_RANGES so both will work with the
3908
svn_rangelist_* APIs below. */
3911
/* svn_rangelist_reverse operates in place so it's safe
3912
to use our scratch_pool. */
3913
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges,
3915
SVN_ERR(svn_rangelist_reverse(parent->remaining_ranges,
3919
/* Find the intersection of CHILD->REMAINING_RANGES with the
3920
range over which PRIMARY_URL@older_rev exists (ending at
3921
the youngest revision at which it still exists). */
3922
SVN_ERR(rangelist_intersect_range(&child->remaining_ranges,
3923
child->remaining_ranges,
3925
rev_primary_url_deleted - 1,
3927
scratch_pool, scratch_pool));
3929
/* Merge into CHILD->REMAINING_RANGES the intersection of
3930
PARENT->REMAINING_RANGES with the range beginning when
3931
PRIMARY_URL@older_rev was deleted until younger_rev. */
3932
SVN_ERR(rangelist_intersect_range(&deleted_rangelist,
3933
parent->remaining_ranges,
3934
rev_primary_url_deleted - 1,
3937
scratch_pool, scratch_pool));
3938
SVN_ERR(svn_rangelist_merge2(child->remaining_ranges,
3939
deleted_rangelist, scratch_pool,
3942
/* Return CHILD->REMAINING_RANGES and PARENT->REMAINING_RANGES
3943
to reverse order if necessary. */
3946
SVN_ERR(svn_rangelist_reverse(child->remaining_ranges,
3948
SVN_ERR(svn_rangelist_reverse(parent->remaining_ranges,
3901
3953
else /* PRIMARY_URL@peg_rev exists. */