Subversion
|
mergeinfo handling and processing More...
#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_string.h"
Go to the source code of this file.
Macros | |
#define | SVN_MERGEINFO_NONINHERITABLE_STR "*" |
Overview of the SVN_PROP_MERGEINFO property. More... | |
Typedefs | |
typedef apr_array_header_t | svn_rangelist_t |
Terminology for data structures that contain mergeinfo. More... | |
typedef apr_hash_t * | svn_mergeinfo_t |
A hash mapping merge source paths to non-empty rangelist arrays. More... | |
typedef apr_hash_t * | svn_mergeinfo_catalog_t |
A hash mapping paths (const char *) to svn_mergeinfo_t . More... | |
typedef enum svn_mergeinfo_inheritance_t | svn_mergeinfo_inheritance_t |
The three ways to request mergeinfo affecting a given path. More... | |
Enumerations | |
enum | svn_mergeinfo_inheritance_t { svn_mergeinfo_explicit, svn_mergeinfo_inherited, svn_mergeinfo_nearest_ancestor } |
The three ways to request mergeinfo affecting a given path. More... | |
Functions | |
svn_error_t * | svn_mergeinfo_parse (svn_mergeinfo_t *mergeinfo, const char *input, apr_pool_t *pool) |
Parse the mergeinfo from input into *mergeinfo. More... | |
svn_error_t * | svn_mergeinfo_diff2 (svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, svn_boolean_t consider_inheritance, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Calculate the delta between two mergeinfos, mergefrom and mergeto (either or both of which may be NULL meaning an empty mergeinfo). More... | |
svn_error_t * | svn_mergeinfo_diff (svn_mergeinfo_t *deleted, svn_mergeinfo_t *added, svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto, svn_boolean_t consider_inheritance, apr_pool_t *pool) |
Similar to svn_mergeinfo_diff2(), but users only one pool. More... | |
svn_error_t * | svn_mergeinfo_merge2 (svn_mergeinfo_t mergeinfo, svn_mergeinfo_t changes, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Merge a shallow copy of one mergeinfo, changes, into another mergeinfo mergeinfo. More... | |
svn_error_t * | svn_mergeinfo_merge (svn_mergeinfo_t mergeinfo, svn_mergeinfo_t changes, apr_pool_t *pool) |
Like svn_mergeinfo_merge2, but uses only one pool. More... | |
svn_error_t * | svn_mergeinfo_catalog_merge (svn_mergeinfo_catalog_t mergeinfo_catalog, svn_mergeinfo_catalog_t changes_catalog, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Combine one mergeinfo catalog, changes_catalog, into another mergeinfo catalog mergeinfo_catalog. More... | |
svn_error_t * | svn_mergeinfo_remove (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser, svn_mergeinfo_t whiteboard, apr_pool_t *pool) |
Like svn_mergeinfo_remove2, but always considers inheritance. More... | |
svn_error_t * | svn_mergeinfo_remove2 (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser, svn_mergeinfo_t whiteboard, svn_boolean_t consider_inheritance, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in *mergeinfo. More... | |
svn_error_t * | svn_rangelist_diff (svn_rangelist_t **deleted, svn_rangelist_t **added, const svn_rangelist_t *from, const svn_rangelist_t *to, svn_boolean_t consider_inheritance, apr_pool_t *pool) |
Calculate the delta between two rangelists consisting of svn_merge_range_t * elements (sorted in ascending order), from and to, and place the result in *deleted and *added (neither output argument will ever be NULL ). More... | |
svn_error_t * | svn_rangelist_merge2 (svn_rangelist_t *rangelist, const svn_rangelist_t *changes, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Merge two rangelists consisting of svn_merge_range_t * elements, rangelist and changes, placing the results in rangelist. More... | |
svn_error_t * | svn_rangelist_merge (svn_rangelist_t **rangelist, const svn_rangelist_t *changes, apr_pool_t *pool) |
Like svn_rangelist_merge2(), but with rangelist as an input/output argument. More... | |
svn_error_t * | svn_rangelist_remove (svn_rangelist_t **output, const svn_rangelist_t *eraser, const svn_rangelist_t *whiteboard, svn_boolean_t consider_inheritance, apr_pool_t *pool) |
Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in output. More... | |
svn_error_t * | svn_mergeinfo_intersect2 (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t mergeinfo1, svn_mergeinfo_t mergeinfo2, svn_boolean_t consider_inheritance, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Find the intersection of two mergeinfos, mergeinfo1 and mergeinfo2, and place the result in *mergeinfo, which is (deeply) allocated in result_pool. More... | |
svn_error_t * | svn_mergeinfo_intersect (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t mergeinfo1, svn_mergeinfo_t mergeinfo2, apr_pool_t *pool) |
Like svn_mergeinfo_intersect2, but always considers inheritance. More... | |
svn_error_t * | svn_rangelist_intersect (svn_rangelist_t **rangelist, const svn_rangelist_t *rangelist1, const svn_rangelist_t *rangelist2, svn_boolean_t consider_inheritance, apr_pool_t *pool) |
Find the intersection of two rangelists consisting of svn_merge_range_t * elements, rangelist1 and rangelist2, and place the result in *rangelist (which is never NULL ). More... | |
svn_error_t * | svn_rangelist_reverse (svn_rangelist_t *rangelist, apr_pool_t *pool) |
Reverse rangelist, and the start and end fields of each range in rangelist, in place. More... | |
svn_error_t * | svn_rangelist_to_string (svn_string_t **output, const svn_rangelist_t *rangelist, apr_pool_t *pool) |
Take an array of svn_merge_range_t *'s in rangelist, and convert it back to a text format rangelist in output. More... | |
svn_error_t * | svn_rangelist_inheritable2 (svn_rangelist_t **inheritable_rangelist, const svn_rangelist_t *rangelist, svn_revnum_t start, svn_revnum_t end, svn_boolean_t inheritable, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Remove non-inheritable or inheritable revision ranges from a rangelist. More... | |
svn_error_t * | svn_rangelist_inheritable (svn_rangelist_t **inheritable_rangelist, const svn_rangelist_t *rangelist, svn_revnum_t start, svn_revnum_t end, apr_pool_t *pool) |
Like svn_rangelist_inheritable2, but always finds inheritable ranges. More... | |
svn_error_t * | svn_mergeinfo_inheritable2 (svn_mergeinfo_t *inheritable_mergeinfo, svn_mergeinfo_t mergeinfo, const char *path, svn_revnum_t start, svn_revnum_t end, svn_boolean_t inheritable, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Remove non-inheritable or inheritable revision ranges from mergeinfo. More... | |
svn_error_t * | svn_mergeinfo_inheritable (svn_mergeinfo_t *inheritable_mergeinfo, svn_mergeinfo_t mergeinfo, const char *path, svn_revnum_t start, svn_revnum_t end, apr_pool_t *pool) |
Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo. More... | |
svn_error_t * | svn_mergeinfo_to_string (svn_string_t **output, svn_mergeinfo_t mergeinput, apr_pool_t *pool) |
Take a mergeinfo in mergeinput, and convert it to unparsed mergeinfo. More... | |
svn_error_t * | svn_mergeinfo_sort (svn_mergeinfo_t mergeinfo, apr_pool_t *pool) |
Take a hash of mergeinfo in mergeinfo, and sort the rangelists associated with each key (in place). More... | |
svn_mergeinfo_catalog_t | svn_mergeinfo_catalog_dup (svn_mergeinfo_catalog_t mergeinfo_catalog, apr_pool_t *pool) |
Return a deep copy of mergeinfo_catalog, allocated in pool. More... | |
svn_mergeinfo_t | svn_mergeinfo_dup (svn_mergeinfo_t mergeinfo, apr_pool_t *pool) |
Return a deep copy of mergeinfo, allocated in pool. More... | |
svn_rangelist_t * | svn_rangelist_dup (const svn_rangelist_t *rangelist, apr_pool_t *pool) |
Return a deep copy of rangelist, allocated in pool. More... | |
const char * | svn_inheritance_to_word (svn_mergeinfo_inheritance_t inherit) |
Return a constant string expressing inherit as an English word, i.e., "explicit" (default), "inherited", or "nearest_ancestor". More... | |
svn_mergeinfo_inheritance_t | svn_inheritance_from_word (const char *word) |
Return the appropriate svn_mergeinfo_inheritance_t for word. More... | |
mergeinfo handling and processing
Definition in file svn_mergeinfo.h.
#define SVN_MERGEINFO_NONINHERITABLE_STR "*" |
Overview of the SVN_PROP_MERGEINFO
property.
Merge history is stored in the SVN_PROP_MERGEINFO
property of files and directories. The SVN_PROP_MERGEINFO
property on a path stores the complete list of changes merged to that path, either directly or via the path's parent, grand-parent, etc.. A path may have empty mergeinfo which means that nothing has been merged to that path or all previous merges to the path were reversed. Note that a path may have no mergeinfo, this is not the same as empty mergeinfo.
Every path in a tree may have SVN_PROP_MERGEINFO
set, but if the SVN_PROP_MERGEINFO
for a path is equivalent to the SVN_PROP_MERGEINFO
for its parent, then the SVN_PROP_MERGEINFO
on the path will 'elide' (be removed) from the path as a post step to any merge. If a path's parent does not have any SVN_PROP_MERGEINFO
set, the path's mergeinfo can elide to its nearest grand-parent, great-grand-parent, etc. that has equivalent SVN_PROP_MERGEINFO
set on it.
If a path has no SVN_PROP_MERGEINFO
of its own, it inherits mergeinfo from its nearest parent that has SVN_PROP_MERGEINFO
set. The exception to this is SVN_PROP_MERGEINFO
with non-inheritable revision ranges. These non-inheritable ranges apply only to the path which they are set on.
Due to Subversion's allowance for mixed revision working copies, both elision and inheritance within the working copy presume the path between a path and its nearest parent with mergeinfo is at the same working revision. If this is not the case then neither inheritance nor elision can occur.
The value of the SVN_PROP_MERGEINFO
property is either an empty string (representing empty mergeinfo) or a non-empty string consisting of a path, a colon, and comma separated revision list, containing one or more revision or revision ranges. Revision range start and end points are separated by "-". Revisions and revision ranges may have the optional SVN_MERGEINFO_NONINHERITABLE_STR
suffix to signify a non-inheritable revision/revision range.
SVN_PROP_MERGEINFO
Value Grammar:
Token Definition
revisionrange REVISION1 "-" REVISION2 revisioneelement (revisionrange | REVISION)"*"? rangelist revisioneelement (COMMA revisioneelement)* revisionline PATHNAME COLON rangelist top "" | (revisionline (NEWLINE revisionline))*
The PATHNAME is the source of a merge and the rangelist the revision(s) merged to the path SVN_PROP_MERGEINFO
is set on directly or indirectly via inheritance. PATHNAME must always exist at the specified rangelist and thus a single merge may result in multiple revisionlines if the source was renamed.
Rangelists must be sorted from lowest to highest revision and cannot contain overlapping revisionlistelements. REVISION1 must be less than REVISION2. Consecutive single revisions that can be represented by a revisionrange are allowed however (e.g. '5,6,7,8,9-12' or '5-12' are both acceptable). Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given range is non-inheritable.
Definition at line 107 of file svn_mergeinfo.h.
typedef apr_hash_t* svn_mergeinfo_catalog_t |
A hash mapping paths (const
char *) to svn_mergeinfo_t
.
Definition at line 150 of file svn_mergeinfo.h.
typedef enum svn_mergeinfo_inheritance_t svn_mergeinfo_inheritance_t |
The three ways to request mergeinfo affecting a given path.
typedef apr_hash_t* svn_mergeinfo_t |
A hash mapping merge source paths to non-empty rangelist arrays.
The keys are (const
char *) absolute paths from the repository root, starting with slashes. A NULL
hash represents no mergeinfo and an empty hash represents empty mergeinfo.
Definition at line 142 of file svn_mergeinfo.h.
typedef apr_array_header_t svn_rangelist_t |
Terminology for data structures that contain mergeinfo.
Subversion commonly uses several data structures to represent mergeinfo in RAM:
(a) Strings (svn_string_t
*) containing "unparsed mergeinfo".
(b) svn_rangelist_t
, called a "rangelist".
(c) svn_mergeinfo_t
, called "mergeinfo".
(d) svn_mergeinfo_catalog_t
, called a "mergeinfo catalog".
Both svn_mergeinfo_t
and svn_mergeinfo_catalog_t
are just typedefs for apr_hash_t
*; there is no static type-checking, and you still use standard apr_hash_t
functions to interact with them. An array of non-overlapping merge ranges (svn_merge_range_t
*), sorted as said by svn_sort_compare_ranges()
. An empty range list is represented by an empty array.
Unless specifically noted otherwise, all APIs require rangelists that describe only forward ranges, i.e. the range's start revision is less than its end revision.
Definition at line 135 of file svn_mergeinfo.h.
The three ways to request mergeinfo affecting a given path.
Definition at line 600 of file svn_mergeinfo.h.
svn_mergeinfo_inheritance_t svn_inheritance_from_word | ( | const char * | word | ) |
Return the appropriate svn_mergeinfo_inheritance_t
for word.
word is as returned from svn_inheritance_to_word(). Defaults to svn_mergeinfo_explicit
.
const char* svn_inheritance_to_word | ( | svn_mergeinfo_inheritance_t | inherit | ) |
Return a constant string expressing inherit as an English word, i.e., "explicit" (default), "inherited", or "nearest_ancestor".
The string is not localized, as it may be used for client<->server communications.
svn_mergeinfo_catalog_t svn_mergeinfo_catalog_dup | ( | svn_mergeinfo_catalog_t | mergeinfo_catalog, |
apr_pool_t * | pool | ||
) |
Return a deep copy of mergeinfo_catalog, allocated in pool.
svn_error_t* svn_mergeinfo_catalog_merge | ( | svn_mergeinfo_catalog_t | mergeinfo_catalog, |
svn_mergeinfo_catalog_t | changes_catalog, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Combine one mergeinfo catalog, changes_catalog, into another mergeinfo catalog mergeinfo_catalog.
If both catalogs have mergeinfo for the same key, use svn_mergeinfo_merge() to combine the mergeinfos.
Additions to mergeinfo_catalog are deep copies allocated in result_pool. Temporary allocations are made in scratch_pool.
svn_error_t* svn_mergeinfo_diff | ( | svn_mergeinfo_t * | deleted, |
svn_mergeinfo_t * | added, | ||
svn_mergeinfo_t | mergefrom, | ||
svn_mergeinfo_t | mergeto, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_mergeinfo_diff2(), but users only one pool.
svn_error_t* svn_mergeinfo_diff2 | ( | svn_mergeinfo_t * | deleted, |
svn_mergeinfo_t * | added, | ||
svn_mergeinfo_t | mergefrom, | ||
svn_mergeinfo_t | mergeto, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Calculate the delta between two mergeinfos, mergefrom and mergeto (either or both of which may be NULL
meaning an empty mergeinfo).
Place the result in *deleted and *added (neither output argument may be NULL
), both allocated in result_pool. The resulting *deleted and *added will not be null.
consider_inheritance determines how the rangelists in the two hashes are compared for equality. If consider_inheritance is FALSE, then the start and end revisions of the svn_merge_range_t's
being compared are the only factors considered when determining equality.
e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5'
If consider_inheritance is TRUE, then the inheritability of the svn_merge_range_t's
is also considered and must be the same for two otherwise identical ranges to be judged equal.
e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5' '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5' '/trunk: 1,3-4,5' == '/trunk: 1,3-4,5'
svn_mergeinfo_t svn_mergeinfo_dup | ( | svn_mergeinfo_t | mergeinfo, |
apr_pool_t * | pool | ||
) |
Return a deep copy of mergeinfo, allocated in pool.
svn_error_t* svn_mergeinfo_inheritable | ( | svn_mergeinfo_t * | inheritable_mergeinfo, |
svn_mergeinfo_t | mergeinfo, | ||
const char * | path, | ||
svn_revnum_t | start, | ||
svn_revnum_t | end, | ||
apr_pool_t * | pool | ||
) |
Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo.
svn_error_t* svn_mergeinfo_inheritable2 | ( | svn_mergeinfo_t * | inheritable_mergeinfo, |
svn_mergeinfo_t | mergeinfo, | ||
const char * | path, | ||
svn_revnum_t | start, | ||
svn_revnum_t | end, | ||
svn_boolean_t | inheritable, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Remove non-inheritable or inheritable revision ranges from mergeinfo.
Set *inheritable_mergeinfo to a deep copy of mergeinfo, excluding all non-inheritable svn_merge_range_t
if inheritable is TRUE or excluding all inheritable svn_merge_range_t
otherwise.
If start and end are valid revisions and start is less than or equal to end, then exclude only the (non-inheritable or inheritable) revisions that intersect inclusively with the range defined by start and end.
If path is not NULL remove (non-inheritable or inheritable) ranges only for path.
If all ranges are removed for a given path then remove that path as well. If mergeinfo is initially empty or all paths are removed from it then set *inheritable_mergeinfo to an empty mergeinfo.
Allocate the copy in result_pool, and use scratch_pool for temporary allocations.
svn_error_t* svn_mergeinfo_intersect | ( | svn_mergeinfo_t * | mergeinfo, |
svn_mergeinfo_t | mergeinfo1, | ||
svn_mergeinfo_t | mergeinfo2, | ||
apr_pool_t * | pool | ||
) |
Like svn_mergeinfo_intersect2, but always considers inheritance.
svn_error_t* svn_mergeinfo_intersect2 | ( | svn_mergeinfo_t * | mergeinfo, |
svn_mergeinfo_t | mergeinfo1, | ||
svn_mergeinfo_t | mergeinfo2, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Find the intersection of two mergeinfos, mergeinfo1 and mergeinfo2, and place the result in *mergeinfo, which is (deeply) allocated in result_pool.
Temporary allocations will be performed in scratch_pool.
consider_inheritance determines how to account for the inheritability of the two mergeinfo's ranges when calculating the range equivalence,
svn_error_t* svn_mergeinfo_merge | ( | svn_mergeinfo_t | mergeinfo, |
svn_mergeinfo_t | changes, | ||
apr_pool_t * | pool | ||
) |
Like svn_mergeinfo_merge2, but uses only one pool.
svn_error_t* svn_mergeinfo_merge2 | ( | svn_mergeinfo_t | mergeinfo, |
svn_mergeinfo_t | changes, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Merge a shallow copy of one mergeinfo, changes, into another mergeinfo mergeinfo.
Rangelists for merge source paths common to changes and mergeinfo may result in new rangelists; these are allocated in result_pool. Temporary allocations are made in scratch_pool.
When intersecting rangelists for a path are merged, the inheritability of the resulting svn_merge_range_t depends on the inheritability of the operands. If two non-inheritable ranges are merged the result is always non-inheritable, in all other cases the resulting range is inheritable.
e.g. '/A: 1,3-4' merged with '/A: 1,3,4*,5' –> '/A: 1,3-5' '/A: 1,3-4*' merged with '/A: 1,3,4*,5' –> '/A: 1,3,4*,5'
svn_error_t* svn_mergeinfo_parse | ( | svn_mergeinfo_t * | mergeinfo, |
const char * | input, | ||
apr_pool_t * | pool | ||
) |
Parse the mergeinfo from input into *mergeinfo.
If no mergeinfo is available, return an empty mergeinfo (never NULL
).
If input is not a grammatically correct SVN_PROP_MERGEINFO
property, contains overlapping revision ranges of differing inheritability, or revision ranges with a start revision greater than or equal to its end revision, or contains paths mapped to empty revision ranges, then return SVN_ERR_MERGEINFO_PARSE_ERROR
. Unordered revision ranges are allowed, but will be sorted when placed into *mergeinfo. Overlapping revision ranges of the same inheritability are also allowed, but will be combined into a single range when placed into *mergeinfo.
input may contain relative merge source paths, but these are converted to absolute paths in *mergeinfo.
Allocate the result deeply in pool. Also perform temporary allocations in pool.
svn_error_t* svn_mergeinfo_remove | ( | svn_mergeinfo_t * | mergeinfo, |
svn_mergeinfo_t | eraser, | ||
svn_mergeinfo_t | whiteboard, | ||
apr_pool_t * | pool | ||
) |
Like svn_mergeinfo_remove2, but always considers inheritance.
svn_error_t* svn_mergeinfo_remove2 | ( | svn_mergeinfo_t * | mergeinfo, |
svn_mergeinfo_t | eraser, | ||
svn_mergeinfo_t | whiteboard, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in *mergeinfo.
Allocates *mergeinfo in result_pool. Temporary allocations will be performed in scratch_pool.
consider_inheritance determines how to account for the inheritability of the two mergeinfo's ranges when calculating the range equivalence, as described for svn_mergeinfo_diff().
svn_error_t* svn_mergeinfo_sort | ( | svn_mergeinfo_t | mergeinfo, |
apr_pool_t * | pool | ||
) |
Take a hash of mergeinfo in mergeinfo, and sort the rangelists associated with each key (in place).
TODO(miapi): mergeinfos should always be sorted. This should be a private function.
svn_error_t* svn_mergeinfo_to_string | ( | svn_string_t ** | output, |
svn_mergeinfo_t | mergeinput, | ||
apr_pool_t * | pool | ||
) |
Take a mergeinfo in mergeinput, and convert it to unparsed mergeinfo.
Set *output to the result, allocated in pool. If input contains no elements, set *output to the empty string.
mergeinput may contain relative merge source paths, but these are converted to absolute paths in *output.
svn_error_t* svn_rangelist_diff | ( | svn_rangelist_t ** | deleted, |
svn_rangelist_t ** | added, | ||
const svn_rangelist_t * | from, | ||
const svn_rangelist_t * | to, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | pool | ||
) |
Calculate the delta between two rangelists consisting of svn_merge_range_t
* elements (sorted in ascending order), from and to, and place the result in *deleted and *added (neither output argument will ever be NULL
).
consider_inheritance determines how to account for the inheritability of the two rangelist's ranges when calculating the diff, as described for svn_mergeinfo_diff().
svn_rangelist_t* svn_rangelist_dup | ( | const svn_rangelist_t * | rangelist, |
apr_pool_t * | pool | ||
) |
Return a deep copy of rangelist, allocated in pool.
svn_error_t* svn_rangelist_inheritable | ( | svn_rangelist_t ** | inheritable_rangelist, |
const svn_rangelist_t * | rangelist, | ||
svn_revnum_t | start, | ||
svn_revnum_t | end, | ||
apr_pool_t * | pool | ||
) |
Like svn_rangelist_inheritable2, but always finds inheritable ranges.
svn_error_t* svn_rangelist_inheritable2 | ( | svn_rangelist_t ** | inheritable_rangelist, |
const svn_rangelist_t * | rangelist, | ||
svn_revnum_t | start, | ||
svn_revnum_t | end, | ||
svn_boolean_t | inheritable, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Remove non-inheritable or inheritable revision ranges from a rangelist.
Set *inheritable_rangelist to a deep copy of rangelist, excluding all non-inheritable svn_merge_range_t
if inheritable is TRUE or excluding all inheritable svn_merge_range_t
otherwise.
If start and end are valid revisions and start is less than or equal to end, then exclude only the (non-inheritable or inheritable) revision ranges that intersect inclusively with the range defined by start and end.
If there are no remaining ranges, return an empty array.
Allocate the copy in result_pool, and use scratch_pool for temporary allocations.
svn_error_t* svn_rangelist_intersect | ( | svn_rangelist_t ** | rangelist, |
const svn_rangelist_t * | rangelist1, | ||
const svn_rangelist_t * | rangelist2, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | pool | ||
) |
Find the intersection of two rangelists consisting of svn_merge_range_t
* elements, rangelist1 and rangelist2, and place the result in *rangelist (which is never NULL
).
consider_inheritance determines how to account for the inheritability of the two rangelist's ranges when calculating the intersection,
Note: rangelist1 and rangelist2 must be sorted as said by svn_sort_compare_ranges()
. *rangelist is guaranteed to be in sorted order.
Allocate the entire output in pool.
svn_error_t* svn_rangelist_merge | ( | svn_rangelist_t ** | rangelist, |
const svn_rangelist_t * | changes, | ||
apr_pool_t * | pool | ||
) |
Like svn_rangelist_merge2(), but with rangelist as an input/output argument.
This function always allocates a new rangelist in pool and returns its result in *rangelist. It does not modify *rangelist in place. If not used carefully, this function can use up a lot of memory if called in a loop.
It performs an extra adjacent range compaction round to make sure non collapsed input ranges are compacted in the result.
svn_error_t* svn_rangelist_merge2 | ( | svn_rangelist_t * | rangelist, |
const svn_rangelist_t * | changes, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Merge two rangelists consisting of svn_merge_range_t
* elements, rangelist and changes, placing the results in rangelist.
New elements added to rangelist are allocated in result_pool. Either rangelist may be empty.
When intersecting rangelists are merged, the inheritability of the resulting svn_merge_range_t depends on the inheritability of the operands: see svn_mergeinfo_merge().
Note: rangelist and changes must be sorted as said by svn_sort_compare_ranges()
. rangelist is guaranteed to remain in sorted order and be compacted to the minimal number of ranges needed to represent the merged result.
If the original rangelist contains non-collapsed adjacent ranges, the final result is not guaranteed to be compacted either.
Use scratch_pool for temporary allocations.
svn_error_t* svn_rangelist_remove | ( | svn_rangelist_t ** | output, |
const svn_rangelist_t * | eraser, | ||
const svn_rangelist_t * | whiteboard, | ||
svn_boolean_t | consider_inheritance, | ||
apr_pool_t * | pool | ||
) |
Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in output.
Note: eraser and whiteboard must be sorted as said by svn_sort_compare_ranges()
. output is guaranteed to be in sorted order.
consider_inheritance determines how to account for the svn_merge_range_t
inheritable field when comparing whiteboard's and *eraser's rangelists for equality.
Allocate the entire output in pool.
svn_error_t* svn_rangelist_reverse | ( | svn_rangelist_t * | rangelist, |
apr_pool_t * | pool | ||
) |
Reverse rangelist, and the start
and end
fields of each range in rangelist, in place.
TODO(miapi): Is this really a valid function? Rangelists that aren't sorted, or rangelists containing reverse ranges, are generally not valid in mergeinfo code. Can we rewrite the two places where this is used?
svn_error_t* svn_rangelist_to_string | ( | svn_string_t ** | output, |
const svn_rangelist_t * | rangelist, | ||
apr_pool_t * | pool | ||
) |
Take an array of svn_merge_range_t *'s in rangelist, and convert it back to a text format rangelist in output.
If rangelist contains no elements, sets output to the empty string.