summaryrefslogtreecommitdiff
path: root/subversion/libsvn_client/mergeinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_client/mergeinfo.h')
-rw-r--r--subversion/libsvn_client/mergeinfo.h171
1 files changed, 103 insertions, 68 deletions
diff --git a/subversion/libsvn_client/mergeinfo.h b/subversion/libsvn_client/mergeinfo.h
index bd5ae0e..0c4cf05 100644
--- a/subversion/libsvn_client/mergeinfo.h
+++ b/subversion/libsvn_client/mergeinfo.h
@@ -26,6 +26,7 @@
#include "svn_wc.h"
#include "svn_client.h"
+#include "private/svn_client_private.h"
/*** Data Structures ***/
@@ -40,7 +41,9 @@ typedef struct svn_client__merge_path_t
{
const char *abspath; /* Absolute working copy path. */
svn_boolean_t missing_child; /* ABSPATH has an immediate child which
- is missing. */
+ is missing, but is not switched. */
+ svn_boolean_t switched_child; /* ABSPATH has an immediate child which
+ is switched. */
svn_boolean_t switched; /* ABSPATH is switched. */
svn_boolean_t has_noninheritable; /* ABSPATH has svn:mergeinfo set on it
which includes non-inheritable
@@ -49,7 +52,7 @@ typedef struct svn_client__merge_path_t
probably due to authz
restrictions. */
- svn_boolean_t child_of_noninheritable; /* ABSPATH has no explict mergeinfo
+ svn_boolean_t child_of_noninheritable; /* ABSPATH has no explicit mergeinfo
itself but is the child of a
path with noniheritable
mergeinfo. */
@@ -62,7 +65,7 @@ typedef struct svn_client__merge_path_t
with the youngest start revisions come first. In both the forward and
reverse merge cases the ranges should never overlap. This rangelist
may be empty but should never be NULL unless ABSENT is true. */
- apr_array_header_t *remaining_ranges;
+ svn_rangelist_t *remaining_ranges;
svn_mergeinfo_t pre_merge_mergeinfo; /* Explicit or inherited mergeinfo
on ABSPATH prior to a merge.
@@ -79,6 +82,13 @@ typedef struct svn_client__merge_path_t
to the merge, and the operational
depth of the merge is
svn_depth_immediates. */
+ svn_boolean_t record_mergeinfo; /* Mergeinfo needs to be recorded
+ on ABSPATH to describe the
+ merge. */
+ svn_boolean_t record_noninheritable; /* Non-inheritable mergeinfo needs to
+ be recorded on ABSPATH to describe
+ the merge. Implies RECORD_MERGEINFO
+ is true. */
} svn_client__merge_path_t;
/* Return a deep copy of the merge-path structure OLD, allocated in POOL. */
@@ -86,13 +96,21 @@ svn_client__merge_path_t *
svn_client__merge_path_dup(const svn_client__merge_path_t *old,
apr_pool_t *pool);
+/* Create a new merge path structure, allocated in POOL. Initialize the
+ * 'abspath' member to a deep copy of ABSPATH and all other fields to zero
+ * bytes. */
+svn_client__merge_path_t *
+svn_client__merge_path_create(const char *abspath,
+ apr_pool_t *pool);
+
/*** Functions ***/
/* Find explicit or inherited WC mergeinfo for LOCAL_ABSPATH, and return it
in *MERGEINFO (NULL if no mergeinfo is set). Set *INHERITED to
- whether the mergeinfo was inherited (TRUE or FALSE).
+ whether the mergeinfo was inherited (TRUE or FALSE), if INHERITED is
+ non-null.
This function will search for inherited mergeinfo in the parents of
LOCAL_ABSPATH only if the base revision of LOCAL_ABSPATH falls within
@@ -153,50 +171,54 @@ svn_client__get_wc_mergeinfo_catalog(svn_mergeinfo_catalog_t *mergeinfo_cat,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Obtain any mergeinfo for repository filesystem path REL_PATH
- (relative to RA_SESSION's session URL) from the repository, and set
+/* Obtain any mergeinfo for URL from the repository, and set
it in *TARGET_MERGEINFO.
INHERIT indicates whether explicit, explicit or inherited, or only
- inherited mergeinfo for REL_PATH is obtained.
+ inherited mergeinfo for URL is obtained.
- If REL_PATH does not exist at REV, SVN_ERR_FS_NOT_FOUND or
+ If URL does not exist at REV, SVN_ERR_FS_NOT_FOUND or
SVN_ERR_RA_DAV_REQUEST_FAILED is returned and *TARGET_MERGEINFO
is untouched.
- If there is no mergeinfo available for REL_PATH, or if the server
+ If there is no mergeinfo available for URL, or if the server
doesn't support a mergeinfo capability and SQUELCH_INCAPABLE is
- TRUE, set *TARGET_MERGEINFO to NULL. */
+ TRUE, set *TARGET_MERGEINFO to NULL. If the server doesn't support
+ a mergeinfo capability and SQUELCH_INCAPABLE is FALSE, return an
+ SVN_ERR_UNSUPPORTED_FEATURE error.
+
+ RA_SESSION is an open RA session to the repository in which URL lives;
+ it may be temporarily reparented by this function.
+*/
svn_error_t *
-svn_client__get_repos_mergeinfo(svn_ra_session_t *ra_session,
- svn_mergeinfo_t *target_mergeinfo,
- const char *rel_path,
+svn_client__get_repos_mergeinfo(svn_mergeinfo_t *target_mergeinfo,
+ svn_ra_session_t *ra_session,
+ const char *url,
svn_revnum_t rev,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t squelch_incapable,
apr_pool_t *pool);
/* If INCLUDE_DESCENDANTS is FALSE, behave exactly like
- svn_client__get_repos_mergeinfo() except the mergeinfo for REL_PATH
+ svn_client__get_repos_mergeinfo() except the mergeinfo for URL
is put in the mergeinfo catalog MERGEINFO_CAT, with the key being
- the repository root-relative path of REL_PATH.
+ the repository root-relative path of URL.
- If INCLUDE_DESCENDANTS is true, then any subtrees under REL_PATH
+ If INCLUDE_DESCENDANTS is true, then any subtrees under URL
with explicit mergeinfo are also included in MERGEINFO_CAT. The
keys for the subtree mergeinfo are the repository root-relative
paths of the subtrees. If no mergeinfo is found, then
*TARGET_MERGEINFO_CAT is set to NULL. */
svn_error_t *
-svn_client__get_repos_mergeinfo_catalog(
- svn_mergeinfo_catalog_t *mergeinfo_cat,
- svn_ra_session_t *ra_session,
- const char *rel_path,
- svn_revnum_t rev,
- svn_mergeinfo_inheritance_t inherit,
- svn_boolean_t squelch_incapable,
- svn_boolean_t include_descendants,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_client__get_repos_mergeinfo_catalog(svn_mergeinfo_catalog_t *mergeinfo_cat,
+ svn_ra_session_t *ra_session,
+ const char *url,
+ svn_revnum_t rev,
+ svn_mergeinfo_inheritance_t inherit,
+ svn_boolean_t squelch_incapable,
+ svn_boolean_t include_descendants,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Retrieve the direct mergeinfo for the TARGET_WCPATH from the WC's
mergeinfo prop, or that inherited from its nearest ancestor if the
@@ -225,7 +247,7 @@ svn_client__get_repos_mergeinfo_catalog(
If TARGET_WCPATH inherited its mergeinfo from a working copy ancestor
or if it was obtained from the repository, set *INHERITED to TRUE, set it
- to FALSE otherwise. */
+ to FALSE otherwise, if INHERITED is non-null. */
svn_error_t *
svn_client__get_wc_or_repos_mergeinfo(svn_mergeinfo_t *target_mergeinfo,
svn_boolean_t *inherited,
@@ -268,20 +290,24 @@ svn_client__get_wc_or_repos_mergeinfo_catalog(
apr_pool_t *scratch_pool);
/* Set *MERGEINFO_P to a mergeinfo constructed solely from the
- natural history of PATH_OR_URL@PEG_REVISION. RA_SESSION is an RA
- session whose session URL maps to PATH_OR_URL's URL, or NULL.
- If RANGE_YOUNGEST and RANGE_OLDEST are valid, use them to bound the
- revision ranges of returned mergeinfo. See svn_ra_get_location_segments()
- for the rules governing PEG_REVISION, START_REVISION, and END_REVISION.
+ natural history of PATHREV.
+
+ If RANGE_YOUNGEST and RANGE_OLDEST are valid, use them as inclusive
+ bounds on the revision ranges of returned mergeinfo. PATHREV->rev,
+ RANGE_YOUNGEST and RANGE_OLDEST are governed by the same rules as the
+ PEG_REVISION, START_REV, and END_REV parameters (respectively) of
+ svn_ra_get_location_segments().
If HAS_REV_ZERO_HISTORY is not NULL, then set *HAS_REV_ZERO_HISTORY to
- TRUE if the natural history of PATH_OR_URL@PEG_REVISION includes
- revision 0. Set *HAS_REV_ZERO_HISTORY to FALSE otherwise. */
+ TRUE if the natural history includes revision 0, else to FALSE.
+
+ RA_SESSION is an open RA session to the repository of PATHREV;
+ it may be temporarily reparented by this function.
+*/
svn_error_t *
svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
svn_boolean_t *has_rev_zero_history,
- const char *path_or_url,
- const svn_opt_revision_t *peg_revision,
+ const svn_client__pathrev_t *pathrev,
svn_revnum_t range_youngest,
svn_revnum_t range_oldest,
svn_ra_session_t *ra_session,
@@ -289,7 +315,7 @@ svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
apr_pool_t *pool);
/* Parse any explicit mergeinfo on LOCAL_ABSPATH and store it in
- MERGEINFO. If no record of any mergeinfo exists, set MERGEINFO to NULL.
+ *MERGEINFO. If no record of any mergeinfo exists, set *MERGEINFO to NULL.
Does not acount for inherited mergeinfo. */
svn_error_t *
svn_client__parse_mergeinfo(svn_mergeinfo_t *mergeinfo,
@@ -301,7 +327,7 @@ svn_client__parse_mergeinfo(svn_mergeinfo_t *mergeinfo,
/* Write MERGEINFO into the WC for LOCAL_ABSPATH. If MERGEINFO is NULL,
remove any SVN_PROP_MERGEINFO for LOCAL_ABSPATH. If MERGEINFO is empty,
record an empty property value (e.g. ""). If CTX->NOTIFY_FUNC2 is
- not null call it with notification type svn_wc_notify_update_update
+ not null call it with notification type svn_wc_notify_merge_record_info
if DO_NOTIFICATION is true.
Use WC_CTX to access the working copy, and SCRATCH_POOL for any temporary
@@ -313,60 +339,69 @@ svn_client__record_wc_mergeinfo(const char *local_abspath,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
-/* Elide any svn:mergeinfo set on TARGET_WCPATH to its nearest working
+/* Write mergeinfo into the WC.
+ *
+ * For each path in RESULT_CATALOG, set the SVN_PROP_MERGEINFO
+ * property to represent the given mergeinfo, or remove the property
+ * if the given mergeinfo is null, and notify the change. Leave
+ * other paths unchanged. RESULT_CATALOG maps (const char *) WC paths
+ * to (svn_mergeinfo_t) mergeinfo. */
+svn_error_t *
+svn_client__record_wc_mergeinfo_catalog(apr_hash_t *result_catalog,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+/* Elide any svn:mergeinfo set on TARGET_ABSPATH to its nearest working
copy (or possibly repository) ancestor with equivalent mergeinfo.
- If WC_ELISION_LIMIT_PATH is NULL check up to the root of the
+ If WC_ELISION_LIMIT_ABSPATH is NULL check up to the root of the
working copy or the nearest switched parent for an elision
destination, if none is found check the repository, otherwise check
- as far as WC_ELISION_LIMIT_PATH within the working copy.
- TARGET_WCPATH and WC_ELISION_LIMIT_PATH, if it exists, must both be
+ as far as WC_ELISION_LIMIT_ABSPATH within the working copy.
+ TARGET_WCPATH and WC_ELISION_LIMIT_ABSPATH, if it exists, must both be
absolute or relative to the working directory.
Elision occurs if:
- A) TARGET_WCPATH has empty mergeinfo and no parent path with
+ A) TARGET_ABSPATH has empty mergeinfo and no parent path with
explicit mergeinfo can be found in either the WC or the
repository (WC_ELISION_LIMIT_PATH must be NULL for this to
occur).
- B) TARGET_WCPATH has empty mergeinfo and its nearest parent also
+ B) TARGET_ABSPATH has empty mergeinfo and its nearest parent also
has empty mergeinfo.
- C) TARGET_WCPATH has the same mergeinfo as its nearest parent
+ C) TARGET_ABSPATH has the same mergeinfo as its nearest parent
when that parent's mergeinfo is adjusted for the path
difference between the two, e.g.:
- TARGET_WCPATH = A_COPY/D/H
- TARGET_WCPATH's mergeinfo = '/A/D/H:3'
- TARGET_WCPATH nearest parent = A_COPY
- Parent's mergeinfo = '/A:3'
- Path differece = 'D/H'
- Parent's adjusted mergeinfo = '/A/D/H:3'
+ TARGET_ABSPATH = A_COPY/D/H
+ TARGET_ABSPATH's mergeinfo = '/A/D/H:3'
+ TARGET_ABSPATH nearest parent = A_COPY
+ Parent's mergeinfo = '/A:3'
+ Path difference = 'D/H'
+ Parent's adjusted mergeinfo = '/A/D/H:3'
If Elision occurs remove the svn:mergeinfo property from
- TARGET_WCPATH. */
+ TARGET_ABSPATH. */
svn_error_t *
-svn_client__elide_mergeinfo(const char *target_wcpath,
- const char *wc_elision_limit_path,
+svn_client__elide_mergeinfo(const char *target_abspath,
+ const char *wc_elision_limit_abspath,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* TODO(reint): Document. */
-svn_error_t *
-svn_client__elide_mergeinfo_catalog(svn_mergeinfo_t mergeinfo_catalog,
- apr_pool_t *pool);
-
-/* For each source path : rangelist pair in MERGEINFO, append REL_PATH to
- the source path and add the new source path : rangelist pair to
- ADJUSTED_MERGEINFO. The new source path and rangelist are both deep
- copies allocated in POOL. Neither ADJUSTED_MERGEINFO
- nor MERGEINFO should be NULL. */
+/* Simplify a mergeinfo catalog, if possible, via elision.
+
+ For each path in MERGEINFO_CATALOG, check if the path's mergeinfo can
+ elide to the path's nearest path-wise parent in MERGEINFO_CATALOG. If
+ so, remove that path from MERGEINFO_CATALOG. Elidability is determined
+ as per svn_client__elide_mergeinfo except that elision to the repository
+ is not considered.
+
+ SCRATCH_POOL is used for temporary allocations. */
svn_error_t *
-svn_client__adjust_mergeinfo_source_paths(svn_mergeinfo_t adjusted_mergeinfo,
- const char *rel_path,
- svn_mergeinfo_t mergeinfo,
- apr_pool_t *pool);
+svn_client__elide_mergeinfo_catalog(svn_mergeinfo_catalog_t mergeinfo_catalog,
+ apr_pool_t *scratch_pool);
/* Set *MERGEINFO_CHANGES to TRUE if LOCAL_ABSPATH has locally modified
mergeinfo, set *MERGEINFO_CHANGES to FALSE otherwise. */