Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_client/mergeinfo.c view on Meta::CPAN
i.e. if it is NULL then the caller not only walked the entire WC
looking for inherited mergeinfo, but queried the repository if none
was found in the WC. This is rather important since this function
says empty mergeinfo should be elided if PARENT_MERGEINFO is NULL,
and we don't want to do that unless we are *certain* that the empty
mergeinfo on PATH isn't overriding anything.
If PATH_SUFFIX and PARENT_MERGEINFO are not NULL append PATH_SUFFIX
to each path in PARENT_MERGEINFO before performing the comparison. */
static svn_error_t *
should_elide_mergeinfo(svn_boolean_t *elides,
svn_mergeinfo_t parent_mergeinfo,
svn_mergeinfo_t child_mergeinfo,
const char *path_suffix,
apr_pool_t *scratch_pool)
{
/* Easy out: No child mergeinfo to elide. */
if (child_mergeinfo == NULL)
{
*elides = FALSE;
}
else if (apr_hash_count(child_mergeinfo) == 0)
{
/* Empty mergeinfo elides to empty mergeinfo or to "nothing",
i.e. it isn't overriding any parent. Otherwise it doesn't
elide. */
*elides = (!parent_mergeinfo || apr_hash_count(parent_mergeinfo) == 0);
}
else if (!parent_mergeinfo || apr_hash_count(parent_mergeinfo) == 0)
{
/* Non-empty mergeinfo never elides to empty mergeinfo
or no mergeinfo. */
*elides = FALSE;
}
else
{
/* Both CHILD_MERGEINFO and PARENT_MERGEINFO are non-NULL and
non-empty. */
svn_mergeinfo_t path_tweaked_parent_mergeinfo;
/* If we need to adjust the paths in PARENT_MERGEINFO do it now. */
if (path_suffix)
SVN_ERR(svn_mergeinfo__add_suffix_to_mergeinfo(
&path_tweaked_parent_mergeinfo, parent_mergeinfo,
path_suffix, scratch_pool, scratch_pool));
else
path_tweaked_parent_mergeinfo = parent_mergeinfo;
SVN_ERR(svn_mergeinfo__equals(elides,
path_tweaked_parent_mergeinfo,
child_mergeinfo, TRUE, scratch_pool));
}
return SVN_NO_ERROR;
}
/* Helper for svn_client__elide_mergeinfo().
Given a working copy LOCAL_ABSPATH, its mergeinfo hash CHILD_MERGEINFO, and
the mergeinfo of LOCAL_ABSPATH's nearest ancestor PARENT_MERGEINFO, use
should_elide_mergeinfo() to decide whether or not CHILD_MERGEINFO elides to
PARENT_MERGEINFO; PATH_SUFFIX means the same as in that function.
If elision does occur, then remove the mergeinfo for LOCAL_ABSPATH.
If CHILD_MERGEINFO is NULL, do nothing.
Use SCRATCH_POOL for temporary allocations.
*/
static svn_error_t *
elide_mergeinfo(svn_mergeinfo_t parent_mergeinfo,
svn_mergeinfo_t child_mergeinfo,
const char *local_abspath,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
svn_boolean_t elides;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR(should_elide_mergeinfo(&elides,
parent_mergeinfo, child_mergeinfo, NULL,
scratch_pool));
if (elides)
{
SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath, SVN_PROP_MERGEINFO,
NULL, svn_depth_empty, TRUE, NULL,
NULL, NULL /* cancellation */,
NULL, NULL /* notification */,
scratch_pool));
if (ctx->notify_func2)
{
svn_wc_notify_t *notify;
notify = svn_wc_create_notify(local_abspath,
svn_wc_notify_merge_elide_info,
scratch_pool);
ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
notify = svn_wc_create_notify(local_abspath,
svn_wc_notify_update_update,
scratch_pool);
notify->prop_state = svn_wc_notify_state_changed;
ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
}
}
return SVN_NO_ERROR;
}
svn_error_t *
svn_client__elide_mergeinfo(const char *target_abspath,
const char *wc_elision_limit_abspath,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
const char *limit_abspath = wc_elision_limit_abspath;
( run in 1.361 second using v1.01-cache-2.11-cpan-524268b4103 )