svn_mergeinfo.h File Reference

mergeinfo handling and processing More...

#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_hash.h>
#include "svn_error.h"

Go to the source code of this file.

Typedefs

typedef apr_hash_t * svn_mergeinfo_t
 Terminology for data structures that contain mergeinfo.
typedef apr_hash_t * svn_mergeinfo_catalog_t

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_tsvn_mergeinfo_parse (svn_mergeinfo_t *mergeinfo, const char *input, apr_pool_t *pool)
 Parse the mergeinfo from input into *mergeinfo.
svn_error_tsvn_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)
 Calculate the delta between two mergeinfos, mergefrom and mergeto (which may be NULL), and place the result in *deleted and *added (neither output argument may be NULL).
svn_error_tsvn_mergeinfo_merge (svn_mergeinfo_t mergeinfo, svn_mergeinfo_t changes, apr_pool_t *pool)
 Merge one mergeinfo, changes, into another mergeinfo mergeinfo.
svn_error_tsvn_mergeinfo_remove (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser, svn_mergeinfo_t whiteboard, apr_pool_t *pool)
 Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in *mergeinfo.
svn_error_tsvn_rangelist_diff (apr_array_header_t **deleted, apr_array_header_t **added, apr_array_header_t *from, apr_array_header_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).
svn_error_tsvn_rangelist_merge (apr_array_header_t **rangelist, apr_array_header_t *changes, apr_pool_t *pool)
 Merge two rangelists consisting of svn_merge_range_t * elements, *rangelist and changes, placing the results in *rangelist.
svn_error_tsvn_rangelist_remove (apr_array_header_t **output, apr_array_header_t *eraser, apr_array_header_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.
svn_error_tsvn_mergeinfo_intersect (svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t mergeinfo1, svn_mergeinfo_t mergeinfo2, apr_pool_t *pool)
 Find the intersection of two mergeinfos, mergeinfo1 and mergeinfo2, and place the result in *mergeinfo, which is (deeply) allocated in pool.
svn_error_tsvn_rangelist_intersect (apr_array_header_t **rangelist, apr_array_header_t *rangelist1, apr_array_header_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).
svn_error_tsvn_rangelist_reverse (apr_array_header_t *rangelist, apr_pool_t *pool)
 Reverse rangelist, and the start and end fields of each range in rangelist, in place.
svn_error_tsvn_rangelist_to_string (svn_string_t **output, const apr_array_header_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.
svn_error_tsvn_rangelist_inheritable (apr_array_header_t **inheritable_rangelist, apr_array_header_t *rangelist, svn_revnum_t start, svn_revnum_t end, apr_pool_t *pool)
 Return a deep copy of svn_merge_range_t *'s in rangelist excluding all non-inheritable svn_merge_range_t.
svn_error_tsvn_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)
 Return a deep copy of mergeinfo, excluding all non-inheritable svn_merge_range_t.
svn_error_tsvn_mergeinfo_to_string (svn_string_t **output, svn_mergeinfo_t mergeinput, apr_pool_t *pool)
 Take a mergeinfo in MERGEINPUT, and convert it back to unparsed mergeinfo in *OUTPUT.
svn_error_tsvn_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).
svn_mergeinfo_t svn_mergeinfo_dup (svn_mergeinfo_t mergeinfo, apr_pool_t *pool)
 Return a deep copy of mergeinfo, allocated in pool.
apr_array_header_t * svn_rangelist_dup (apr_array_header_t *rangelist, apr_pool_t *pool)
 Return a deep copy of rangelist, allocated in pool.
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".
svn_mergeinfo_inheritance_t svn_inheritance_from_word (const char *word)
 Return the appropriate svn_mergeinfo_inheritance_t for word.


Detailed Description

mergeinfo handling and processing

Definition in file svn_mergeinfo.h.


Typedef Documentation

typedef apr_hash_t* svn_mergeinfo_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) A "rangelist". An array (apr_array_header_t *) 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.

(c) svn_mergeinfo_t, called "mergeinfo". A hash mapping merge source paths (const char *, starting with slashes) to non-empty rangelist arrays. A NULL hash is used to represent no mergeinfo and an empty hash is used to represent empty mergeinfo.

(d) svn_mergeinfo_catalog_t, called a "mergeinfo catalog". A hash mapping paths (const char *, starting with slashes) to svn_mergeinfo_t.

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.

Note that while the keys of mergeinfos are always relative to the repository root, the keys of a catalog may be relative to something else, such as an RA session root.

Definition at line 137 of file svn_mergeinfo.h.


Enumeration Type Documentation

enum svn_mergeinfo_inheritance_t
 

The three ways to request mergeinfo affecting a given path.

Since:
New in 1.5.
Enumeration values:
svn_mergeinfo_explicit  Explicit mergeinfo only.
svn_mergeinfo_inherited  Explicit mergeinfo, or if that doesn't exist, the inherited mergeinfo from a target's nearest (path-wise, not history-wise) ancestor.
svn_mergeinfo_nearest_ancestor  Mergeinfo on target's nearest (path-wise, not history-wise) ancestor, regardless of whether target has explict mergeinfo.

Definition at line 396 of file svn_mergeinfo.h.


Function Documentation

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.

Since:
New in 1.5.

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.

Since:
New in 1.5.

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
 

Calculate the delta between two mergeinfos, mergefrom and mergeto (which may be NULL), and place the result in *deleted and *added (neither output argument may 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'

Since:
New in 1.5.

svn_mergeinfo_t svn_mergeinfo_dup svn_mergeinfo_t  mergeinfo,
apr_pool_t *  pool
 

Return a deep copy of mergeinfo, allocated in pool.

Since:
New in 1.5.

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
 

Return a deep copy of mergeinfo, excluding all non-inheritable svn_merge_range_t.

If start and end are valid revisions and start is less than or equal to end, then exclude only the non-inheritable revisions that intersect inclusively with the range defined by start and end. If path is not NULL remove non-inheritable ranges only for path. Allocate the copy in pool.

Since:
New in 1.5.

svn_error_t* svn_mergeinfo_intersect svn_mergeinfo_t mergeinfo,
svn_mergeinfo_t  mergeinfo1,
svn_mergeinfo_t  mergeinfo2,
apr_pool_t *  pool
 

Find the intersection of two mergeinfos, mergeinfo1 and mergeinfo2, and place the result in *mergeinfo, which is (deeply) allocated in pool.

Since:
New in 1.5.

svn_error_t* svn_mergeinfo_merge svn_mergeinfo_t  mergeinfo,
svn_mergeinfo_t  changes,
apr_pool_t *  pool
 

Merge one mergeinfo, changes, into another mergeinfo mergeinfo.

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'

Since:
New in 1.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). Perform temporary allocations in pool.

If input is not a grammatically correct SVN_PROP_MERGEINFO property, contains overlapping or unordered revision ranges, 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.

Since:
New in 1.5.

svn_error_t* svn_mergeinfo_remove svn_mergeinfo_t mergeinfo,
svn_mergeinfo_t  eraser,
svn_mergeinfo_t  whiteboard,
apr_pool_t *  pool
 

Removes eraser (the subtrahend) from whiteboard (the minuend), and places the resulting difference in *mergeinfo.

Since:
New in 1.5.

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.

Since:
New in 1.5

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 back to unparsed mergeinfo in *OUTPUT.

If INPUT contains no elements, return the empty string.

Since:
New in 1.5.

svn_error_t* svn_rangelist_diff apr_array_header_t **  deleted,
apr_array_header_t **  added,
apr_array_header_t *  from,
apr_array_header_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,

See also:
svn_mergeinfo_diff().
Since:
New in 1.5.

apr_array_header_t* svn_rangelist_dup apr_array_header_t *  rangelist,
apr_pool_t *  pool
 

Return a deep copy of rangelist, allocated in pool.

Since:
New in 1.5.

svn_error_t* svn_rangelist_inheritable apr_array_header_t **  inheritable_rangelist,
apr_array_header_t *  rangelist,
svn_revnum_t  start,
svn_revnum_t  end,
apr_pool_t *  pool
 

Return a deep copy of svn_merge_range_t *'s in rangelist excluding all non-inheritable svn_merge_range_t.

If start and end are valid revisions and start is less than or equal to end, then exclude only the non-inheritable revision ranges that intersect inclusively with the range defined by start and end. If rangelist contains no elements, return an empty array. Allocate the copy in pool.

Since:
New in 1.5.

svn_error_t* svn_rangelist_intersect apr_array_header_t **  rangelist,
apr_array_header_t *  rangelist1,
apr_array_header_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,

See also:
svn_mergeinfo_diff().
Note: rangelist1 and rangelist2 must be sorted as said by svn_sort_compare_ranges(). *rangelist is guaranteed to be in sorted order.
Since:
New in 1.5.

svn_error_t* svn_rangelist_merge apr_array_header_t **  rangelist,
apr_array_header_t *  changes,
apr_pool_t *  pool
 

Merge two rangelists consisting of svn_merge_range_t * elements, *rangelist and changes, placing the results in *rangelist.

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 also:
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.

Since:
New in 1.5.

svn_error_t* svn_rangelist_remove apr_array_header_t **  output,
apr_array_header_t *  eraser,
apr_array_header_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.

See also:
svn_mergeinfo_diff().
Since:
New in 1.5.

svn_error_t* svn_rangelist_reverse apr_array_header_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?

Since:
New in 1.5.

svn_error_t* svn_rangelist_to_string svn_string_t **  output,
const apr_array_header_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.

Since:
New in 1.5.


Generated on Tue Oct 7 04:09:57 2008 for Subversion by  doxygen 1.3.9.1