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". An array of non- 117 * overlapping merge ranges (@c svn_merge_range_t *), sorted as said by 118 * @c svn_sort_compare_ranges(). An empty range list is represented by 119 * an empty array. Unless specifically noted otherwise, all APIs require 120 * rangelists that describe only forward ranges, i.e. the range's start 121 * revision is less than its end revision. 122 * 123 * (c) @c svn_mergeinfo_t, called "mergeinfo". A hash mapping merge 124 * source paths (@c const char *, starting with slashes) to 125 * non-empty rangelist arrays. A @c NULL hash is used to represent 126 * no mergeinfo and an empty hash is used to represent empty 127 * mergeinfo. 128 * 129 * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog". A hash 130 * mapping paths (@c const char *) to @c svn_mergeinfo_t. 131 * 132 * Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just 133 * typedefs for @c apr_hash_t *; there is no static type-checking, and 134 * you still use standard @c apr_hash_t functions to interact with 135 * them. 136 * 137 * Note that while the keys of mergeinfos are always absolute from the 138 * repository root, the keys of a catalog may be relative to something 139 * else, such as an RA session root. 140 */ 141 142 typedef apr_array_header_t svn_rangelist_t; 143 typedef apr_hash_t *svn_mergeinfo_t; 144 typedef apr_hash_t *svn_mergeinfo_catalog_t; 145 146 /** Parse the mergeinfo from @a input into @a *mergeinfo. If no 147 * mergeinfo is available, return an empty mergeinfo (never @c NULL). 148 * Perform temporary allocations in @a pool. 149 * 150 * If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO 151 * property, contains overlapping revision ranges of differing 152 * inheritability, or revision ranges with a start revision greater 153 * than or equal to its end revision, or contains paths mapped to empty 154 * revision ranges, then return @c SVN_ERR_MERGEINFO_PARSE_ERROR. 155 * Unordered revision ranges are allowed, but will be sorted when 156 * placed into @a *mergeinfo. Overlapping revision ranges of the same 157 * inheritability are also allowed, but will be combined into a single 158 * range when placed into @a *mergeinfo. 159 * 160 * @a input may contain relative merge source paths, but these are 161 * converted to absolute paths in @a *mergeinfo. 162 * 163 * @since New in 1.5. 164 */ 165 svn_error_t * 166 svn_mergeinfo_parse(svn_mergeinfo_t *mergeinfo, const char *input, 167 apr_pool_t *pool); 168 169 /** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto 170 * (either or both of which may be @c NULL meaning an empty mergeinfo). 171 * Place the result in @a *deleted and @a *added (neither output argument 172 * may be @c NULL), both allocated in @a result_pool. The resulting 173 * @a *deleted and @a *added will not be null. 174 * 175 * @a consider_inheritance determines how the rangelists in the two 176 * hashes are compared for equality. If @a consider_inheritance is FALSE, 177 * then the start and end revisions of the @c svn_merge_range_t's being 178 * compared are the only factors considered when determining equality. 179 * 180 * e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5' 181 * 182 * If @a consider_inheritance is TRUE, then the inheritability of the 183 * @c svn_merge_range_t's is also considered and must be the same for two 184 * otherwise identical ranges to be judged equal. 185 * 186 * e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5' 187 * '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5' 188 * '/trunk: 1,3-4,5' == '/trunk: 1,3-4,5' 189 * 190 * @since New in 1.8. 191 */ 192 svn_error_t * 193 svn_mergeinfo_diff2(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, 194 svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, 195 svn_boolean_t consider_inheritance, 196 apr_pool_t *result_pool, 197 apr_pool_t *scratch_pool); 198 199 /** Similar to svn_mergeinfo_diff2(), but users only one pool. 200 * 201 * @deprecated Provided for backward compatibility with the 1.7 API. 202 * @since New in 1.5. 203 */ 204 SVN_DEPRECATED 205 svn_error_t * 206 svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, 207 svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, 208 svn_boolean_t consider_inheritance, 209 apr_pool_t *pool); 210 211 /** Merge a shallow copy of one mergeinfo, @a changes, into another mergeinfo 212 * @a mergeinfo. 213 * 214 * Rangelists for merge source paths common to @a changes and @a mergeinfo may 215 * result in new rangelists; these are allocated in @a result_pool. 216 * Temporary allocations are made in @a scratch_pool. 217 * 218 * When intersecting rangelists for a path are merged, the inheritability of 219 * the resulting svn_merge_range_t depends on the inheritability of the 220 * operands. If two non-inheritable ranges are merged the result is always 221 * non-inheritable, in all other cases the resulting range is inheritable. 222 * 223 * e.g. '/A: 1,3-4' merged with '/A: 1,3,4*,5' --> '/A: 1,3-5' 224 * '/A: 1,3-4*' merged with '/A: 1,3,4*,5' --> '/A: 1,3,4*,5' 225 * 226 * @since New in 1.8. 227 */ 228 svn_error_t * 229 svn_mergeinfo_merge2(svn_mergeinfo_t mergeinfo, 230 svn_mergeinfo_t changes, 231 apr_pool_t *result_pool, 232 apr_pool_t *scratch_pool); 233 234 /** Like svn_mergeinfo_merge2, but uses only one pool. 235 * 236 * @deprecated Provided for backward compatibility with the 1.5 API. 237 */ 238 SVN_DEPRECATED 239 svn_error_t * 240 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo, 241 svn_mergeinfo_t changes, 242 apr_pool_t *pool); 243 244 /** Combine one mergeinfo catalog, @a changes_catalog, into another mergeinfo 245 * catalog @a mergeinfo_catalog. If both catalogs have mergeinfo for the same 246 * key, use svn_mergeinfo_merge() to combine the mergeinfos. 247 * 248 * Additions to @a mergeinfo_catalog are deep copies allocated in 249 * @a result_pool. Temporary allocations are made in @a scratch_pool. 250 * 251 * @since New in 1.7. 252 */ 253 svn_error_t * 254 svn_mergeinfo_catalog_merge(svn_mergeinfo_catalog_t mergeinfo_catalog, 255 svn_mergeinfo_catalog_t changes_catalog, 256 apr_pool_t *result_pool, 257 apr_pool_t *scratch_pool); 258 259 /** Like svn_mergeinfo_remove2, but always considers inheritance. 260 * 261 * @deprecated Provided for backward compatibility with the 1.6 API. 262 */ 263 SVN_DEPRECATED 264 svn_error_t * 265 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser, 266 svn_mergeinfo_t whiteboard, apr_pool_t *pool); 267 268 /** Removes @a eraser (the subtrahend) from @a whiteboard (the 269 * minuend), and places the resulting difference in @a *mergeinfo. 270 * Allocates @a *mergeinfo in @a result_pool. Temporary allocations 271 * will be performed in @a scratch_pool. 272 * 273 * @a consider_inheritance determines how to account for the inheritability 274 * of the two mergeinfo's ranges when calculating the range equivalence, 275 * as described for svn_mergeinfo_diff(). 276 * 277 * @since New in 1.7. 278 */ 279 svn_error_t * 280 svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo, 281 svn_mergeinfo_t eraser, 282 svn_mergeinfo_t whiteboard, 283 svn_boolean_t consider_inheritance, 284 apr_pool_t *result_pool, 285 apr_pool_t *scratch_pool); 286 287 /** Calculate the delta between two rangelists consisting of @c 288 * svn_merge_range_t * elements (sorted in ascending order), @a from 289 * and @a to, and place the result in @a *deleted and @a *added 290 * (neither output argument will ever be @c NULL). 291 * 292 * @a consider_inheritance determines how to account for the inheritability 293 * of the two rangelist's ranges when calculating the diff, 294 * as described for svn_mergeinfo_diff(). 295 * 296 * @since New in 1.5. 297 */ 298 svn_error_t * 299 svn_rangelist_diff(svn_rangelist_t **deleted, svn_rangelist_t **added, 300 const svn_rangelist_t *from, const svn_rangelist_t *to, 301 svn_boolean_t consider_inheritance, 302 apr_pool_t *pool); 303 304 /** Merge two rangelists consisting of @c svn_merge_range_t * 305 * elements, @a rangelist and @a changes, placing the results in 306 * @a rangelist. New elements added to @a rangelist are allocated 307 * in @a result_pool. Either rangelist may be empty. 308 * 309 * When intersecting rangelists are merged, the inheritability of 310 * the resulting svn_merge_range_t depends on the inheritability of the 311 * operands: see svn_mergeinfo_merge(). 312 * 313 * Note: @a rangelist and @a changes must be sorted as said by @c 314 * svn_sort_compare_ranges(). @a rangelist is guaranteed to remain 315 * in sorted order and be compacted to the minimal number of ranges 316 * needed to represent the merged result. 317 * 318 * If the original rangelist contains non-collapsed adjacent ranges, 319 * the final result is not guaranteed to be compacted either. 320 * 321 * Use @a scratch_pool for temporary allocations. 322 * 323 * @since New in 1.8. 324 */ 325 svn_error_t * 326 svn_rangelist_merge2(svn_rangelist_t *rangelist, 327 const svn_rangelist_t *changes, 328 apr_pool_t *result_pool, 329 apr_pool_t *scratch_pool); 330 331 /** Like svn_rangelist_merge2(), but with @a rangelist as an input/output 332 * argument. This function always allocates a new rangelist in @a pool and 333 * returns its result in @a *rangelist. It does not modify @a *rangelist 334 * in place. If not used carefully, this function can use up a lot of memory 335 * if called in a loop. 336 * 337 * It performs an extra adjacent range compaction round to make sure non 338 * collapsed input ranges are compacted in the result. 339 * 340 * @since New in 1.5. 341 * @deprecated Provided for backward compatibility with the 1.7 API. 342 */ 343 SVN_DEPRECATED 344 svn_error_t * 345 svn_rangelist_merge(svn_rangelist_t **rangelist, 346 const svn_rangelist_t *changes, 347 apr_pool_t *pool); 348 349 /** Removes @a eraser (the subtrahend) from @a whiteboard (the 350 * minuend), and places the resulting difference in @a output. 351 * 352 * Note: @a eraser and @a whiteboard must be sorted as said by @c 353 * svn_sort_compare_ranges(). @a output is guaranteed to be in sorted 354 * order. 355 * 356 * @a consider_inheritance determines how to account for the 357 * @c svn_merge_range_t inheritable field when comparing @a whiteboard's 358 * and @a *eraser's rangelists for equality. @see svn_mergeinfo_diff(). 359 * 360 * @since New in 1.5. 361 */ 362 svn_error_t * 363 svn_rangelist_remove(svn_rangelist_t **output, const svn_rangelist_t *eraser, 364 const svn_rangelist_t *whiteboard, 365 svn_boolean_t consider_inheritance, 366 apr_pool_t *pool); 367 368 /** Find the intersection of two mergeinfos, @a mergeinfo1 and @a 369 * mergeinfo2, and place the result in @a *mergeinfo, which is (deeply) 370 * allocated in @a result_pool. Temporary allocations will be performed 371 * in @a scratch_pool. 372 * 373 * @a consider_inheritance determines how to account for the inheritability 374 * of the two mergeinfo's ranges when calculating the range equivalence, 375 * @see svn_rangelist_intersect(). 376 * 377 * @since New in 1.7. 378 */ 379 svn_error_t * 380 svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo, 381 svn_mergeinfo_t mergeinfo1, 382 svn_mergeinfo_t mergeinfo2, 383 svn_boolean_t consider_inheritance, 384 apr_pool_t *result_pool, 385 apr_pool_t *scratch_pool); 386 387 /** Like svn_mergeinfo_intersect2, but always considers inheritance. 388 * 389 * @deprecated Provided for backward compatibility with the 1.6 API. 390 */ 391 SVN_DEPRECATED 392 svn_error_t * 393 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo, 394 svn_mergeinfo_t mergeinfo1, 395 svn_mergeinfo_t mergeinfo2, 396 apr_pool_t *pool); 397 398 /** Find the intersection of two rangelists consisting of @c 399 * svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and 400 * place the result in @a *rangelist (which is never @c NULL). 401 * 402 * @a consider_inheritance determines how to account for the inheritability 403 * of the two rangelist's ranges when calculating the intersection, 404 * @see svn_mergeinfo_diff(). If @a consider_inheritance is FALSE then 405 * ranges with different inheritance can intersect, but the resulting 406 * @a *rangelist is non-inheritable only if the corresponding ranges from 407 * both @a rangelist1 and @a rangelist2 are non-inheritable. 408 * If @a consider_inheritance is TRUE, then ranges with different 409 * inheritance can never intersect. 410 * 411 * Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c 412 * svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted 413 * order. 414 * @since New in 1.5. 415 */ 416 svn_error_t * 417 svn_rangelist_intersect(svn_rangelist_t **rangelist, 418 const svn_rangelist_t *rangelist1, 419 const svn_rangelist_t *rangelist2, 420 svn_boolean_t consider_inheritance, 421 apr_pool_t *pool); 422 423 /** Reverse @a rangelist, and the @c start and @c end fields of each 424 * range in @a rangelist, in place. 425 * 426 * TODO(miapi): Is this really a valid function? Rangelists that 427 * aren't sorted, or rangelists containing reverse ranges, are 428 * generally not valid in mergeinfo code. Can we rewrite the two 429 * places where this is used? 430 * 431 * @since New in 1.5. 432 */ 433 svn_error_t * 434 svn_rangelist_reverse(svn_rangelist_t *rangelist, apr_pool_t *pool); 435 436 /** Take an array of svn_merge_range_t *'s in @a rangelist, and convert it 437 * back to a text format rangelist in @a output. If @a rangelist contains 438 * no elements, sets @a output to the empty string. 439 * 440 * @since New in 1.5. 441 */ 442 svn_error_t * 443 svn_rangelist_to_string(svn_string_t **output, 444 const svn_rangelist_t *rangelist, 445 apr_pool_t *pool); 446 447 /** Return a deep copy of @c svn_merge_range_t *'s in @a rangelist excluding 448 * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or 449 * excluding all inheritable @c svn_merge_range_t otherwise. If @a start and 450 * @a end are valid revisions and @a start is less than or equal to @a end, 451 * then exclude only the non-inheritable revision ranges that intersect 452 * inclusively with the range defined by @a start and @a end. If 453 * @a rangelist contains no elements, return an empty array. Allocate the 454 * copy in @a result_pool, use @a scratch_pool for temporary allocations. 455 * 456 * @since New in 1.7. 457 */ 458 svn_error_t * 459 svn_rangelist_inheritable2(svn_rangelist_t **inheritable_rangelist, 460 const svn_rangelist_t *rangelist, 461 svn_revnum_t start, 462 svn_revnum_t end, 463 svn_boolean_t inheritable, 464 apr_pool_t *result_pool, 465 apr_pool_t *scratch_pool); 466 467 /** Like svn_rangelist_inheritable2, but always finds inheritable ranges. 468 * 469 * @since New in 1.5. 470 * @deprecated Provided for backward compatibility with the 1.6 API. 471 */ 472 SVN_DEPRECATED 473 svn_error_t * 474 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist, 475 const svn_rangelist_t *rangelist, 476 svn_revnum_t start, 477 svn_revnum_t end, 478 apr_pool_t *pool); 479 480 /** Return a deep copy of @a mergeinfo, excluding all non-inheritable 481 * @c svn_merge_range_t if @a inheritable is TRUE or excluding all 482 * inheritable @c svn_merge_range_t otherwise. If @a start and @a end 483 * are valid revisions and @a start is less than or equal to @a end, 484 * then exclude only the non-inheritable revisions that intersect 485 * inclusively with the range defined by @a start and @a end. If @a path 486 * is not NULL remove non-inheritable ranges only for @a path. If all 487 * ranges are removed for a given path then remove that path as well. 488 * If all paths are removed or @a rangelist is empty then set 489 * @a *inheritable_rangelist to an empty array. Allocate the copy in 490 * @a result_pool, use @a scratch_pool for temporary allocations. 491 * 492 * @since New in 1.7. 493 */ 494 svn_error_t * 495 svn_mergeinfo_inheritable2(svn_mergeinfo_t *inheritable_mergeinfo, 496 svn_mergeinfo_t mergeinfo, 497 const char *path, 498 svn_revnum_t start, 499 svn_revnum_t end, 500 svn_boolean_t inheritable, 501 apr_pool_t *result_pool, 502 apr_pool_t *scratch_pool); 503 504 /** Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo. 505 * 506 * @since New in 1.5. 507 * @deprecated Provided for backward compatibility with the 1.6 API. 508 */ 509 SVN_DEPRECATED 510 svn_error_t * 511 svn_mergeinfo_inheritable(svn_mergeinfo_t *inheritable_mergeinfo, 512 svn_mergeinfo_t mergeinfo, 513 const char *path, 514 svn_revnum_t start, 515 svn_revnum_t end, 516 apr_pool_t *pool); 517 518 /** Take a mergeinfo in @a mergeinput, and convert it to unparsed 519 * mergeinfo. Set @a *output to the result, allocated in @a pool. 520 * If @a input contains no elements, set @a *output to the empty string. 521 * 522 * @a mergeinput may contain relative merge source paths, but these are 523 * converted to absolute paths in @a *output. 524 * 525 * @since New in 1.5. 526 */ 527 svn_error_t * 528 svn_mergeinfo_to_string(svn_string_t **output, 529 svn_mergeinfo_t mergeinput, 530 apr_pool_t *pool); 531 532 /** Take a hash of mergeinfo in @a mergeinfo, and sort the rangelists 533 * associated with each key (in place). 534 * 535 * TODO(miapi): mergeinfos should *always* be sorted. This should be 536 * a private function. 537 * 538 * @since New in 1.5 539 */ 540 svn_error_t * 541 svn_mergeinfo_sort(svn_mergeinfo_t mergeinfo, apr_pool_t *pool); 542 543 /** Return a deep copy of @a mergeinfo_catalog, allocated in @a pool. 544 * 545 * @since New in 1.6. 546 */ 547 svn_mergeinfo_catalog_t 548 svn_mergeinfo_catalog_dup(svn_mergeinfo_catalog_t mergeinfo_catalog, 549 apr_pool_t *pool); 550 551 /** Return a deep copy of @a mergeinfo, allocated in @a pool. 552 * 553 * @since New in 1.5. 554 */ 555 svn_mergeinfo_t 556 svn_mergeinfo_dup(svn_mergeinfo_t mergeinfo, apr_pool_t *pool); 557 558 /** Return a deep copy of @a rangelist, allocated in @a pool. 559 * 560 * @since New in 1.5. 561 */ 562 svn_rangelist_t * 563 svn_rangelist_dup(const svn_rangelist_t *rangelist, apr_pool_t *pool); 564 565 566 /** 567 * The three ways to request mergeinfo affecting a given path. 568 * 569 * @since New in 1.5. 570 */ 571 typedef enum svn_mergeinfo_inheritance_t 572 { 573 /** Explicit mergeinfo only. */ 574 svn_mergeinfo_explicit, 575 576 /** Explicit mergeinfo, or if that doesn't exist, the inherited 577 mergeinfo from a target's nearest (path-wise, not history-wise) 578 ancestor. */ 579 svn_mergeinfo_inherited, 580 581 /** Mergeinfo inherited from a target's nearest (path-wise, not 582 history-wise) ancestor, regardless of whether target has explicit 583 mergeinfo. */ 584 svn_mergeinfo_nearest_ancestor 585 } svn_mergeinfo_inheritance_t; 586 587 /** Return a constant string expressing @a inherit as an English word, 588 * i.e., "explicit" (default), "inherited", or "nearest_ancestor". 589 * The string is not localized, as it may be used for client<->server 590 * communications. 591 * 592 * @since New in 1.5. 593 */ 594 const char * 595 svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit); 596 597 598 /** Return the appropriate @c svn_mergeinfo_inheritance_t for @a word. 599 * @a word is as returned from svn_inheritance_to_word(). Defaults to 600 * @c svn_mergeinfo_explicit. 601 * 602 * @since New in 1.5. 603 */ 604 svn_mergeinfo_inheritance_t 605 svn_inheritance_from_word(const char *word); 606 607 608 #ifdef __cplusplus 609 } 610 #endif /* __cplusplus */ 611 612 #endif /* SVN_MERGEINFO_H */ 613