[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r37627 - in trunk/subversion: include libsvn_client libsvn_subr tests/cmdline

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Wed, 6 May 2009 23:58:41 +0200

> -----Original Message-----
> From: Paul T. Burba [mailto:pburba_at_collab.net]
> Sent: woensdag 6 mei 2009 21:44
> To: svn_at_subversion.tigris.org
> Subject: svn commit: r37627 - in trunk/subversion: include
> libsvn_client libsvn_subr tests/cmdline
>
> Author: pburba
> Date: Wed May 6 12:44:15 2009
> New Revision: 37627
>
> Log:
> Make 'svn mergeinfo' consider non-inheritable ranges as merged.
>
> See Issue #3126,
> http://subversion.tigris.org/issues/show_bug.cgi?id=3126#desc5.
>
> * subversion/include/svn_mergeinfo.h
> (svn_mergeinfo_remove, svn_mergeinfo_intersect): Deprecate.
> (svn_mergeinfo_remove2, svn_mergeinfo_intersect2): New.
>
> * subversion/libsvn_client/mergeinfo.c
> (svn_client_mergeinfo_log_merged, svn_client_mergeinfo_log_eligible):
> Consider non-inheritable ranges as merged.
>
> * subversion/libsvn_subr/mergeinfo.c
> (walk_mergeinfo_hash_for_diff): Use dual-pools.
> (svn_mergeinfo_diff): Update call to walk_mergeinfo_hash_for_diff().
> (svn_mergeinfo_remove): Wrap svn_mergeinfo_remove2.
> (svn_mergeinfo_remove2): New.
> (svn_mergeinfo_intersect): Wrap svn_mergeinfo_intersect2.
> (svn_mergeinfo_intersect2): New.
>
> * subversion/tests/cmdline/mergeinfo_tests.py
> (merge_tests.set_up_branch, merge_tests.expected_merge_output):
> Import.
> (non_inheritable_mergeinfo): New test.
> (test_list): Add non_inheritable_mergeinfo.
>
> Modified:
> trunk/subversion/include/svn_mergeinfo.h
> trunk/subversion/libsvn_client/mergeinfo.c
> trunk/subversion/libsvn_subr/mergeinfo.c
> trunk/subversion/tests/cmdline/mergeinfo_tests.py
>
> Modified: trunk/subversion/include/svn_mergeinfo.h
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_mergeinfo
> .h?pathrev=37627&r1=37626&r2=37627
> =======================================================================
> =======
> --- trunk/subversion/include/svn_mergeinfo.h Wed May 6 12:41:45 2009
> (r37626)
> +++ trunk/subversion/include/svn_mergeinfo.h Wed May 6 12:44:15 2009
> (r37627)
> @@ -202,15 +202,33 @@ svn_error_t *
> svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo, svn_mergeinfo_t
> changes,
> apr_pool_t *pool);
>
> -/** Removes @a eraser (the subtrahend) from @a whiteboard (the
> - * minuend), and places the resulting difference in @a *mergeinfo.
> +/** Like svn_mergeinfo_remove2, but always considers inheritance.
> *
> - * @since New in 1.5.
> + * @deprecated Provided for backward compatibility with the 1.5 API.
> */
> svn_error_t *
> svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t
> eraser,

Usually we leave the since, and add for compatibility with 1.6. (This keeps
the information on when the function was introduced and when it was
deprecated)

> svn_mergeinfo_t whiteboard, apr_pool_t *pool);
>
> +/** Removes @a eraser (the subtrahend) from @a whiteboard (the
> + * minuend), and places the resulting difference in @a *mergeinfo.
> + * Allocates @a *mergeinfo in @a result_pool. Temporary allocations
> + * will be performed in @a scratch_pool.
> + *
> + * @a consider_inheritance determines how to account for the
> inheritability
> + * of the two mergeinfo's ranges when calculating the range
> equivalence,
> + * as described for svn_mergeinfo_diff().
> + *
> + * @since New in 1.7.
> + */
> +svn_error_t *
> +svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo,
> + svn_mergeinfo_t eraser,
> + svn_mergeinfo_t whiteboard,
> + svn_boolean_t consider_inheritance,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +

I'm not sure if we have a policy on this but in most headers I know we place
the new functions above the deprecated versions.

> /** Calculate the delta between two rangelists consisting of @c
> * svn_merge_range_t * elements (sorted in ascending order), @a from
> * and @a to, and place the result in @a *deleted and @a *added
> @@ -267,11 +285,9 @@ svn_rangelist_remove(apr_array_header_t
> svn_boolean_t consider_inheritance,
> apr_pool_t *pool);
>
> -/** Find the intersection of two mergeinfos, @a mergeinfo1 and @a
> - * mergeinfo2, and place the result in @a *mergeinfo, which is
> (deeply)
> - * allocated in @a pool.
> +/** Like svn_mergeinfo_intersect2, but always considers inheritance.
> *
> - * @since New in 1.5.
> + * @deprecated Provided for backward compatibility with the 1.5 API.
> */
> svn_error_t *
> svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
> @@ -279,6 +295,25 @@ svn_mergeinfo_intersect(svn_mergeinfo_t
> svn_mergeinfo_t mergeinfo2,
> apr_pool_t *pool);
>
> +/** Find the intersection of two mergeinfos, @a mergeinfo1 and @a
> + * mergeinfo2, and place the result in @a *mergeinfo, which is
> (deeply)
> + * allocated in @a result_pool. Temporary allocations will be
> performed
> + * in @a scratch_pool.
> + *
> + * @a consider_inheritance determines how to account for the
> inheritability
> + * of the two mergeinfo's ranges when calculating the range
> equivalence,
> + * as described for svn_mergeinfo_diff().
> + *
> + * @since New in 1.5.
> + */
> +svn_error_t *
> +svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo,
> + svn_mergeinfo_t mergeinfo1,
> + svn_mergeinfo_t mergeinfo2,
> + svn_boolean_t consider_inheritance,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> /** Find the intersection of two rangelists consisting of @c
> * svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and
> * place the result in @a *rangelist (which is never @c NULL).
>
> Modified: trunk/subversion/libsvn_client/mergeinfo.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/mergein
> fo.c?pathrev=37627&r1=37626&r2=37627
> =======================================================================
> =======
> --- trunk/subversion/libsvn_client/mergeinfo.c Wed May 6 12:41:45
2009
> (r37626)
> +++ trunk/subversion/libsvn_client/mergeinfo.c Wed May 6 12:44:15
2009
> (r37627)
> @@ -1271,8 +1271,8 @@ svn_client_mergeinfo_log_merged(const ch
> SVN_INVALID_REVNUM,
> SVN_INVALID_REVNUM,
> NULL, NULL, ctx,
> pool));
> - SVN_ERR(svn_mergeinfo_intersect(&mergeinfo, tgt_mergeinfo,
> - source_history, pool));
> + SVN_ERR(svn_mergeinfo_intersect2(&mergeinfo, tgt_mergeinfo,
> + source_history, FALSE, pool,
> pool));
>
> /* Step 3: Now, we iterate over the eligible paths/rangelists to
> find the youngest revision (and its associated path). Because
> @@ -1414,11 +1414,13 @@ svn_client_mergeinfo_log_eligible(const
> SVN_INVALID_REVNUM,
> SVN_INVALID_REVNUM,
> ra_session, NULL, ctx,
> pool));
> - svn_pool_destroy(sesspool);
>
> /* Now, we want to remove from the possible mergeinfo
> (SOURCE_HISTORY) the merges already present in our PATH_OR_URL.
> */
> - SVN_ERR(svn_mergeinfo_remove(&available, mergeinfo, source_history,
> pool));
> + SVN_ERR(svn_mergeinfo_remove2(&available, mergeinfo, source_history,
> + FALSE, pool, sesspool));
> +
> + svn_pool_destroy(sesspool);
>
> /* Step 4: Now, we iterate over the eligible paths/rangelists to
> find the youngest revision (and its associated path). Because
>
> Modified: trunk/subversion/libsvn_subr/mergeinfo.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/mergeinfo
> .c?pathrev=37627&r1=37626&r2=37627
> =======================================================================
> =======
> --- trunk/subversion/libsvn_subr/mergeinfo.c Wed May 6 12:41:45 2009
> (r37626)
> +++ trunk/subversion/libsvn_subr/mergeinfo.c Wed May 6 12:44:15 2009
> (r37627)
> @@ -999,12 +999,13 @@ mergeinfo_hash_diff_cb(const void *key,
>
> /* Record deletions and additions of entire range lists (by path
> presence), and delegate to svn_rangelist_diff() for delta
> - calculations on a specific path. */
> + calculations on a specific path. */
> static svn_error_t *
> walk_mergeinfo_hash_for_diff(svn_mergeinfo_t from, svn_mergeinfo_t to,
> svn_mergeinfo_t deleted, svn_mergeinfo_t
> added,
> svn_boolean_t consider_inheritance,
> - apr_pool_t *pool)
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> {
> struct mergeinfo_diff_baton mdb;
> mdb.from = from;
> @@ -1012,9 +1013,9 @@ walk_mergeinfo_hash_for_diff(svn_mergein
> mdb.deleted = deleted;
> mdb.added = added;
> mdb.consider_inheritance = consider_inheritance;
> - mdb.pool = pool;
> + mdb.pool = result_pool;
>
> - return svn_hash_diff(from, to, mergeinfo_hash_diff_cb, &mdb, pool);
> + return svn_hash_diff(from, to, mergeinfo_hash_diff_cb, &mdb,
> scratch_pool);
> }
>
> svn_error_t *
> @@ -1041,7 +1042,8 @@ svn_mergeinfo_diff(svn_mergeinfo_t *dele
> if (from && to)
> {
> SVN_ERR(walk_mergeinfo_hash_for_diff(from, to, *deleted,
> *added,
> - consider_inheritance,
> pool));
> + consider_inheritance,
> pool,
> + pool));
> }
> }
>
> @@ -1130,9 +1132,21 @@ svn_mergeinfo_intersect(svn_mergeinfo_t
> svn_mergeinfo_t mergeinfo2,
> apr_pool_t *pool)
> {
> + return svn_mergeinfo_intersect2(mergeinfo, mergeinfo1, mergeinfo2,
> + TRUE, pool, pool);
> +}
> +
> +svn_error_t *
> +svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo,
> + svn_mergeinfo_t mergeinfo1,
> + svn_mergeinfo_t mergeinfo2,
> + svn_boolean_t consider_ineheritance,

s/ineheritance/inheritance/

> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> apr_hash_index_t *hi;
>
> - *mergeinfo = apr_hash_make(pool);
> + *mergeinfo = apr_hash_make(result_pool);
>
> /* ### TODO(reint): Do we care about the case when a path in one
> ### mergeinfo hash has inheritable mergeinfo, and in the other
> @@ -1152,11 +1166,13 @@ svn_mergeinfo_intersect(svn_mergeinfo_t
> {
> SVN_ERR(svn_rangelist_intersect(&rangelist,
> (apr_array_header_t *) val,
> - rangelist, TRUE, pool));
> + rangelist,
> consider_ineheritance,
> + scratch_pool));
> if (rangelist->nelts > 0)
> apr_hash_set(*mergeinfo,
> - apr_pstrdup(pool, path),
> - APR_HASH_KEY_STRING, rangelist);
> + apr_pstrdup(result_pool, path),
> + APR_HASH_KEY_STRING,
> + svn_rangelist_dup(rangelist, result_pool));
> }
> }
> return SVN_NO_ERROR;
> @@ -1166,9 +1182,22 @@ svn_error_t *
> svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t
> eraser,
> svn_mergeinfo_t whiteboard, apr_pool_t *pool)
> {
> - *mergeinfo = apr_hash_make(pool);
> + return svn_mergeinfo_remove2(mergeinfo, eraser, whiteboard, TRUE,
> pool,
> + pool);
> +}
> +
> +svn_error_t *
> +svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo,
> + svn_mergeinfo_t eraser,
> + svn_mergeinfo_t whiteboard,
> + svn_boolean_t consider_ineritance,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + *mergeinfo = apr_hash_make(result_pool);
> return walk_mergeinfo_hash_for_diff(whiteboard, eraser, *mergeinfo,
> NULL,
> - TRUE, pool);
> + consider_ineritance,
> result_pool,
> + scratch_pool);
> }
>
> svn_error_t *

The deprecated variants could be moved to deprecated.c, but that is an
unrelated change/

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2085332
Received on 2009-05-06 23:59:03 CEST

This is an archived mail posted to the Subversion Dev mailing list.