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

[PATCH][MERGE-TRACKING] New function to create a mergeinfo hash out of a single path and single merge-range

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-10-09 12:00:59 CEST

Hi,

    As per http://svn.haxx.se/dev/archive-2006-09/0975.shtml, please find
below an internal function that makes a mergeinfo hash out of a single
path and a single merge-range list.

    I have gone the svn_sort__hash() way of adding a '__' function in a
header file. The other option would have been to create a libsvn_subr
local header file (ala utf_impl.h), but I feel this is an overkill for a
single function.

    Comments suggestions welcome.

    Thanks to Kamesh for pointing out the two different ways to make
internal APIs.

[[[
Abstract construction of a mergeinfo of a single path with single
merge-range
into a separate function.

On the merge-tracking branch:
Patch By: dlr
           madanus

* subversion/include/svn_mergeinfo.h
   (svn_mergeinfo__make): New.

* subversion/libsvn_subr/mergeinfo.c
   (svn_mergeinfo__make): New function to create a mergeinfo, given a single
    path and a single merge-range.
]]]

Regards,
Madan.

Index: subversion/include/svn_mergeinfo.h
===================================================================
--- subversion/include/svn_mergeinfo.h (revision 21841)
+++ subversion/include/svn_mergeinfo.h (working copy)
@@ -47,6 +47,13 @@
 svn_mergeinfo_parse(const char *input, apr_hash_t **mergehash,
                     apr_pool_t *pool);
 
+/** Make a mergeinfo hash for the given @a path, @a start and @a end
+ * revisions.
+ */
+apr_hash_t *
+svn_mergeinfo__make(const char *path, svn_revnum_t start, svn_revnum_t end,
+ apr_pool_t *pool);
+
 /** Calculate the delta between two hashes of merge info, @a mergefrom
  * and @a mergeto, and place the result in @a deleted and @a added
  * (neither output argument will ever be @c NULL), stored as the usual
Index: subversion/libsvn_subr/mergeinfo.c
===================================================================
--- subversion/libsvn_subr/mergeinfo.c (revision 21841)
+++ subversion/libsvn_subr/mergeinfo.c (working copy)
@@ -224,7 +224,24 @@
   return parse_top(&input, input + strlen(input), *hash, pool);
 }
 
+apr_hash_t *
+svn_mergeinfo__make(const char *path, svn_revnum_t start, svn_revnum_t end,
+ apr_pool_t *pool)
+{
+ apr_hash_t *mergeinfo;
+ svn_merge_range_t *range = apr_palloc(pool, sizeof(*range));
+ apr_array_header_t *rangelist = apr_array_make(pool, 1, sizeof(range));
 
+ range->start = start;
+ range->end = end;
+
+ APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = range;
+ mergeinfo = apr_hash_make(pool);
+ apr_hash_set(mergeinfo, path, sizeof(rangelist), rangelist);
+
+ return mergeinfo;
+}
+
 /* Merge two revision lists IN1 and IN2 and place the result in
    OUTPUT. We do some trivial attempts to combine ranges as we go. */
 svn_error_t *

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 9 12:02:12 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.