You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/11/10 15:37:01 UTC
svn commit: r1713647 - in
/subversion/branches/move-tracking-2/subversion/svnmover: merge3.c
svnmover.c svnmover.h
Author: julianfoad
Date: Tue Nov 10 14:37:01 2015
New Revision: 1713647
URL: http://svn.apache.org/viewvc?rev=1713647&view=rev
Log:
On the 'move-tracking-2' branch: Tweak a work-around for strange behaviour
of APR functions apr_hash_overlay() and apr_hash_merge().
* subversion/svnmover/svnmover.h
(hash_overlay,
hash_merge): New macros.
* subversion/svnmover/merge3.c
(element_differences,
branch_merge_subtree_r):): s/apr_hash_overlay/hash_overlay/.
* subversion/svnmover/svnmover.c
(element_differences,
get_union_of_subbranches,
subtree_diff_r): s/apr_hash_overlay/hash_overlay/.
(commit,
execute): Remove the old work-around.
Modified:
subversion/branches/move-tracking-2/subversion/svnmover/merge3.c
subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
subversion/branches/move-tracking-2/subversion/svnmover/svnmover.h
Modified: subversion/branches/move-tracking-2/subversion/svnmover/merge3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/merge3.c?rev=1713647&r1=1713646&r2=1713647&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/merge3.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/merge3.c Tue Nov 10 14:37:01 2015
@@ -82,8 +82,7 @@ element_differences(apr_hash_t **diff_p,
right->eid));*/
for (SVN_HASH_ITER(hi, scratch_pool,
- apr_hash_overlay(scratch_pool,
- left->e_map, right->e_map)))
+ hash_overlay(left->e_map, right->e_map)))
{
int e = svn_int_hash_this_key(hi->apr_hi);
svn_element_content_t *element_left
@@ -969,12 +968,10 @@ branch_merge_subtree_r(svn_branch_txn_t
scratch_pool));
SVN_ERR(svn_branch_state_get_elements(yca->branch, &yca_elements,
scratch_pool));
- all_elements = apr_hash_overlay(scratch_pool,
- src_elements->e_map,
- tgt_elements->e_map);
- all_elements = apr_hash_overlay(scratch_pool,
- yca_elements->e_map,
- all_elements);
+ all_elements = hash_overlay(src_elements->e_map,
+ tgt_elements->e_map);
+ all_elements = hash_overlay(yca_elements->e_map,
+ all_elements);
for (SVN_HASH_ITER_SORTED(pi, all_elements,
sort_compare_items_by_eid, scratch_pool))
{
Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1713647&r1=1713646&r2=1713647&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Tue Nov 10 14:37:01 2015
@@ -333,8 +333,7 @@ element_differences(apr_hash_t **diff_p,
right->eid));*/
for (SVN_HASH_ITER(hi, scratch_pool,
- apr_hash_overlay(scratch_pool,
- left->e_map, right->e_map)))
+ hash_overlay(left->e_map, right->e_map)))
{
int e = svn_int_hash_this_key(hi->apr_hi);
svn_element_content_t *element_left
@@ -508,8 +507,7 @@ get_union_of_subbranches(apr_hash_t **al
svn_branch_root_eid(right_branch),
result_pool));
all_subbranches
- = left_branch ? apr_hash_overlay(result_pool,
- s_left->subbranches, s_right->subbranches)
+ = left_branch ? hash_overlay(s_left->subbranches, s_right->subbranches)
: s_right->subbranches;
*all_subbranches_p = all_subbranches;
@@ -1650,8 +1648,7 @@ subtree_diff_r(svn_branch_subtree_t *lef
/* recurse into each subbranch that exists in LEFT and/or in RIGHT */
subbranches_l = left ? left->subbranches : apr_hash_make(scratch_pool);
subbranches_r = right ? right->subbranches : apr_hash_make(scratch_pool);
- subbranches_all = apr_hash_overlay(scratch_pool,
- subbranches_l, subbranches_r);
+ subbranches_all = hash_overlay(subbranches_l, subbranches_r);
for (hi = apr_hash_first(scratch_pool, subbranches_all);
hi; hi = apr_hash_next(hi))
@@ -2415,8 +2412,6 @@ commit(svn_revnum_t *new_rev_p,
apr_hash_t *revprops,
apr_pool_t *scratch_pool)
{
- apr_pool_t *subpool;
-
if (svnmover_any_conflicts(wc->conflicts))
{
return svn_error_createf(SVN_ERR_BRANCHING, NULL,
@@ -2428,9 +2423,7 @@ commit(svn_revnum_t *new_rev_p,
SVN_ERR(svn_branch_txn_sequence_point(wc->edit_txn, scratch_pool));
/* Just as in execute() the pool must be a subpool of wc->pool. */
- subpool = svn_pool_create(wc->pool);
- SVN_ERR(wc_commit(new_rev_p, wc, revprops, subpool));
- svn_pool_destroy(subpool);
+ SVN_ERR(wc_commit(new_rev_p, wc, revprops, wc->pool));
return SVN_NO_ERROR;
}
@@ -2689,12 +2682,7 @@ execute(svnmover_wc_t *wc,
apr_pool_t *pool)
{
const char *base_relpath;
- /* This pool is passed to svn_branch_merge() and needs to be a
- subpool of the pool used to allocate the e_map members of the
- data passed to the function. The pool relationship is required
- by apr_hash_overlay() to guarantee the lifetime of the resulting
- hash. */
- apr_pool_t *iterpool = svn_pool_create(wc->pool);
+ apr_pool_t *iterpool = svn_pool_create(pool);
int i;
base_relpath = svn_uri_skip_ancestor(wc->repos_root_url, anchor_url, pool);
Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.h?rev=1713647&r1=1713646&r2=1713647&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.h (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.h Tue Nov 10 14:37:01 2015
@@ -37,6 +37,22 @@ extern "C" {
#endif /* __cplusplus */
+/* Like apr_hash_overlay() and apr_hash_merge() except allocating the
+ * result in the pool of the first input hash (OVERLAY and H1 respectively).
+ *
+ * When APR pool debugging is enabled, these functions require that the
+ * result pool does not have greater lifetime than the inputs, so passing
+ * an arbitrary result pool doesn't work well.
+ *
+ * If the second hash's pool has a shorter lifetime than that of the first,
+ * you're out of luck.
+ */
+#define hash_overlay(overlay, base) \
+ apr_hash_overlay(apr_hash_pool_get(overlay), overlay, base)
+#define hash_merge(overlay, h1) \
+ apr_hash_merge(apr_hash_pool_get(overlay), h1, h2, merger, data)
+
+
/* Print a verbose notification: in 'quiet' mode, don't print it. */
__attribute__((format(printf, 1, 2)))
void