]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/include/svn_mergeinfo.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / include / svn_mergeinfo.h
1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_mergeinfo.h
24  * @brief mergeinfo handling and processing
25  */
26
27
28 #ifndef SVN_MERGEINFO_H
29 #define SVN_MERGEINFO_H
30
31 #include <apr_pools.h>
32 #include <apr_tables.h>  /* for apr_array_header_t */
33 #include <apr_hash.h>
34
35 #include "svn_types.h"
36 #include "svn_string.h"  /* for svn_string_t */
37
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42
43 /** Overview of the @c SVN_PROP_MERGEINFO property.
44  *
45  * Merge history is stored in the @c SVN_PROP_MERGEINFO property of files
46  * and directories.  The @c SVN_PROP_MERGEINFO property on a path stores the
47  * complete list of changes merged to that path, either directly or via the
48  * path's parent, grand-parent, etc..  A path may have empty mergeinfo which
49  * means that nothing has been merged to that path or all previous merges
50  * to the path were reversed.  Note that a path may have no mergeinfo, this
51  * is not the same as empty mergeinfo.
52  *
53  * Every path in a tree may have @c SVN_PROP_MERGEINFO set, but if the
54  * @c SVN_PROP_MERGEINFO for a path is equivalent to the
55  * @c SVN_PROP_MERGEINFO for its parent, then the @c SVN_PROP_MERGEINFO on
56  * the path will 'elide' (be removed) from the path as a post step to any
57  * merge.  If a path's parent does not have any @c SVN_PROP_MERGEINFO set,
58  * the path's mergeinfo can elide to its nearest grand-parent,
59  * great-grand-parent, etc. that has equivalent @c SVN_PROP_MERGEINFO set
60  * on it.
61  *
62  * If a path has no @c SVN_PROP_MERGEINFO of its own, it inherits mergeinfo
63  * from its nearest parent that has @c SVN_PROP_MERGEINFO set.  The
64  * exception to this is @c SVN_PROP_MERGEINFO with non-inheritable revision
65  * ranges.  These non-inheritable ranges apply only to the path which they
66  * are set on.
67  *
68  * Due to Subversion's allowance for mixed revision working copies, both
69  * elision and inheritance within the working copy presume the path
70  * between a path and its nearest parent with mergeinfo is at the same
71  * working revision.  If this is not the case then neither inheritance nor
72  * elision can occur.
73  *
74  * The value of the @c SVN_PROP_MERGEINFO property is either an empty string
75  * (representing empty mergeinfo) or a non-empty string consisting of
76  * a path, a colon, and comma separated revision list, containing one or more
77  * revision or revision ranges. Revision range start and end points are
78  * separated by "-".  Revisions and revision ranges may have the optional
79  * @c SVN_MERGEINFO_NONINHERITABLE_STR suffix to signify a non-inheritable
80  * revision/revision range.
81  *
82  * @c SVN_PROP_MERGEINFO Value Grammar:
83  *
84  *   Token             Definition
85  *   -----             ----------
86  *   revisionrange     REVISION1 "-" REVISION2
87  *   revisioneelement  (revisionrange | REVISION)"*"?
88  *   rangelist         revisioneelement (COMMA revisioneelement)*
89  *   revisionline      PATHNAME COLON rangelist
90  *   top               "" | (revisionline (NEWLINE revisionline))*
91  *
92  * The PATHNAME is the source of a merge and the rangelist the revision(s)
93  * merged to the path @c SVN_PROP_MERGEINFO is set on directly or indirectly
94  * via inheritance.  PATHNAME must always exist at the specified rangelist
95  * and thus a single merge may result in multiple revisionlines if the source
96  * was renamed.
97  *
98  * Rangelists must be sorted from lowest to highest revision and cannot
99  * contain overlapping revisionlistelements.  REVISION1 must be less than
100  * REVISION2.  Consecutive single revisions that can be represented by a
101  * revisionrange are allowed however (e.g. '5,6,7,8,9-12' or '5-12' are
102  * both acceptable).
103  */
104
105 /** Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given
106    range is non-inheritable. */
107 #define SVN_MERGEINFO_NONINHERITABLE_STR "*"
108
109 /** Terminology for data structures that contain mergeinfo.
110  *
111  * Subversion commonly uses several data structures to represent
112  * mergeinfo in RAM:
113  *
114  * (a) Strings (@c svn_string_t *) containing "unparsed mergeinfo".
115  *
116  * (b) @c svn_rangelist_t, called a "rangelist".
117  *
118  * (c) @c svn_mergeinfo_t, called "mergeinfo".
119  *
120  * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog".
121  *
122  * Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just
123  * typedefs for @c apr_hash_t *; there is no static type-checking, and
124  * you still use standard @c apr_hash_t functions to interact with
125  * them.
126  */
127
128 /** An array of non-overlapping merge ranges (@c svn_merge_range_t *),
129  * sorted as said by @c svn_sort_compare_ranges().  An empty range list is
130  * represented by an empty array.
131  *
132  * Unless specifically noted otherwise, all APIs require rangelists that
133  * describe only forward ranges, i.e. the range's start revision is less
134  * than its end revision. */
135 typedef apr_array_header_t svn_rangelist_t;
136
137 /** A hash mapping merge source paths to non-empty rangelist arrays.
138  *
139  * The keys are (@c const char *) absolute paths from the repository root,
140  * starting with slashes. A @c NULL hash represents no mergeinfo and an
141  * empty hash represents empty mergeinfo. */
142 typedef apr_hash_t *svn_mergeinfo_t;
143
144 /** A hash mapping paths (@c const char *) to @c svn_mergeinfo_t.
145  *
146  * @note While the keys of #svn_mergeinfo_t are always absolute from the
147  * repository root, the keys of a catalog may be relative to something
148  * else, such as an RA session root.
149  * */
150 typedef apr_hash_t *svn_mergeinfo_catalog_t;
151
152 /** Parse the mergeinfo from @a input into @a *mergeinfo.  If no
153  * mergeinfo is available, return an empty mergeinfo (never @c NULL).
154  *
155  * If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO
156  * property, contains overlapping revision ranges of differing
157  * inheritability, or revision ranges with a start revision greater
158  * than or equal to its end revision, or contains paths mapped to empty
159  * revision ranges, then return  @c SVN_ERR_MERGEINFO_PARSE_ERROR.
160  * Unordered revision ranges are  allowed, but will be sorted when
161  * placed into @a *mergeinfo.  Overlapping revision ranges of the same
162  * inheritability are also allowed, but will be combined into a single
163  * range when placed into @a *mergeinfo.
164  *
165  * @a input may contain relative merge source paths, but these are
166  * converted to absolute paths in @a *mergeinfo.
167  *
168  * Allocate the result deeply in @a pool. Also perform temporary
169  * allocations in @a pool.
170  *
171  * @since New in 1.5.
172  */
173 svn_error_t *
174 svn_mergeinfo_parse(svn_mergeinfo_t *mergeinfo, const char *input,
175                     apr_pool_t *pool);
176
177 /** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto
178  * (either or both of which may be @c NULL meaning an empty mergeinfo).
179  * Place the result in @a *deleted and @a *added (neither output argument
180  * may be @c NULL), both allocated in @a result_pool.  The resulting
181  * @a *deleted and @a *added will not be null.
182  *
183  * @a consider_inheritance determines how the rangelists in the two
184  * hashes are compared for equality.  If @a consider_inheritance is FALSE,
185  * then the start and end revisions of the @c svn_merge_range_t's being
186  * compared are the only factors considered when determining equality.
187  *
188  *  e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5'
189  *
190  * If @a consider_inheritance is TRUE, then the inheritability of the
191  * @c svn_merge_range_t's is also considered and must be the same for two
192  * otherwise identical ranges to be judged equal.
193  *
194  *  e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5'
195  *       '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5'
196  *       '/trunk: 1,3-4,5'  == '/trunk: 1,3-4,5'
197  *
198  * @since New in 1.8.
199  */
200 svn_error_t *
201 svn_mergeinfo_diff2(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
202                     svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
203                     svn_boolean_t consider_inheritance,
204                     apr_pool_t *result_pool,
205                     apr_pool_t *scratch_pool);
206
207 /** Similar to svn_mergeinfo_diff2(), but users only one pool.
208  *
209  * @deprecated Provided for backward compatibility with the 1.7 API.
210  * @since New in 1.5.
211  */
212 SVN_DEPRECATED
213 svn_error_t *
214 svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
215                    svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
216                    svn_boolean_t consider_inheritance,
217                    apr_pool_t *pool);
218
219 /** Merge a shallow copy of one mergeinfo, @a changes, into another mergeinfo
220  * @a mergeinfo.
221  *
222  * Rangelists for merge source paths common to @a changes and @a mergeinfo may
223  * result in new rangelists; these are allocated in @a result_pool.
224  * Temporary allocations are made in @a scratch_pool.
225  *
226  * When intersecting rangelists for a path are merged, the inheritability of
227  * the resulting svn_merge_range_t depends on the inheritability of the
228  * operands.  If two non-inheritable ranges are merged the result is always
229  * non-inheritable, in all other cases the resulting range is inheritable.
230  *
231  *  e.g. '/A: 1,3-4'  merged with '/A: 1,3,4*,5' --> '/A: 1,3-5'
232  *       '/A: 1,3-4*' merged with '/A: 1,3,4*,5' --> '/A: 1,3,4*,5'
233  *
234  * @since New in 1.8.
235  */
236 svn_error_t *
237 svn_mergeinfo_merge2(svn_mergeinfo_t mergeinfo,
238                      svn_mergeinfo_t changes,
239                      apr_pool_t *result_pool,
240                      apr_pool_t *scratch_pool);
241
242 /** Like svn_mergeinfo_merge2, but uses only one pool.
243  *
244  * @deprecated Provided for backward compatibility with the 1.5 API.
245  */
246 SVN_DEPRECATED
247 svn_error_t *
248 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo,
249                     svn_mergeinfo_t changes,
250                     apr_pool_t *pool);
251
252 /** Combine one mergeinfo catalog, @a changes_catalog, into another mergeinfo
253  * catalog @a mergeinfo_catalog.  If both catalogs have mergeinfo for the same
254  * key, use svn_mergeinfo_merge() to combine the mergeinfos.
255  *
256  * Additions to @a mergeinfo_catalog are deep copies allocated in
257  * @a result_pool.  Temporary allocations are made in @a scratch_pool.
258  *
259  * @since New in 1.7.
260  */
261 svn_error_t *
262 svn_mergeinfo_catalog_merge(svn_mergeinfo_catalog_t mergeinfo_catalog,
263                             svn_mergeinfo_catalog_t changes_catalog,
264                             apr_pool_t *result_pool,
265                             apr_pool_t *scratch_pool);
266
267 /** Like svn_mergeinfo_remove2, but always considers inheritance.
268  *
269  * @deprecated Provided for backward compatibility with the 1.6 API.
270  */
271 SVN_DEPRECATED
272 svn_error_t *
273 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser,
274                      svn_mergeinfo_t whiteboard, apr_pool_t *pool);
275
276 /** Removes @a eraser (the subtrahend) from @a whiteboard (the
277  * minuend), and places the resulting difference in @a *mergeinfo.
278  * Allocates @a *mergeinfo in @a result_pool.  Temporary allocations
279  * will be performed in @a scratch_pool.
280  *
281  * @a consider_inheritance determines how to account for the inheritability
282  * of the two mergeinfo's ranges when calculating the range equivalence,
283  * as described for svn_mergeinfo_diff().
284  *
285  * @since New in 1.7.
286  */
287 svn_error_t *
288 svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo,
289                       svn_mergeinfo_t eraser,
290                       svn_mergeinfo_t whiteboard,
291                       svn_boolean_t consider_inheritance,
292                       apr_pool_t *result_pool,
293                       apr_pool_t *scratch_pool);
294
295 /** Calculate the delta between two rangelists consisting of @c
296  * svn_merge_range_t * elements (sorted in ascending order), @a from
297  * and @a to, and place the result in @a *deleted and @a *added
298  * (neither output argument will ever be @c NULL).
299  *
300  * @a consider_inheritance determines how to account for the inheritability
301  * of the two rangelist's ranges when calculating the diff,
302  * as described for svn_mergeinfo_diff().
303  *
304  * @since New in 1.5.
305  */
306 svn_error_t *
307 svn_rangelist_diff(svn_rangelist_t **deleted, svn_rangelist_t **added,
308                    const svn_rangelist_t *from, const svn_rangelist_t *to,
309                    svn_boolean_t consider_inheritance,
310                    apr_pool_t *pool);
311
312 /** Merge two rangelists consisting of @c svn_merge_range_t *
313  * elements, @a rangelist and @a changes, placing the results in
314  * @a rangelist. New elements added to @a rangelist are allocated
315  * in @a result_pool. Either rangelist may be empty.
316  *
317  * When intersecting rangelists are merged, the inheritability of
318  * the resulting svn_merge_range_t depends on the inheritability of the
319  * operands: see svn_mergeinfo_merge().
320  *
321  * Note: @a rangelist and @a changes must be sorted as said by @c
322  * svn_sort_compare_ranges().  @a rangelist is guaranteed to remain
323  * in sorted order and be compacted to the minimal number of ranges
324  * needed to represent the merged result.
325  *
326  * If the original rangelist contains non-collapsed adjacent ranges,
327  * the final result is not guaranteed to be compacted either.
328  *
329  * Use @a scratch_pool for temporary allocations.
330  *
331  * @since New in 1.8.
332  */
333 svn_error_t *
334 svn_rangelist_merge2(svn_rangelist_t *rangelist,
335                      const svn_rangelist_t *changes,
336                      apr_pool_t *result_pool,
337                      apr_pool_t *scratch_pool);
338
339 /** Like svn_rangelist_merge2(), but with @a rangelist as an input/output
340  * argument. This function always allocates a new rangelist in @a pool and
341  * returns its result in @a *rangelist. It does not modify @a *rangelist
342  * in place. If not used carefully, this function can use up a lot of memory
343  * if called in a loop.
344  *
345  * It performs an extra adjacent range compaction round to make sure non
346  * collapsed input ranges are compacted in the result.
347  *
348  * @since New in 1.5.
349  * @deprecated Provided for backward compatibility with the 1.7 API.
350  */
351 SVN_DEPRECATED
352 svn_error_t *
353 svn_rangelist_merge(svn_rangelist_t **rangelist,
354                     const svn_rangelist_t *changes,
355                     apr_pool_t *pool);
356
357 /** Removes @a eraser (the subtrahend) from @a whiteboard (the
358  * minuend), and places the resulting difference in @a output.
359  *
360  * Note: @a eraser and @a whiteboard must be sorted as said by @c
361  * svn_sort_compare_ranges().  @a output is guaranteed to be in sorted
362  * order.
363  *
364  * @a consider_inheritance determines how to account for the
365  * @c svn_merge_range_t inheritable field when comparing @a whiteboard's
366  * and @a *eraser's rangelists for equality.  @see svn_mergeinfo_diff().
367  *
368  * Allocate the entire output in @a pool.
369  *
370  * @since New in 1.5.
371  */
372 svn_error_t *
373 svn_rangelist_remove(svn_rangelist_t **output, const svn_rangelist_t *eraser,
374                      const svn_rangelist_t *whiteboard,
375                      svn_boolean_t consider_inheritance,
376                      apr_pool_t *pool);
377
378 /** Find the intersection of two mergeinfos, @a mergeinfo1 and @a
379  * mergeinfo2, and place the result in @a *mergeinfo, which is (deeply)
380  * allocated in @a result_pool.  Temporary allocations will be performed
381  * in @a scratch_pool.
382  *
383  * @a consider_inheritance determines how to account for the inheritability
384  * of the two mergeinfo's ranges when calculating the range equivalence,
385  * @see svn_rangelist_intersect().
386  *
387  * @since New in 1.7.
388  */
389 svn_error_t *
390 svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo,
391                          svn_mergeinfo_t mergeinfo1,
392                          svn_mergeinfo_t mergeinfo2,
393                          svn_boolean_t consider_inheritance,
394                          apr_pool_t *result_pool,
395                          apr_pool_t *scratch_pool);
396
397 /** Like svn_mergeinfo_intersect2, but always considers inheritance.
398  *
399  * @deprecated Provided for backward compatibility with the 1.6 API.
400  */
401 SVN_DEPRECATED
402 svn_error_t *
403 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
404                         svn_mergeinfo_t mergeinfo1,
405                         svn_mergeinfo_t mergeinfo2,
406                         apr_pool_t *pool);
407
408 /** Find the intersection of two rangelists consisting of @c
409  * svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and
410  * place the result in @a *rangelist (which is never @c NULL).
411  *
412  * @a consider_inheritance determines how to account for the inheritability
413  * of the two rangelist's ranges when calculating the intersection,
414  * @see svn_mergeinfo_diff().  If @a consider_inheritance is FALSE then
415  * ranges with different inheritance can intersect, but the resulting
416  * @a *rangelist is non-inheritable only if the corresponding ranges from
417  * both @a rangelist1 and @a rangelist2 are non-inheritable.
418  * If @a consider_inheritance is TRUE, then ranges with different
419  * inheritance can never intersect.
420  *
421  * Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c
422  * svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted
423  * order.
424  *
425  * Allocate the entire output in @a pool.
426  *
427  * @since New in 1.5.
428  */
429 svn_error_t *
430 svn_rangelist_intersect(svn_rangelist_t **rangelist,
431                         const svn_rangelist_t *rangelist1,
432                         const svn_rangelist_t *rangelist2,
433                         svn_boolean_t consider_inheritance,
434                         apr_pool_t *pool);
435
436 /** Reverse @a rangelist, and the @c start and @c end fields of each
437  * range in @a rangelist, in place.
438  *
439  * TODO(miapi): Is this really a valid function?  Rangelists that
440  * aren't sorted, or rangelists containing reverse ranges, are
441  * generally not valid in mergeinfo code.  Can we rewrite the two
442  * places where this is used?
443  *
444  * @since New in 1.5.
445  */
446 svn_error_t *
447 svn_rangelist_reverse(svn_rangelist_t *rangelist, apr_pool_t *pool);
448
449 /** Take an array of svn_merge_range_t *'s in @a rangelist, and convert it
450  * back to a text format rangelist in @a output.  If @a rangelist contains
451  * no elements, sets @a output to the empty string.
452  *
453  * @since New in 1.5.
454  */
455 svn_error_t *
456 svn_rangelist_to_string(svn_string_t **output,
457                         const svn_rangelist_t *rangelist,
458                         apr_pool_t *pool);
459
460 /** Remove non-inheritable or inheritable revision ranges from a rangelist.
461  *
462  * Set @a *inheritable_rangelist to a deep copy of @a rangelist, excluding
463  * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or
464  * excluding all inheritable @c svn_merge_range_t otherwise.
465  *
466  * If @a start and @a end are valid revisions and @a start is less than or
467  * equal to @a end, then exclude only the (non-inheritable or inheritable)
468  * revision ranges that intersect inclusively with the range defined by
469  * @a start and @a end.
470  *
471  * If there are no remaining ranges, return an empty array.
472  *
473  * Allocate the copy in @a result_pool, and use @a scratch_pool for
474  * temporary allocations.
475  *
476  * @since New in 1.7.
477  */
478 svn_error_t *
479 svn_rangelist_inheritable2(svn_rangelist_t **inheritable_rangelist,
480                            const svn_rangelist_t *rangelist,
481                            svn_revnum_t start,
482                            svn_revnum_t end,
483                            svn_boolean_t inheritable,
484                            apr_pool_t *result_pool,
485                            apr_pool_t *scratch_pool);
486
487 /** Like svn_rangelist_inheritable2, but always finds inheritable ranges.
488  *
489  * @since New in 1.5.
490  * @deprecated Provided for backward compatibility with the 1.6 API.
491  */
492 SVN_DEPRECATED
493 svn_error_t *
494 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist,
495                           const svn_rangelist_t *rangelist,
496                           svn_revnum_t start,
497                           svn_revnum_t end,
498                           apr_pool_t *pool);
499
500 /** Remove non-inheritable or inheritable revision ranges from mergeinfo.
501  *
502  * Set @a *inheritable_mergeinfo to a deep copy of @a mergeinfo, excluding
503  * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or
504  * excluding all inheritable @c svn_merge_range_t otherwise.
505  *
506  * If @a start and @a end are valid revisions and @a start is less than or
507  * equal to @a end, then exclude only the (non-inheritable or inheritable)
508  * revisions that intersect inclusively with the range defined by @a start
509  * and @a end.
510  *
511  * If @a path is not NULL remove (non-inheritable or inheritable) ranges
512  * only for @a path.
513  *
514  * If all ranges are removed for a given path then remove that path as well.
515  * If @a mergeinfo is initially empty or all paths are removed from it then
516  * set @a *inheritable_mergeinfo to an empty mergeinfo.
517  *
518  * Allocate the copy in @a result_pool, and use @a scratch_pool for
519  * temporary allocations.
520  *
521  * @since New in 1.7.
522  */
523 svn_error_t *
524 svn_mergeinfo_inheritable2(svn_mergeinfo_t *inheritable_mergeinfo,
525                            svn_mergeinfo_t mergeinfo,
526                            const char *path,
527                            svn_revnum_t start,
528                            svn_revnum_t end,
529                            svn_boolean_t inheritable,
530                            apr_pool_t *result_pool,
531                            apr_pool_t *scratch_pool);
532
533 /** Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo.
534  *
535  * @since New in 1.5.
536  * @deprecated Provided for backward compatibility with the 1.6 API.
537  */
538 SVN_DEPRECATED
539 svn_error_t *
540 svn_mergeinfo_inheritable(svn_mergeinfo_t *inheritable_mergeinfo,
541                           svn_mergeinfo_t mergeinfo,
542                           const char *path,
543                           svn_revnum_t start,
544                           svn_revnum_t end,
545                           apr_pool_t *pool);
546
547 /** Take a mergeinfo in @a mergeinput, and convert it to unparsed
548  *  mergeinfo. Set @a *output to the result, allocated in @a pool.
549  *  If @a input contains no elements, set @a *output to the empty string.
550  *
551  * @a mergeinput may contain relative merge source paths, but these are
552  * converted to absolute paths in @a *output.
553  *
554  * @since New in 1.5.
555 */
556 svn_error_t *
557 svn_mergeinfo_to_string(svn_string_t **output,
558                         svn_mergeinfo_t mergeinput,
559                         apr_pool_t *pool);
560
561 /** Take a hash of mergeinfo in @a mergeinfo, and sort the rangelists
562  * associated with each key (in place).
563  *
564  * TODO(miapi): mergeinfos should *always* be sorted.  This should be
565  * a private function.
566  *
567  * @since New in 1.5
568  */
569 svn_error_t *
570 svn_mergeinfo_sort(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
571
572 /** Return a deep copy of @a mergeinfo_catalog, allocated in @a pool.
573  *
574  * @since New in 1.6.
575  */
576 svn_mergeinfo_catalog_t
577 svn_mergeinfo_catalog_dup(svn_mergeinfo_catalog_t mergeinfo_catalog,
578                           apr_pool_t *pool);
579
580 /** Return a deep copy of @a mergeinfo, allocated in @a pool.
581  *
582  * @since New in 1.5.
583  */
584 svn_mergeinfo_t
585 svn_mergeinfo_dup(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
586
587 /** Return a deep copy of @a rangelist, allocated in @a pool.
588  *
589  * @since New in 1.5.
590  */
591 svn_rangelist_t *
592 svn_rangelist_dup(const svn_rangelist_t *rangelist, apr_pool_t *pool);
593
594
595 /**
596  * The three ways to request mergeinfo affecting a given path.
597  *
598  * @since New in 1.5.
599  */
600 typedef enum svn_mergeinfo_inheritance_t
601 {
602   /** Explicit mergeinfo only. */
603   svn_mergeinfo_explicit,
604
605   /** Explicit mergeinfo, or if that doesn't exist, the inherited
606       mergeinfo from a target's nearest (path-wise, not history-wise)
607       ancestor. */
608   svn_mergeinfo_inherited,
609
610   /** Mergeinfo inherited from a target's nearest (path-wise, not
611       history-wise) ancestor, regardless of whether target has explicit
612       mergeinfo. */
613   svn_mergeinfo_nearest_ancestor
614 } svn_mergeinfo_inheritance_t;
615
616 /** Return a constant string expressing @a inherit as an English word,
617  * i.e., "explicit" (default), "inherited", or "nearest_ancestor".
618  * The string is not localized, as it may be used for client<->server
619  * communications.
620  *
621  * @since New in 1.5.
622  */
623 const char *
624 svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit);
625
626
627 /** Return the appropriate @c svn_mergeinfo_inheritance_t for @a word.
628  * @a word is as returned from svn_inheritance_to_word().  Defaults to
629  * @c svn_mergeinfo_explicit.
630  *
631  * @since New in 1.5.
632  */
633 svn_mergeinfo_inheritance_t
634 svn_inheritance_from_word(const char *word);
635
636
637 #ifdef __cplusplus
638 }
639 #endif /* __cplusplus */
640
641 #endif /* SVN_MERGEINFO_H */