00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Licensed to the Apache Software Foundation (ASF) under one 00005 * or more contributor license agreements. See the NOTICE file 00006 * distributed with this work for additional information 00007 * regarding copyright ownership. The ASF licenses this file 00008 * to you under the Apache License, Version 2.0 (the 00009 * "License"); you may not use this file except in compliance 00010 * with the License. You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, 00015 * software distributed under the License is distributed on an 00016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00017 * KIND, either express or implied. See the License for the 00018 * specific language governing permissions and limitations 00019 * under the License. 00020 * ==================================================================== 00021 * @endcopyright 00022 * 00023 * @file svn_mergeinfo.h 00024 * @brief mergeinfo handling and processing 00025 */ 00026 00027 00028 #ifndef SVN_MERGEINFO_H 00029 #define SVN_MERGEINFO_H 00030 00031 #include <apr_pools.h> 00032 #include <apr_tables.h> /* for apr_array_header_t */ 00033 #include <apr_hash.h> 00034 00035 #include "svn_types.h" 00036 #include "svn_string.h" /* for svn_string_t */ 00037 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif /* __cplusplus */ 00042 00043 /** Overview of the @c SVN_PROP_MERGEINFO property. 00044 * 00045 * Merge history is stored in the @c SVN_PROP_MERGEINFO property of files 00046 * and directories. The @c SVN_PROP_MERGEINFO property on a path stores the 00047 * complete list of changes merged to that path, either directly or via the 00048 * path's parent, grand-parent, etc.. A path may have empty mergeinfo which 00049 * means that nothing has been merged to that path or all previous merges 00050 * to the path were reversed. Note that a path may have no mergeinfo, this 00051 * is not the same as empty mergeinfo. 00052 * 00053 * Every path in a tree may have @c SVN_PROP_MERGEINFO set, but if the 00054 * @c SVN_PROP_MERGEINFO for a path is equivalent to the 00055 * @c SVN_PROP_MERGEINFO for its parent, then the @c SVN_PROP_MERGEINFO on 00056 * the path will 'elide' (be removed) from the path as a post step to any 00057 * merge. If a path's parent does not have any @c SVN_PROP_MERGEINFO set, 00058 * the path's mergeinfo can elide to its nearest grand-parent, 00059 * great-grand-parent, etc. that has equivalent @c SVN_PROP_MERGEINFO set 00060 * on it. 00061 * 00062 * If a path has no @c SVN_PROP_MERGEINFO of its own, it inherits mergeinfo 00063 * from its nearest parent that has @c SVN_PROP_MERGEINFO set. The 00064 * exception to this is @c SVN_PROP_MERGEINFO with non-inheritable revision 00065 * ranges. These non-inheritable ranges apply only to the path which they 00066 * are set on. 00067 * 00068 * Due to Subversion's allowance for mixed revision working copies, both 00069 * elision and inheritance within the working copy presume the path 00070 * between a path and its nearest parent with mergeinfo is at the same 00071 * working revision. If this is not the case then neither inheritance nor 00072 * elision can occur. 00073 * 00074 * The value of the @c SVN_PROP_MERGEINFO property is either an empty string 00075 * (representing empty mergeinfo) or a non-empty string consisting of 00076 * a path, a colon, and comma separated revision list, containing one or more 00077 * revision or revision ranges. Revision range start and end points are 00078 * separated by "-". Revisions and revision ranges may have the optional 00079 * @c SVN_MERGEINFO_NONINHERITABLE_STR suffix to signify a non-inheritable 00080 * revision/revision range. 00081 * 00082 * @c SVN_PROP_MERGEINFO Value Grammar: 00083 * 00084 * Token Definition 00085 * ----- ---------- 00086 * revisionrange REVISION1 "-" REVISION2 00087 * revisioneelement (revisionrange | REVISION)"*"? 00088 * rangelist revisioneelement (COMMA revisioneelement)* 00089 * revisionline PATHNAME COLON rangelist 00090 * top "" | (revisionline (NEWLINE revisionline))* 00091 * 00092 * The PATHNAME is the source of a merge and the rangelist the revision(s) 00093 * merged to the path @c SVN_PROP_MERGEINFO is set on directly or indirectly 00094 * via inheritance. PATHNAME must always exist at the specified rangelist 00095 * and thus a single merge may result in multiple revisionlines if the source 00096 * was renamed. 00097 * 00098 * Rangelists must be sorted from lowest to highest revision and cannot 00099 * contain overlapping revisionlistelements. REVISION1 must be less than 00100 * REVISION2. Consecutive single revisions that can be represented by a 00101 * revisionrange are allowed however (e.g. '5,6,7,8,9-12' or '5-12' are 00102 * both acceptable). 00103 */ 00104 00105 /* Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given 00106 range is non-inheritable. */ 00107 #define SVN_MERGEINFO_NONINHERITABLE_STR "*" 00108 00109 /** Terminology for data structures that contain mergeinfo. 00110 * 00111 * Subversion commonly uses several data structures to represent 00112 * mergeinfo in RAM: 00113 * 00114 * (a) Strings (@c svn_string_t *) containing "unparsed mergeinfo". 00115 * 00116 * (b) @c svn_rangelist_t, called a "rangelist". An array of non- 00117 * overlapping merge ranges (@c svn_merge_range_t *), sorted as said by 00118 * @c svn_sort_compare_ranges(). An empty range list is represented by 00119 * an empty array. Unless specifically noted otherwise, all APIs require 00120 * rangelists that describe only forward ranges, i.e. the range's start 00121 * revision is less than its end revision. 00122 * 00123 * (c) @c svn_mergeinfo_t, called "mergeinfo". A hash mapping merge 00124 * source paths (@c const char *, starting with slashes) to 00125 * non-empty rangelist arrays. A @c NULL hash is used to represent 00126 * no mergeinfo and an empty hash is used to represent empty 00127 * mergeinfo. 00128 * 00129 * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog". A hash 00130 * mapping paths (@c const char *) to @c svn_mergeinfo_t. 00131 * 00132 * Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just 00133 * typedefs for @c apr_hash_t *; there is no static type-checking, and 00134 * you still use standard @c apr_hash_t functions to interact with 00135 * them. 00136 * 00137 * Note that while the keys of mergeinfos are always absolute from the 00138 * repository root, the keys of a catalog may be relative to something 00139 * else, such as an RA session root. 00140 */ 00141 00142 typedef apr_array_header_t svn_rangelist_t; 00143 typedef apr_hash_t *svn_mergeinfo_t; 00144 typedef apr_hash_t *svn_mergeinfo_catalog_t; 00145 00146 /** Parse the mergeinfo from @a input into @a *mergeinfo. If no 00147 * mergeinfo is available, return an empty mergeinfo (never @c NULL). 00148 * Perform temporary allocations in @a pool. 00149 * 00150 * If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO 00151 * property, contains overlapping revision ranges of differing 00152 * inheritability, or revision ranges with a start revision greater 00153 * than or equal to its end revision, or contains paths mapped to empty 00154 * revision ranges, then return @c SVN_ERR_MERGEINFO_PARSE_ERROR. 00155 * Unordered revision ranges are allowed, but will be sorted when 00156 * placed into @a *mergeinfo. Overlapping revision ranges of the same 00157 * inheritability are also allowed, but will be combined into a single 00158 * range when placed into @a *mergeinfo. 00159 * 00160 * @a input may contain relative merge source paths, but these are 00161 * converted to absolute paths in @a *mergeinfo. 00162 * 00163 * @since New in 1.5. 00164 */ 00165 svn_error_t * 00166 svn_mergeinfo_parse(svn_mergeinfo_t *mergeinfo, const char *input, 00167 apr_pool_t *pool); 00168 00169 /** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto 00170 * (either or both of which may be @c NULL meaning an empty mergeinfo). 00171 * Place the result in @a *deleted and @a *added (neither output argument 00172 * may be @c NULL), both allocated in @a result_pool. The resulting 00173 * @a *deleted and @a *added will not be null. 00174 * 00175 * @a consider_inheritance determines how the rangelists in the two 00176 * hashes are compared for equality. If @a consider_inheritance is FALSE, 00177 * then the start and end revisions of the @c svn_merge_range_t's being 00178 * compared are the only factors considered when determining equality. 00179 * 00180 * e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5' 00181 * 00182 * If @a consider_inheritance is TRUE, then the inheritability of the 00183 * @c svn_merge_range_t's is also considered and must be the same for two 00184 * otherwise identical ranges to be judged equal. 00185 * 00186 * e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5' 00187 * '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5' 00188 * '/trunk: 1,3-4,5' == '/trunk: 1,3-4,5' 00189 * 00190 * @since New in 1.8. 00191 */ 00192 svn_error_t * 00193 svn_mergeinfo_diff2(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, 00194 svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, 00195 svn_boolean_t consider_inheritance, 00196 apr_pool_t *result_pool, 00197 apr_pool_t *scratch_pool); 00198 00199 /** Similar to svn_mergeinfo_diff2(), but users only one pool. 00200 * 00201 * @deprecated Provided for backward compatibility with the 1.7 API. 00202 * @since New in 1.5. 00203 */ 00204 SVN_DEPRECATED 00205 svn_error_t * 00206 svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, 00207 svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, 00208 svn_boolean_t consider_inheritance, 00209 apr_pool_t *pool); 00210 00211 /** Merge a shallow copy of one mergeinfo, @a changes, into another mergeinfo 00212 * @a mergeinfo. 00213 * 00214 * Rangelists for merge source paths common to @a changes and @a mergeinfo may 00215 * result in new rangelists; these are allocated in @a result_pool. 00216 * Temporary allocations are made in @a scratch_pool. 00217 * 00218 * When intersecting rangelists for a path are merged, the inheritability of 00219 * the resulting svn_merge_range_t depends on the inheritability of the 00220 * operands. If two non-inheritable ranges are merged the result is always 00221 * non-inheritable, in all other cases the resulting range is inheritable. 00222 * 00223 * e.g. '/A: 1,3-4' merged with '/A: 1,3,4*,5' --> '/A: 1,3-5' 00224 * '/A: 1,3-4*' merged with '/A: 1,3,4*,5' --> '/A: 1,3,4*,5' 00225 * 00226 * @since New in 1.8. 00227 */ 00228 svn_error_t * 00229 svn_mergeinfo_merge2(svn_mergeinfo_t mergeinfo, 00230 svn_mergeinfo_t changes, 00231 apr_pool_t *result_pool, 00232 apr_pool_t *scratch_pool); 00233 00234 /** Like svn_mergeinfo_merge2, but uses only one pool. 00235 * 00236 * @deprecated Provided for backward compatibility with the 1.5 API. 00237 */ 00238 SVN_DEPRECATED 00239 svn_error_t * 00240 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo, 00241 svn_mergeinfo_t changes, 00242 apr_pool_t *pool); 00243 00244 /** Combine one mergeinfo catalog, @a changes_catalog, into another mergeinfo 00245 * catalog @a mergeinfo_catalog. If both catalogs have mergeinfo for the same 00246 * key, use svn_mergeinfo_merge() to combine the mergeinfos. 00247 * 00248 * Additions to @a mergeinfo_catalog are deep copies allocated in 00249 * @a result_pool. Temporary allocations are made in @a scratch_pool. 00250 * 00251 * @since New in 1.7. 00252 */ 00253 svn_error_t * 00254 svn_mergeinfo_catalog_merge(svn_mergeinfo_catalog_t mergeinfo_catalog, 00255 svn_mergeinfo_catalog_t changes_catalog, 00256 apr_pool_t *result_pool, 00257 apr_pool_t *scratch_pool); 00258 00259 /** Like svn_mergeinfo_remove2, but always considers inheritance. 00260 * 00261 * @deprecated Provided for backward compatibility with the 1.6 API. 00262 */ 00263 SVN_DEPRECATED 00264 svn_error_t * 00265 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser, 00266 svn_mergeinfo_t whiteboard, apr_pool_t *pool); 00267 00268 /** Removes @a eraser (the subtrahend) from @a whiteboard (the 00269 * minuend), and places the resulting difference in @a *mergeinfo. 00270 * Allocates @a *mergeinfo in @a result_pool. Temporary allocations 00271 * will be performed in @a scratch_pool. 00272 * 00273 * @a consider_inheritance determines how to account for the inheritability 00274 * of the two mergeinfo's ranges when calculating the range equivalence, 00275 * as described for svn_mergeinfo_diff(). 00276 * 00277 * @since New in 1.7. 00278 */ 00279 svn_error_t * 00280 svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo, 00281 svn_mergeinfo_t eraser, 00282 svn_mergeinfo_t whiteboard, 00283 svn_boolean_t consider_inheritance, 00284 apr_pool_t *result_pool, 00285 apr_pool_t *scratch_pool); 00286 00287 /** Calculate the delta between two rangelists consisting of @c 00288 * svn_merge_range_t * elements (sorted in ascending order), @a from 00289 * and @a to, and place the result in @a *deleted and @a *added 00290 * (neither output argument will ever be @c NULL). 00291 * 00292 * @a consider_inheritance determines how to account for the inheritability 00293 * of the two rangelist's ranges when calculating the diff, 00294 * as described for svn_mergeinfo_diff(). 00295 * 00296 * @since New in 1.5. 00297 */ 00298 svn_error_t * 00299 svn_rangelist_diff(svn_rangelist_t **deleted, svn_rangelist_t **added, 00300 const svn_rangelist_t *from, const svn_rangelist_t *to, 00301 svn_boolean_t consider_inheritance, 00302 apr_pool_t *pool); 00303 00304 /** Merge two rangelists consisting of @c svn_merge_range_t * 00305 * elements, @a rangelist and @a changes, placing the results in 00306 * @a rangelist. New elements added to @a rangelist are allocated 00307 * in @a result_pool. Either rangelist may be empty. 00308 * 00309 * When intersecting rangelists are merged, the inheritability of 00310 * the resulting svn_merge_range_t depends on the inheritability of the 00311 * operands: see svn_mergeinfo_merge(). 00312 * 00313 * Note: @a rangelist and @a changes must be sorted as said by @c 00314 * svn_sort_compare_ranges(). @a rangelist is guaranteed to remain 00315 * in sorted order and be compacted to the minimal number of ranges 00316 * needed to represent the merged result. 00317 * 00318 * If the original rangelist contains non-collapsed adjacent ranges, 00319 * the final result is not guaranteed to be compacted either. 00320 * 00321 * Use @a scratch_pool for temporary allocations. 00322 * 00323 * @since New in 1.8. 00324 */ 00325 svn_error_t * 00326 svn_rangelist_merge2(svn_rangelist_t *rangelist, 00327 const svn_rangelist_t *changes, 00328 apr_pool_t *result_pool, 00329 apr_pool_t *scratch_pool); 00330 00331 /** Like svn_rangelist_merge2(), but with @a rangelist as an input/output 00332 * argument. This function always allocates a new rangelist in @a pool and 00333 * returns its result in @a *rangelist. It does not modify @a *rangelist 00334 * in place. If not used carefully, this function can use up a lot of memory 00335 * if called in a loop. 00336 * 00337 * It performs an extra adjacent range compaction round to make sure non 00338 * collapsed input ranges are compacted in the result. 00339 * 00340 * @since New in 1.5. 00341 * @deprecated Provided for backward compatibility with the 1.7 API. 00342 */ 00343 SVN_DEPRECATED 00344 svn_error_t * 00345 svn_rangelist_merge(svn_rangelist_t **rangelist, 00346 const svn_rangelist_t *changes, 00347 apr_pool_t *pool); 00348 00349 /** Removes @a eraser (the subtrahend) from @a whiteboard (the 00350 * minuend), and places the resulting difference in @a output. 00351 * 00352 * Note: @a eraser and @a whiteboard must be sorted as said by @c 00353 * svn_sort_compare_ranges(). @a output is guaranteed to be in sorted 00354 * order. 00355 * 00356 * @a consider_inheritance determines how to account for the 00357 * @c svn_merge_range_t inheritable field when comparing @a whiteboard's 00358 * and @a *eraser's rangelists for equality. @see svn_mergeinfo_diff(). 00359 * 00360 * @since New in 1.5. 00361 */ 00362 svn_error_t * 00363 svn_rangelist_remove(svn_rangelist_t **output, const svn_rangelist_t *eraser, 00364 const svn_rangelist_t *whiteboard, 00365 svn_boolean_t consider_inheritance, 00366 apr_pool_t *pool); 00367 00368 /** Find the intersection of two mergeinfos, @a mergeinfo1 and @a 00369 * mergeinfo2, and place the result in @a *mergeinfo, which is (deeply) 00370 * allocated in @a result_pool. Temporary allocations will be performed 00371 * in @a scratch_pool. 00372 * 00373 * @a consider_inheritance determines how to account for the inheritability 00374 * of the two mergeinfo's ranges when calculating the range equivalence, 00375 * @see svn_rangelist_intersect(). 00376 * 00377 * @since New in 1.7. 00378 */ 00379 svn_error_t * 00380 svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo, 00381 svn_mergeinfo_t mergeinfo1, 00382 svn_mergeinfo_t mergeinfo2, 00383 svn_boolean_t consider_inheritance, 00384 apr_pool_t *result_pool, 00385 apr_pool_t *scratch_pool); 00386 00387 /** Like svn_mergeinfo_intersect2, but always considers inheritance. 00388 * 00389 * @deprecated Provided for backward compatibility with the 1.6 API. 00390 */ 00391 SVN_DEPRECATED 00392 svn_error_t * 00393 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo, 00394 svn_mergeinfo_t mergeinfo1, 00395 svn_mergeinfo_t mergeinfo2, 00396 apr_pool_t *pool); 00397 00398 /** Find the intersection of two rangelists consisting of @c 00399 * svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and 00400 * place the result in @a *rangelist (which is never @c NULL). 00401 * 00402 * @a consider_inheritance determines how to account for the inheritability 00403 * of the two rangelist's ranges when calculating the intersection, 00404 * @see svn_mergeinfo_diff(). If @a consider_inheritance is FALSE then 00405 * ranges with different inheritance can intersect, but the resulting 00406 * @a *rangelist is non-inheritable only if the corresponding ranges from 00407 * both @a rangelist1 and @a rangelist2 are non-inheritable. 00408 * If @a consider_inheritance is TRUE, then ranges with different 00409 * inheritance can never intersect. 00410 * 00411 * Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c 00412 * svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted 00413 * order. 00414 * @since New in 1.5. 00415 */ 00416 svn_error_t * 00417 svn_rangelist_intersect(svn_rangelist_t **rangelist, 00418 const svn_rangelist_t *rangelist1, 00419 const svn_rangelist_t *rangelist2, 00420 svn_boolean_t consider_inheritance, 00421 apr_pool_t *pool); 00422 00423 /** Reverse @a rangelist, and the @c start and @c end fields of each 00424 * range in @a rangelist, in place. 00425 * 00426 * TODO(miapi): Is this really a valid function? Rangelists that 00427 * aren't sorted, or rangelists containing reverse ranges, are 00428 * generally not valid in mergeinfo code. Can we rewrite the two 00429 * places where this is used? 00430 * 00431 * @since New in 1.5. 00432 */ 00433 svn_error_t * 00434 svn_rangelist_reverse(svn_rangelist_t *rangelist, apr_pool_t *pool); 00435 00436 /** Take an array of svn_merge_range_t *'s in @a rangelist, and convert it 00437 * back to a text format rangelist in @a output. If @a rangelist contains 00438 * no elements, sets @a output to the empty string. 00439 * 00440 * @since New in 1.5. 00441 */ 00442 svn_error_t * 00443 svn_rangelist_to_string(svn_string_t **output, 00444 const svn_rangelist_t *rangelist, 00445 apr_pool_t *pool); 00446 00447 /** Return a deep copy of @c svn_merge_range_t *'s in @a rangelist excluding 00448 * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or 00449 * excluding all inheritable @c svn_merge_range_t otherwise. If @a start and 00450 * @a end are valid revisions and @a start is less than or equal to @a end, 00451 * then exclude only the non-inheritable revision ranges that intersect 00452 * inclusively with the range defined by @a start and @a end. If 00453 * @a rangelist contains no elements, return an empty array. Allocate the 00454 * copy in @a result_pool, use @a scratch_pool for temporary allocations. 00455 * 00456 * @since New in 1.7. 00457 */ 00458 svn_error_t * 00459 svn_rangelist_inheritable2(svn_rangelist_t **inheritable_rangelist, 00460 const svn_rangelist_t *rangelist, 00461 svn_revnum_t start, 00462 svn_revnum_t end, 00463 svn_boolean_t inheritable, 00464 apr_pool_t *result_pool, 00465 apr_pool_t *scratch_pool); 00466 00467 /** Like svn_rangelist_inheritable2, but always finds inheritable ranges. 00468 * 00469 * @since New in 1.5. 00470 * @deprecated Provided for backward compatibility with the 1.6 API. 00471 */ 00472 SVN_DEPRECATED 00473 svn_error_t * 00474 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist, 00475 const svn_rangelist_t *rangelist, 00476 svn_revnum_t start, 00477 svn_revnum_t end, 00478 apr_pool_t *pool); 00479 00480 /** Return a deep copy of @a mergeinfo, excluding all non-inheritable 00481 * @c svn_merge_range_t if @a inheritable is TRUE or excluding all 00482 * inheritable @c svn_merge_range_t otherwise. If @a start and @a end 00483 * are valid revisions and @a start is less than or equal to @a end, 00484 * then exclude only the non-inheritable revisions that intersect 00485 * inclusively with the range defined by @a start and @a end. If @a path 00486 * is not NULL remove non-inheritable ranges only for @a path. If all 00487 * ranges are removed for a given path then remove that path as well. 00488 * If all paths are removed or @a rangelist is empty then set 00489 * @a *inheritable_rangelist to an empty array. Allocate the copy in 00490 * @a result_pool, use @a scratch_pool for temporary allocations. 00491 * 00492 * @since New in 1.7. 00493 */ 00494 svn_error_t * 00495 svn_mergeinfo_inheritable2(svn_mergeinfo_t *inheritable_mergeinfo, 00496 svn_mergeinfo_t mergeinfo, 00497 const char *path, 00498 svn_revnum_t start, 00499 svn_revnum_t end, 00500 svn_boolean_t inheritable, 00501 apr_pool_t *result_pool, 00502 apr_pool_t *scratch_pool); 00503 00504 /** Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo. 00505 * 00506 * @since New in 1.5. 00507 * @deprecated Provided for backward compatibility with the 1.6 API. 00508 */ 00509 SVN_DEPRECATED 00510 svn_error_t * 00511 svn_mergeinfo_inheritable(svn_mergeinfo_t *inheritable_mergeinfo, 00512 svn_mergeinfo_t mergeinfo, 00513 const char *path, 00514 svn_revnum_t start, 00515 svn_revnum_t end, 00516 apr_pool_t *pool); 00517 00518 /** Take a mergeinfo in @a mergeinput, and convert it to unparsed 00519 * mergeinfo. Set @a *output to the result, allocated in @a pool. 00520 * If @a input contains no elements, set @a *output to the empty string. 00521 * 00522 * @a mergeinput may contain relative merge source paths, but these are 00523 * converted to absolute paths in @a *output. 00524 * 00525 * @since New in 1.5. 00526 */ 00527 svn_error_t * 00528 svn_mergeinfo_to_string(svn_string_t **output, 00529 svn_mergeinfo_t mergeinput, 00530 apr_pool_t *pool); 00531 00532 /** Take a hash of mergeinfo in @a mergeinfo, and sort the rangelists 00533 * associated with each key (in place). 00534 * 00535 * TODO(miapi): mergeinfos should *always* be sorted. This should be 00536 * a private function. 00537 * 00538 * @since New in 1.5 00539 */ 00540 svn_error_t * 00541 svn_mergeinfo_sort(svn_mergeinfo_t mergeinfo, apr_pool_t *pool); 00542 00543 /** Return a deep copy of @a mergeinfo_catalog, allocated in @a pool. 00544 * 00545 * @since New in 1.6. 00546 */ 00547 svn_mergeinfo_catalog_t 00548 svn_mergeinfo_catalog_dup(svn_mergeinfo_catalog_t mergeinfo_catalog, 00549 apr_pool_t *pool); 00550 00551 /** Return a deep copy of @a mergeinfo, allocated in @a pool. 00552 * 00553 * @since New in 1.5. 00554 */ 00555 svn_mergeinfo_t 00556 svn_mergeinfo_dup(svn_mergeinfo_t mergeinfo, apr_pool_t *pool); 00557 00558 /** Return a deep copy of @a rangelist, allocated in @a pool. 00559 * 00560 * @since New in 1.5. 00561 */ 00562 svn_rangelist_t * 00563 svn_rangelist_dup(const svn_rangelist_t *rangelist, apr_pool_t *pool); 00564 00565 00566 /** 00567 * The three ways to request mergeinfo affecting a given path. 00568 * 00569 * @since New in 1.5. 00570 */ 00571 typedef enum svn_mergeinfo_inheritance_t 00572 { 00573 /** Explicit mergeinfo only. */ 00574 svn_mergeinfo_explicit, 00575 00576 /** Explicit mergeinfo, or if that doesn't exist, the inherited 00577 mergeinfo from a target's nearest (path-wise, not history-wise) 00578 ancestor. */ 00579 svn_mergeinfo_inherited, 00580 00581 /** Mergeinfo inherited from a target's nearest (path-wise, not 00582 history-wise) ancestor, regardless of whether target has explicit 00583 mergeinfo. */ 00584 svn_mergeinfo_nearest_ancestor 00585 } svn_mergeinfo_inheritance_t; 00586 00587 /** Return a constant string expressing @a inherit as an English word, 00588 * i.e., "explicit" (default), "inherited", or "nearest_ancestor". 00589 * The string is not localized, as it may be used for client<->server 00590 * communications. 00591 * 00592 * @since New in 1.5. 00593 */ 00594 const char * 00595 svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit); 00596 00597 00598 /** Return the appropriate @c svn_mergeinfo_inheritance_t for @a word. 00599 * @a word is as returned from svn_inheritance_to_word(). Defaults to 00600 * @c svn_mergeinfo_explicit. 00601 * 00602 * @since New in 1.5. 00603 */ 00604 svn_mergeinfo_inheritance_t 00605 svn_inheritance_from_word(const char *word); 00606 00607 00608 #ifdef __cplusplus 00609 } 00610 #endif /* __cplusplus */ 00611 00612 #endif /* SVN_MERGEINFO_H */