svn_mergeinfo.h

Go to the documentation of this file.
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".
00117  *
00118  * (c) @c svn_mergeinfo_t, called "mergeinfo".
00119  *
00120  * (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog".
00121  *
00122  * Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just
00123  * typedefs for @c apr_hash_t *; there is no static type-checking, and
00124  * you still use standard @c apr_hash_t functions to interact with
00125  * them.
00126  */
00127 
00128 /** An array of non-overlapping merge ranges (@c svn_merge_range_t *),
00129  * sorted as said by @c svn_sort_compare_ranges().  An empty range list is
00130  * represented by an empty array.
00131  *
00132  * Unless specifically noted otherwise, all APIs require rangelists that
00133  * describe only forward ranges, i.e. the range's start revision is less
00134  * than its end revision. */
00135 typedef apr_array_header_t svn_rangelist_t;
00136 
00137 /** A hash mapping merge source paths to non-empty rangelist arrays.
00138  *
00139  * The keys are (@c const char *) absolute paths from the repository root,
00140  * starting with slashes. A @c NULL hash represents no mergeinfo and an
00141  * empty hash represents empty mergeinfo. */
00142 typedef apr_hash_t *svn_mergeinfo_t;
00143 
00144 /** A hash mapping paths (@c const char *) to @c svn_mergeinfo_t.
00145  *
00146  * @note While the keys of #svn_mergeinfo_t are always absolute from the
00147  * repository root, the keys of a catalog may be relative to something
00148  * else, such as an RA session root.
00149  * */
00150 typedef apr_hash_t *svn_mergeinfo_catalog_t;
00151 
00152 /** Parse the mergeinfo from @a input into @a *mergeinfo.  If no
00153  * mergeinfo is available, return an empty mergeinfo (never @c NULL).
00154  *
00155  * If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO
00156  * property, contains overlapping revision ranges of differing
00157  * inheritability, or revision ranges with a start revision greater
00158  * than or equal to its end revision, or contains paths mapped to empty
00159  * revision ranges, then return  @c SVN_ERR_MERGEINFO_PARSE_ERROR.
00160  * Unordered revision ranges are  allowed, but will be sorted when
00161  * placed into @a *mergeinfo.  Overlapping revision ranges of the same
00162  * inheritability are also allowed, but will be combined into a single
00163  * range when placed into @a *mergeinfo.
00164  *
00165  * @a input may contain relative merge source paths, but these are
00166  * converted to absolute paths in @a *mergeinfo.
00167  *
00168  * Allocate the result deeply in @a pool. Also perform temporary
00169  * allocations in @a pool.
00170  *
00171  * @since New in 1.5.
00172  */
00173 svn_error_t *
00174 svn_mergeinfo_parse(svn_mergeinfo_t *mergeinfo, const char *input,
00175                     apr_pool_t *pool);
00176 
00177 /** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto
00178  * (either or both of which may be @c NULL meaning an empty mergeinfo).
00179  * Place the result in @a *deleted and @a *added (neither output argument
00180  * may be @c NULL), both allocated in @a result_pool.  The resulting
00181  * @a *deleted and @a *added will not be null.
00182  *
00183  * @a consider_inheritance determines how the rangelists in the two
00184  * hashes are compared for equality.  If @a consider_inheritance is FALSE,
00185  * then the start and end revisions of the @c svn_merge_range_t's being
00186  * compared are the only factors considered when determining equality.
00187  *
00188  *  e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5'
00189  *
00190  * If @a consider_inheritance is TRUE, then the inheritability of the
00191  * @c svn_merge_range_t's is also considered and must be the same for two
00192  * otherwise identical ranges to be judged equal.
00193  *
00194  *  e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5'
00195  *       '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5'
00196  *       '/trunk: 1,3-4,5'  == '/trunk: 1,3-4,5'
00197  *
00198  * @since New in 1.8.
00199  */
00200 svn_error_t *
00201 svn_mergeinfo_diff2(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
00202                     svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
00203                     svn_boolean_t consider_inheritance,
00204                     apr_pool_t *result_pool,
00205                     apr_pool_t *scratch_pool);
00206 
00207 /** Similar to svn_mergeinfo_diff2(), but users only one pool.
00208  *
00209  * @deprecated Provided for backward compatibility with the 1.7 API.
00210  * @since New in 1.5.
00211  */
00212 SVN_DEPRECATED
00213 svn_error_t *
00214 svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
00215                    svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
00216                    svn_boolean_t consider_inheritance,
00217                    apr_pool_t *pool);
00218 
00219 /** Merge a shallow copy of one mergeinfo, @a changes, into another mergeinfo
00220  * @a mergeinfo.
00221  *
00222  * Rangelists for merge source paths common to @a changes and @a mergeinfo may
00223  * result in new rangelists; these are allocated in @a result_pool.
00224  * Temporary allocations are made in @a scratch_pool.
00225  *
00226  * When intersecting rangelists for a path are merged, the inheritability of
00227  * the resulting svn_merge_range_t depends on the inheritability of the
00228  * operands.  If two non-inheritable ranges are merged the result is always
00229  * non-inheritable, in all other cases the resulting range is inheritable.
00230  *
00231  *  e.g. '/A: 1,3-4'  merged with '/A: 1,3,4*,5' --> '/A: 1,3-5'
00232  *       '/A: 1,3-4*' merged with '/A: 1,3,4*,5' --> '/A: 1,3,4*,5'
00233  *
00234  * @since New in 1.8.
00235  */
00236 svn_error_t *
00237 svn_mergeinfo_merge2(svn_mergeinfo_t mergeinfo,
00238                      svn_mergeinfo_t changes,
00239                      apr_pool_t *result_pool,
00240                      apr_pool_t *scratch_pool);
00241 
00242 /** Like svn_mergeinfo_merge2, but uses only one pool.
00243  *
00244  * @deprecated Provided for backward compatibility with the 1.5 API.
00245  */
00246 SVN_DEPRECATED
00247 svn_error_t *
00248 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo,
00249                     svn_mergeinfo_t changes,
00250                     apr_pool_t *pool);
00251 
00252 /** Combine one mergeinfo catalog, @a changes_catalog, into another mergeinfo
00253  * catalog @a mergeinfo_catalog.  If both catalogs have mergeinfo for the same
00254  * key, use svn_mergeinfo_merge() to combine the mergeinfos.
00255  *
00256  * Additions to @a mergeinfo_catalog are deep copies allocated in
00257  * @a result_pool.  Temporary allocations are made in @a scratch_pool.
00258  *
00259  * @since New in 1.7.
00260  */
00261 svn_error_t *
00262 svn_mergeinfo_catalog_merge(svn_mergeinfo_catalog_t mergeinfo_catalog,
00263                             svn_mergeinfo_catalog_t changes_catalog,
00264                             apr_pool_t *result_pool,
00265                             apr_pool_t *scratch_pool);
00266 
00267 /** Like svn_mergeinfo_remove2, but always considers inheritance.
00268  *
00269  * @deprecated Provided for backward compatibility with the 1.6 API.
00270  */
00271 SVN_DEPRECATED
00272 svn_error_t *
00273 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser,
00274                      svn_mergeinfo_t whiteboard, apr_pool_t *pool);
00275 
00276 /** Removes @a eraser (the subtrahend) from @a whiteboard (the
00277  * minuend), and places the resulting difference in @a *mergeinfo.
00278  * Allocates @a *mergeinfo in @a result_pool.  Temporary allocations
00279  * will be performed in @a scratch_pool.
00280  *
00281  * @a consider_inheritance determines how to account for the inheritability
00282  * of the two mergeinfo's ranges when calculating the range equivalence,
00283  * as described for svn_mergeinfo_diff().
00284  *
00285  * @since New in 1.7.
00286  */
00287 svn_error_t *
00288 svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo,
00289                       svn_mergeinfo_t eraser,
00290                       svn_mergeinfo_t whiteboard,
00291                       svn_boolean_t consider_inheritance,
00292                       apr_pool_t *result_pool,
00293                       apr_pool_t *scratch_pool);
00294 
00295 /** Calculate the delta between two rangelists consisting of @c
00296  * svn_merge_range_t * elements (sorted in ascending order), @a from
00297  * and @a to, and place the result in @a *deleted and @a *added
00298  * (neither output argument will ever be @c NULL).
00299  *
00300  * @a consider_inheritance determines how to account for the inheritability
00301  * of the two rangelist's ranges when calculating the diff,
00302  * as described for svn_mergeinfo_diff().
00303  *
00304  * @since New in 1.5.
00305  */
00306 svn_error_t *
00307 svn_rangelist_diff(svn_rangelist_t **deleted, svn_rangelist_t **added,
00308                    const svn_rangelist_t *from, const svn_rangelist_t *to,
00309                    svn_boolean_t consider_inheritance,
00310                    apr_pool_t *pool);
00311 
00312 /** Merge two rangelists consisting of @c svn_merge_range_t *
00313  * elements, @a rangelist and @a changes, placing the results in
00314  * @a rangelist. New elements added to @a rangelist are allocated
00315  * in @a result_pool. Either rangelist may be empty.
00316  *
00317  * When intersecting rangelists are merged, the inheritability of
00318  * the resulting svn_merge_range_t depends on the inheritability of the
00319  * operands: see svn_mergeinfo_merge().
00320  *
00321  * Note: @a rangelist and @a changes must be sorted as said by @c
00322  * svn_sort_compare_ranges().  @a rangelist is guaranteed to remain
00323  * in sorted order and be compacted to the minimal number of ranges
00324  * needed to represent the merged result.
00325  *
00326  * If the original rangelist contains non-collapsed adjacent ranges,
00327  * the final result is not guaranteed to be compacted either.
00328  *
00329  * Use @a scratch_pool for temporary allocations.
00330  *
00331  * @since New in 1.8.
00332  */
00333 svn_error_t *
00334 svn_rangelist_merge2(svn_rangelist_t *rangelist,
00335                      const svn_rangelist_t *changes,
00336                      apr_pool_t *result_pool,
00337                      apr_pool_t *scratch_pool);
00338 
00339 /** Like svn_rangelist_merge2(), but with @a rangelist as an input/output
00340  * argument. This function always allocates a new rangelist in @a pool and
00341  * returns its result in @a *rangelist. It does not modify @a *rangelist
00342  * in place. If not used carefully, this function can use up a lot of memory
00343  * if called in a loop.
00344  *
00345  * It performs an extra adjacent range compaction round to make sure non
00346  * collapsed input ranges are compacted in the result.
00347  *
00348  * @since New in 1.5.
00349  * @deprecated Provided for backward compatibility with the 1.7 API.
00350  */
00351 SVN_DEPRECATED
00352 svn_error_t *
00353 svn_rangelist_merge(svn_rangelist_t **rangelist,
00354                     const svn_rangelist_t *changes,
00355                     apr_pool_t *pool);
00356 
00357 /** Removes @a eraser (the subtrahend) from @a whiteboard (the
00358  * minuend), and places the resulting difference in @a output.
00359  *
00360  * Note: @a eraser and @a whiteboard must be sorted as said by @c
00361  * svn_sort_compare_ranges().  @a output is guaranteed to be in sorted
00362  * order.
00363  *
00364  * @a consider_inheritance determines how to account for the
00365  * @c svn_merge_range_t inheritable field when comparing @a whiteboard's
00366  * and @a *eraser's rangelists for equality.  @see svn_mergeinfo_diff().
00367  *
00368  * Allocate the entire output in @a pool.
00369  *
00370  * @since New in 1.5.
00371  */
00372 svn_error_t *
00373 svn_rangelist_remove(svn_rangelist_t **output, const svn_rangelist_t *eraser,
00374                      const svn_rangelist_t *whiteboard,
00375                      svn_boolean_t consider_inheritance,
00376                      apr_pool_t *pool);
00377 
00378 /** Find the intersection of two mergeinfos, @a mergeinfo1 and @a
00379  * mergeinfo2, and place the result in @a *mergeinfo, which is (deeply)
00380  * allocated in @a result_pool.  Temporary allocations will be performed
00381  * in @a scratch_pool.
00382  *
00383  * @a consider_inheritance determines how to account for the inheritability
00384  * of the two mergeinfo's ranges when calculating the range equivalence,
00385  * @see svn_rangelist_intersect().
00386  *
00387  * @since New in 1.7.
00388  */
00389 svn_error_t *
00390 svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo,
00391                          svn_mergeinfo_t mergeinfo1,
00392                          svn_mergeinfo_t mergeinfo2,
00393                          svn_boolean_t consider_inheritance,
00394                          apr_pool_t *result_pool,
00395                          apr_pool_t *scratch_pool);
00396 
00397 /** Like svn_mergeinfo_intersect2, but always considers inheritance.
00398  *
00399  * @deprecated Provided for backward compatibility with the 1.6 API.
00400  */
00401 SVN_DEPRECATED
00402 svn_error_t *
00403 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
00404                         svn_mergeinfo_t mergeinfo1,
00405                         svn_mergeinfo_t mergeinfo2,
00406                         apr_pool_t *pool);
00407 
00408 /** Find the intersection of two rangelists consisting of @c
00409  * svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and
00410  * place the result in @a *rangelist (which is never @c NULL).
00411  *
00412  * @a consider_inheritance determines how to account for the inheritability
00413  * of the two rangelist's ranges when calculating the intersection,
00414  * @see svn_mergeinfo_diff().  If @a consider_inheritance is FALSE then
00415  * ranges with different inheritance can intersect, but the resulting
00416  * @a *rangelist is non-inheritable only if the corresponding ranges from
00417  * both @a rangelist1 and @a rangelist2 are non-inheritable.
00418  * If @a consider_inheritance is TRUE, then ranges with different
00419  * inheritance can never intersect.
00420  *
00421  * Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c
00422  * svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted
00423  * order.
00424  *
00425  * Allocate the entire output in @a pool.
00426  *
00427  * @since New in 1.5.
00428  */
00429 svn_error_t *
00430 svn_rangelist_intersect(svn_rangelist_t **rangelist,
00431                         const svn_rangelist_t *rangelist1,
00432                         const svn_rangelist_t *rangelist2,
00433                         svn_boolean_t consider_inheritance,
00434                         apr_pool_t *pool);
00435 
00436 /** Reverse @a rangelist, and the @c start and @c end fields of each
00437  * range in @a rangelist, in place.
00438  *
00439  * TODO(miapi): Is this really a valid function?  Rangelists that
00440  * aren't sorted, or rangelists containing reverse ranges, are
00441  * generally not valid in mergeinfo code.  Can we rewrite the two
00442  * places where this is used?
00443  *
00444  * @since New in 1.5.
00445  */
00446 svn_error_t *
00447 svn_rangelist_reverse(svn_rangelist_t *rangelist, apr_pool_t *pool);
00448 
00449 /** Take an array of svn_merge_range_t *'s in @a rangelist, and convert it
00450  * back to a text format rangelist in @a output.  If @a rangelist contains
00451  * no elements, sets @a output to the empty string.
00452  *
00453  * @since New in 1.5.
00454  */
00455 svn_error_t *
00456 svn_rangelist_to_string(svn_string_t **output,
00457                         const svn_rangelist_t *rangelist,
00458                         apr_pool_t *pool);
00459 
00460 /** Remove non-inheritable or inheritable revision ranges from a rangelist.
00461  *
00462  * Set @a *inheritable_rangelist to a deep copy of @a rangelist, excluding
00463  * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or
00464  * excluding all inheritable @c svn_merge_range_t otherwise.
00465  *
00466  * If @a start and @a end are valid revisions and @a start is less than or
00467  * equal to @a end, then exclude only the (non-inheritable or inheritable)
00468  * revision ranges that intersect inclusively with the range defined by
00469  * @a start and @a end.
00470  *
00471  * If there are no remaining ranges, return an empty array.
00472  *
00473  * Allocate the copy in @a result_pool, and use @a scratch_pool for
00474  * temporary allocations.
00475  *
00476  * @since New in 1.7.
00477  */
00478 svn_error_t *
00479 svn_rangelist_inheritable2(svn_rangelist_t **inheritable_rangelist,
00480                            const svn_rangelist_t *rangelist,
00481                            svn_revnum_t start,
00482                            svn_revnum_t end,
00483                            svn_boolean_t inheritable,
00484                            apr_pool_t *result_pool,
00485                            apr_pool_t *scratch_pool);
00486 
00487 /** Like svn_rangelist_inheritable2, but always finds inheritable ranges.
00488  *
00489  * @since New in 1.5.
00490  * @deprecated Provided for backward compatibility with the 1.6 API.
00491  */
00492 SVN_DEPRECATED
00493 svn_error_t *
00494 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist,
00495                           const svn_rangelist_t *rangelist,
00496                           svn_revnum_t start,
00497                           svn_revnum_t end,
00498                           apr_pool_t *pool);
00499 
00500 /** Remove non-inheritable or inheritable revision ranges from mergeinfo.
00501  *
00502  * Set @a *inheritable_mergeinfo to a deep copy of @a mergeinfo, excluding
00503  * all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or
00504  * excluding all inheritable @c svn_merge_range_t otherwise.
00505  *
00506  * If @a start and @a end are valid revisions and @a start is less than or
00507  * equal to @a end, then exclude only the (non-inheritable or inheritable)
00508  * revisions that intersect inclusively with the range defined by @a start
00509  * and @a end.
00510  *
00511  * If @a path is not NULL remove (non-inheritable or inheritable) ranges
00512  * only for @a path.
00513  *
00514  * If all ranges are removed for a given path then remove that path as well.
00515  * If @a mergeinfo is initially empty or all paths are removed from it then
00516  * set @a *inheritable_mergeinfo to an empty mergeinfo.
00517  *
00518  * Allocate the copy in @a result_pool, and use @a scratch_pool for
00519  * temporary allocations.
00520  *
00521  * @since New in 1.7.
00522  */
00523 svn_error_t *
00524 svn_mergeinfo_inheritable2(svn_mergeinfo_t *inheritable_mergeinfo,
00525                            svn_mergeinfo_t mergeinfo,
00526                            const char *path,
00527                            svn_revnum_t start,
00528                            svn_revnum_t end,
00529                            svn_boolean_t inheritable,
00530                            apr_pool_t *result_pool,
00531                            apr_pool_t *scratch_pool);
00532 
00533 /** Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo.
00534  *
00535  * @since New in 1.5.
00536  * @deprecated Provided for backward compatibility with the 1.6 API.
00537  */
00538 SVN_DEPRECATED
00539 svn_error_t *
00540 svn_mergeinfo_inheritable(svn_mergeinfo_t *inheritable_mergeinfo,
00541                           svn_mergeinfo_t mergeinfo,
00542                           const char *path,
00543                           svn_revnum_t start,
00544                           svn_revnum_t end,
00545                           apr_pool_t *pool);
00546 
00547 /** Take a mergeinfo in @a mergeinput, and convert it to unparsed
00548  *  mergeinfo. Set @a *output to the result, allocated in @a pool.
00549  *  If @a input contains no elements, set @a *output to the empty string.
00550  *
00551  * @a mergeinput may contain relative merge source paths, but these are
00552  * converted to absolute paths in @a *output.
00553  *
00554  * @since New in 1.5.
00555 */
00556 svn_error_t *
00557 svn_mergeinfo_to_string(svn_string_t **output,
00558                         svn_mergeinfo_t mergeinput,
00559                         apr_pool_t *pool);
00560 
00561 /** Take a hash of mergeinfo in @a mergeinfo, and sort the rangelists
00562  * associated with each key (in place).
00563  *
00564  * TODO(miapi): mergeinfos should *always* be sorted.  This should be
00565  * a private function.
00566  *
00567  * @since New in 1.5
00568  */
00569 svn_error_t *
00570 svn_mergeinfo_sort(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
00571 
00572 /** Return a deep copy of @a mergeinfo_catalog, allocated in @a pool.
00573  *
00574  * @since New in 1.6.
00575  */
00576 svn_mergeinfo_catalog_t
00577 svn_mergeinfo_catalog_dup(svn_mergeinfo_catalog_t mergeinfo_catalog,
00578                           apr_pool_t *pool);
00579 
00580 /** Return a deep copy of @a mergeinfo, allocated in @a pool.
00581  *
00582  * @since New in 1.5.
00583  */
00584 svn_mergeinfo_t
00585 svn_mergeinfo_dup(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
00586 
00587 /** Return a deep copy of @a rangelist, allocated in @a pool.
00588  *
00589  * @since New in 1.5.
00590  */
00591 svn_rangelist_t *
00592 svn_rangelist_dup(const svn_rangelist_t *rangelist, apr_pool_t *pool);
00593 
00594 
00595 /**
00596  * The three ways to request mergeinfo affecting a given path.
00597  *
00598  * @since New in 1.5.
00599  */
00600 typedef enum svn_mergeinfo_inheritance_t
00601 {
00602   /** Explicit mergeinfo only. */
00603   svn_mergeinfo_explicit,
00604 
00605   /** Explicit mergeinfo, or if that doesn't exist, the inherited
00606       mergeinfo from a target's nearest (path-wise, not history-wise)
00607       ancestor. */
00608   svn_mergeinfo_inherited,
00609 
00610   /** Mergeinfo inherited from a target's nearest (path-wise, not
00611       history-wise) ancestor, regardless of whether target has explicit
00612       mergeinfo. */
00613   svn_mergeinfo_nearest_ancestor
00614 } svn_mergeinfo_inheritance_t;
00615 
00616 /** Return a constant string expressing @a inherit as an English word,
00617  * i.e., "explicit" (default), "inherited", or "nearest_ancestor".
00618  * The string is not localized, as it may be used for client<->server
00619  * communications.
00620  *
00621  * @since New in 1.5.
00622  */
00623 const char *
00624 svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit);
00625 
00626 
00627 /** Return the appropriate @c svn_mergeinfo_inheritance_t for @a word.
00628  * @a word is as returned from svn_inheritance_to_word().  Defaults to
00629  * @c svn_mergeinfo_explicit.
00630  *
00631  * @since New in 1.5.
00632  */
00633 svn_mergeinfo_inheritance_t
00634 svn_inheritance_from_word(const char *word);
00635 
00636 
00637 #ifdef __cplusplus
00638 }
00639 #endif /* __cplusplus */
00640 
00641 #endif /* SVN_MERGEINFO_H */

Generated on Thu Aug 27 17:53:03 2015 for Subversion by  doxygen 1.4.7