You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/11/02 14:35:20 UTC
svn commit: r1196573 - in
/subversion/branches/showing-merge-info/subversion: include/
include/private/ libsvn_client/ svn/
Author: julianfoad
Date: Wed Nov 2 13:35:19 2011
New Revision: 1196573
URL: http://svn.apache.org/viewvc?rev=1196573&view=rev
Log:
On the 'showing-merge-info' branch: Use svn_client_peg_t
instead of svn_client_target_t wherever feasible.
Modified:
subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
subversion/branches/showing-merge-info/subversion/include/svn_client.h
subversion/branches/showing-merge-info/subversion/libsvn_client/client.h
subversion/branches/showing-merge-info/subversion/libsvn_client/mergeinfo.c
subversion/branches/showing-merge-info/subversion/libsvn_client/prop_commands.c
subversion/branches/showing-merge-info/subversion/libsvn_client/ra.c
subversion/branches/showing-merge-info/subversion/libsvn_client/url.c
subversion/branches/showing-merge-info/subversion/svn/cl.h
subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c
subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c
subversion/branches/showing-merge-info/subversion/svn/util.c
Modified: subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h (original)
+++ subversion/branches/showing-merge-info/subversion/include/private/svn_client_private.h Wed Nov 2 13:35:19 2011
@@ -67,6 +67,8 @@ svn_client__create_status(svn_client_sta
* If @a peg->path_or_url is a URL then a peg revision kind of 'unspecified'
* means 'head', otherwise it means 'base'.
*
+ * @a session_p may be NULL, in which case a temporary session is used.
+ *
* @since New in 1.8.
*/
svn_error_t *
@@ -87,8 +89,8 @@ svn_client__peg_resolve(svn_client_targe
* If only one has such a marker or they are different, throw an error. */
svn_error_t *
svn_client__check_branch_root_marker(const char **marker,
- svn_client_target_t *source,
- svn_client_target_t *target,
+ const svn_client_peg_t *source,
+ const svn_client_peg_t *target,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
@@ -96,8 +98,8 @@ svn_client__check_branch_root_marker(con
* history of) SOURCE_BRANCH. */
svn_error_t *
svn_client__get_source_target_mergeinfo(svn_mergeinfo_catalog_t *mergeinfo_cat,
- svn_client_target_t *target,
- svn_client_target_t *source_branch,
+ const svn_client_peg_t *target,
+ const svn_client_peg_t *source_branch,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
Modified: subversion/branches/showing-merge-info/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/include/svn_client.h?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/include/svn_client.h (original)
+++ subversion/branches/showing-merge-info/subversion/include/svn_client.h Wed Nov 2 13:35:19 2011
@@ -68,6 +68,22 @@ svn_client_version(void);
* @{
*/
+/* */
+typedef struct svn_client_repo_root_t
+{
+ const char *root_url;
+ const char *uuid;
+} svn_client_repo_root_t;
+
+/* */
+typedef struct svn_client_repo_rev_path_t
+{
+ svn_client_repo_root_t repo;
+ svn_revnum_t revnum;
+ const char *relpath;
+} svn_client_repo_rev_path_t;
+
+
/** A "peg" is the location of a versioned node in a repository or in a
* working copy, as specified by the client to libsvn_client.
*
@@ -97,6 +113,7 @@ svn_client_version(void);
typedef struct svn_client_peg_t
{
const char *path_or_url;
+ const char *abspath_or_url;
svn_opt_revision_t peg_revision;
} svn_client_peg_t;
@@ -114,8 +131,9 @@ svn_client_peg_dup(const svn_client_peg_
*
* @since New in 1.8.
*/
-svn_client_peg_t *
-svn_client_peg_create(const char *path_or_url,
+svn_error_t *
+svn_client_peg_create(svn_client_peg_t **peg_p,
+ const char *path_or_url,
const svn_opt_revision_t *peg_revision,
apr_pool_t *pool);
@@ -1061,11 +1079,8 @@ svn_client_create_context(svn_client_ctx
typedef struct svn_client_target_t
{
/* The following fields are assumed to be initialized and valid.
- * peg_revision->kind and revision->kind may be 'unspecified'. */
- const char *path_or_url;
- const char *abspath_or_url;
- svn_opt_revision_t peg_revision;
-
+ * peg.peg_revision.kind and revision.kind may be 'unspecified'. */
+ const svn_client_peg_t *peg;
svn_opt_revision_t revision;
/* The following fields are the resolved location after contacting
@@ -1080,23 +1095,17 @@ typedef struct svn_client_target_t
} svn_client_target_t;
/** Set @a *target to a new #svn_client_target_t structure. Initialize the
- * @c abspath_or_url field as well as those corresponding to @a path_or_url,
- * @a peg_revision and @a pool. @a peg_revision may be NULL meaning
- * unspecified. */
+ * @c peg and @c pool fields. */
svn_error_t *
svn_client__target(svn_client_target_t **target,
- const char *path_or_url,
- const svn_opt_revision_t *peg_revision,
+ const svn_client_peg_t *peg,
apr_pool_t *pool);
-/** Like svn_opt_parse_path() but constructs a new #svn_client_target_t
- * structure. */
-svn_error_t *
-svn_client__parse_target(svn_client_target_t **target,
- const char *target_string,
- apr_pool_t *pool);
-
-/* */
+/** @a ra_session_p is an optional in/out parameter. If an RA session is
+ * needed and @a ra_session_p and @a *ra_session_p are both non-null, use
+ * that session; otherwise open a new sesssion (allocated
+ * in @a target->pool) and if @a ra_session_p is non-null then set
+ * @a *ra_session_p to the new session. */
svn_error_t *
svn_client__resolve_location(const char **repo_root_url_p,
const char **repo_uuid_p,
@@ -1110,17 +1119,6 @@ svn_client__resolve_location(const char
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/** @a ra_session_p is an optional in/out parameter. If an RA session is
- * needed and @a ra_session_p and @a *ra_session_p are both non-null, use
- * that session; otherwise open a new sesssion (allocated
- * in @a target->pool) and if @a ra_session_p is non-null then set
- * @a *ra_session_p to the new session. */
-svn_error_t *
-svn_client__resolve_target_location(svn_client_target_t *target,
- svn_ra_session_t **ra_session_p,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool);
-
/** Client argument processing
@@ -3725,15 +3723,13 @@ typedef svn_error_t *
/**
* If @a finding_merged is TRUE, then drive log entry callbacks
* @a receiver / @a receiver_baton with the revisions merged from
- * @a source_path_or_url (as of @a source_peg_revision) into
- * @a target_path_or_url (as of @a target_peg_revision). If @a
- * finding_merged is FALSE then find the revisions eligible for merging.
+ * @a source_peg into @a target_peg. If @a finding_merged is FALSE
+ * then find the revisions eligible for merging.
*
* If @a depth is #svn_depth_empty consider only the explicit or
- * inherited mergeinfo on @a target_path_or_url when calculating merged
- * revisions from @a source_path_or_url. If @a depth is #svn_depth_infinity
- * then also consider the explicit subtree mergeinfo under @a
- * target_path_or_url.
+ * inherited mergeinfo on @a target_peg when calculating merged
+ * revisions from @a source_peg. If @a depth is #svn_depth_infinity
+ * then also consider the explicit subtree mergeinfo under @a target_peg.
* If a depth other than #svn_depth_empty or #svn_depth_infinity is
* requested then return a #SVN_ERR_UNSUPPORTED_FEATURE error.
*
@@ -3750,8 +3746,8 @@ typedef svn_error_t *
*/
svn_error_t *
svn_client_mergeinfo_log2(svn_boolean_t finding_merged,
- svn_client_target_t *target,
- svn_client_target_t *source,
+ svn_client_peg_t *target_peg,
+ svn_client_peg_t *source_peg,
svn_mergeinfo_receiver_t receiver,
void *receiver_baton,
const apr_array_header_t *revprops,
@@ -4705,7 +4701,8 @@ svn_client_revprop_set(const char *propn
svn_error_t *
svn_client_propget5(apr_hash_t **props,
const char *propname,
- svn_client_target_t *target,
+ svn_client_peg_t *target_peg,
+ const svn_opt_revision_t *revision,
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_client_ctx_t *ctx,
@@ -4713,7 +4710,7 @@ svn_client_propget5(apr_hash_t **props,
apr_pool_t *scratch_pool);
/* Like svn_client_propget5() but using separate path and revision arguments
- * instead of svn_client_target_t.
+ * instead of svn_client_peg_t.
*
* @since New in 1.7.
* @deprecated Provided for backward compatibility with the 1.7 API.
@@ -4849,7 +4846,7 @@ svn_client_revprop_get(const char *propn
* @since New in 1.8.
*/
svn_error_t *
-svn_client_proplist4(svn_client_target_t *target,
+svn_client_proplist4(svn_client_peg_t *target,
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_proplist_receiver_t receiver,
@@ -4998,24 +4995,7 @@ svn_client_revprop_list(apr_hash_t **pro
*
* All allocations are done in @a pool.
*
- * @since New in 1.8.
- */
-svn_error_t *
-svn_client_export6(svn_client_target_t *target,
- const char *to_path,
- svn_boolean_t overwrite,
- svn_boolean_t ignore_externals,
- svn_boolean_t ignore_keywords,
- svn_depth_t depth,
- const char *native_eol,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool);
-
-/* Like svn_client_export6() but using separate path and revision arguments
- * instead of svn_client_target_t.
- *
* @since New in 1.7.
- * @deprecated Provided for backward compatibility with the 1.7 API.
*/
svn_error_t *
svn_client_export5(svn_revnum_t *result_rev,
@@ -5180,7 +5160,8 @@ typedef svn_error_t *(*svn_client_list_f
* @since New in 1.8.
*/
svn_error_t *
-svn_client_list3(svn_client_target_t *target,
+svn_client_list3(const svn_client_peg_t *target,
+ const svn_opt_revision_t *revision,
svn_depth_t depth,
apr_uint32_t dirent_fields,
svn_boolean_t fetch_locks,
@@ -5189,8 +5170,8 @@ svn_client_list3(svn_client_target_t *ta
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Like svn_client_list3() but using separate path and revision arguments
- * instead of svn_client_target_t.
+/* Like svn_client_list3() but using separate path and peg revision arguments
+ * instead of svn_client_peg_t.
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.7 API.
@@ -5327,12 +5308,13 @@ svn_client_ls(apr_hash_t **dirents,
*/
svn_error_t *
svn_client_cat3(svn_stream_t *out,
- svn_client_target_t *target,
+ const svn_client_peg_t *target,
+ const svn_opt_revision_t *revision,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Like svn_client_cat3() but using separate path and revision arguments
- * instead of svn_client_target_t.
+/* Like svn_client_cat3() but using separate path and peg revision arguments
+ * instead of svn_client_peg_t.
*
* @since New in 1.2.
* @deprecated Provided for backward compatibility with the 1.7 API.
@@ -5819,7 +5801,8 @@ typedef svn_error_t *(*svn_client_info_r
* @since New in 1.8.
*/
svn_error_t *
-svn_client_info4(svn_client_target_t *target,
+svn_client_info4(const svn_client_peg_t *target,
+ const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t fetch_excluded,
svn_boolean_t fetch_actual_only,
@@ -6060,12 +6043,6 @@ svn_client_url_from_path(const char **ur
const char *path_or_url,
apr_pool_t *pool);
-/* */
-svn_error_t *
-svn_client_resolve_repo_location(svn_client_target_t *target,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool);
-
/* Fetching a repository's root URL and UUID. */
Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/client.h?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/client.h (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/client.h Wed Nov 2 13:35:19 2011
@@ -219,16 +219,16 @@ svn_client__ra_session_from_path(svn_ra_
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Open an RA session (not connected to a WC) to TARGET.
+/* Open an RA session (not connected to a WC) to PEG.
* Similar to svn_client__ra_session_from_path() without BASE_DIR_ABSPATH. */
svn_error_t *
-svn_client__ra_session_from_target(svn_ra_session_t **ra_session_p,
- svn_revnum_t *rev_p,
- const char **url_p,
- svn_client_target_t *target,
- const svn_opt_revision_t *revision,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool);
+svn_client__ra_session_from_peg(svn_ra_session_t **ra_session_p,
+ svn_revnum_t *rev_p,
+ const char **url_p,
+ svn_client_peg_t *peg,
+ const svn_opt_revision_t *revision,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
/* Ensure that RA_SESSION's session URL matches SESSION_URL,
reparenting that session if necessary. If reparenting occurs,
Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/mergeinfo.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/mergeinfo.c Wed Nov 2 13:35:19 2011
@@ -803,8 +803,8 @@ filter_mergeinfo_catalog(svn_mergeinfo_c
svn_error_t *
svn_client__get_source_target_mergeinfo(svn_mergeinfo_catalog_t *mergeinfo_cat,
- svn_client_target_t *target,
- svn_client_target_t *source_branch,
+ const svn_client_peg_t *target,
+ const svn_client_peg_t *source_branch,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
@@ -814,21 +814,21 @@ svn_client__get_source_target_mergeinfo(
/* Find the source location-segments. */
{
svn_ra_session_t *ra_session;
+ svn_revnum_t rev;
- SVN_ERR(svn_client__ra_session_from_target(&ra_session, NULL, NULL,
+ SVN_ERR(svn_client__ra_session_from_peg(&ra_session, &rev, NULL,
source_branch,
&source_branch->peg_revision,
ctx, scratch_pool));
SVN_ERR(svn_client__repos_location_segments(&source_locations, ra_session,
- "", source_branch->repos_revnum,
- source_branch->repos_revnum,
+ "", rev, rev,
SVN_INVALID_REVNUM,
ctx, scratch_pool));
}
/* Find the target mergeinfo */
SVN_ERR(svn_client_get_mergeinfo_catalog(mergeinfo_cat,
- target->abspath_or_url,
+ target->path_or_url,
&target->peg_revision,
ctx, result_pool, scratch_pool));
@@ -2214,22 +2214,16 @@ mergeinfo_log_receiver(void *baton,
svn_error_t *
svn_client_mergeinfo_log2(svn_boolean_t finding_merged,
- svn_client_target_t *target1,
- svn_client_target_t *source1,
+ svn_client_peg_t *target_peg,
+ svn_client_peg_t *source_peg,
svn_mergeinfo_receiver_t receiver,
void *receiver_baton,
const apr_array_header_t *revprops,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
- svn_client_peg_t *target
- = svn_client_peg_create(target1->path_or_url, &target1->peg_revision,
- scratch_pool);
- svn_client_peg_t *source
- = svn_client_peg_create(source1->path_or_url, &source1->peg_revision,
- scratch_pool);
struct baton b;
-
+
b.receiver_func = receiver;
b.receiver_baton = receiver_baton;
@@ -2242,7 +2236,7 @@ svn_client_mergeinfo_log2(svn_boolean_t
revprops = revprops2;
}
- SVN_ERR(mergeinfo_log(finding_merged, target, source,
+ SVN_ERR(mergeinfo_log(finding_merged, target_peg, source_peg,
mergeinfo_log_receiver, &b,
FALSE /* discover_changed_paths */,
svn_depth_infinity, revprops,
@@ -2266,10 +2260,10 @@ svn_client_mergeinfo_log(svn_boolean_t f
{
svn_client_peg_t *target, *source;
- target = svn_client_peg_create(target_path_or_url, target_peg_revision,
- scratch_pool);
- source = svn_client_peg_create(source_path_or_url, source_peg_revision,
- scratch_pool);
+ SVN_ERR(svn_client_peg_create(&target, target_path_or_url,
+ target_peg_revision, scratch_pool));
+ SVN_ERR(svn_client_peg_create(&source, source_path_or_url,
+ source_peg_revision, scratch_pool));
SVN_ERR(mergeinfo_log(finding_merged, target, source,
receiver, receiver_baton,
Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/prop_commands.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/prop_commands.c Wed Nov 2 13:35:19 2011
@@ -801,7 +801,8 @@ get_prop_from_wc(apr_hash_t *props,
svn_error_t *
svn_client_propget5(apr_hash_t **props,
const char *propname,
- svn_client_target_t *target,
+ svn_client_peg_t *target_peg,
+ const svn_opt_revision_t *revision,
svn_depth_t depth,
const apr_array_header_t *changelists,
svn_client_ctx_t *ctx,
@@ -809,9 +810,9 @@ svn_client_propget5(apr_hash_t **props,
apr_pool_t *scratch_pool)
{
SVN_ERR(svn_client_propget4(props, propname,
- target->abspath_or_url,
- &target->peg_revision, &target->revision,
- &target->repos_revnum,
+ target_peg->abspath_or_url,
+ &target_peg->peg_revision, revision,
+ NULL /* actual_revnum */,
depth, changelists,
ctx, result_pool, scratch_pool));
return SVN_NO_ERROR;
Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/ra.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/ra.c Wed Nov 2 13:35:19 2011
@@ -505,17 +505,17 @@ svn_client__ra_session_from_path(svn_ra_
}
svn_error_t *
-svn_client__ra_session_from_target(svn_ra_session_t **ra_session_p,
- svn_revnum_t *rev_p,
- const char **url_p,
- svn_client_target_t *target,
- const svn_opt_revision_t *revision,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+svn_client__ra_session_from_peg(svn_ra_session_t **ra_session_p,
+ svn_revnum_t *rev_p,
+ const char **url_p,
+ svn_client_peg_t *peg,
+ const svn_opt_revision_t *revision,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
{
SVN_ERR(svn_client__ra_session_from_path(ra_session_p, rev_p, url_p,
- target->path_or_url, NULL,
- &target->peg_revision, revision,
+ peg->path_or_url, NULL,
+ &peg->peg_revision, revision,
ctx, pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/url.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/url.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/url.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/url.c Wed Nov 2 13:35:19 2011
@@ -71,21 +71,28 @@ svn_client_peg_dup(const svn_client_peg_
svn_client_peg_t *peg2 = apr_pmemdup(pool, peg, sizeof(*peg2));
peg2->path_or_url = apr_pstrdup(pool, peg->path_or_url);
+ peg2->abspath_or_url = apr_pstrdup(pool, peg->abspath_or_url);
return peg2;
}
-svn_client_peg_t *
-svn_client_peg_create(const char *path_or_url,
+svn_error_t *
+svn_client_peg_create(svn_client_peg_t **peg_p,
+ const char *path_or_url,
const svn_opt_revision_t *peg_revision,
apr_pool_t *pool)
{
svn_client_peg_t *peg = apr_palloc(pool, sizeof(*peg));
peg->path_or_url = apr_pstrdup(pool, path_or_url);
+ if (svn_path_is_url(path_or_url))
+ peg->abspath_or_url = peg->path_or_url;
+ else
+ SVN_ERR(svn_dirent_get_absolute(&peg->abspath_or_url, path_or_url, pool));
if (peg_revision)
peg->peg_revision = *peg_revision;
else
peg->peg_revision.kind = svn_opt_revision_unspecified;
+ *peg_p = peg;
return SVN_NO_ERROR;
}
@@ -97,46 +104,36 @@ svn_client__peg_resolve(svn_client_targe
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- SVN_ERR(svn_client__target(target_p, peg->path_or_url, &peg->peg_revision,
- result_pool));
- *session_p = NULL;
- SVN_ERR(svn_client__resolve_target_location(*target_p, session_p,
- ctx, result_pool));
+ const svn_opt_revision_t *revision = &peg->peg_revision;
+ svn_client_target_t *target;
+
+ if (session_p)
+ *session_p = NULL;
+
+ SVN_ERR(svn_client__target(&target, peg, result_pool));
+ SVN_ERR(svn_client__resolve_location(&target->repos_root_url,
+ &target->repos_uuid,
+ &target->repos_revnum,
+ &target->repos_relpath,
+ session_p,
+ peg->path_or_url,
+ &peg->peg_revision,
+ revision,
+ ctx, target->pool, scratch_pool));
+ *target_p = target;
return SVN_NO_ERROR;
}
svn_error_t *
svn_client__target(svn_client_target_t **target_p,
- const char *path_or_url,
- const svn_opt_revision_t *peg_revision,
+ const svn_client_peg_t *peg,
apr_pool_t *pool)
{
- svn_opt_revision_t unspecified_rev = { svn_opt_revision_unspecified, { 0 } };
*target_p = apr_pcalloc(pool, sizeof(**target_p));
(*target_p)->pool = pool;
- (*target_p)->path_or_url = path_or_url;
- if (svn_path_is_url(path_or_url))
- (*target_p)->abspath_or_url = path_or_url;
- else
- svn_error_clear(svn_dirent_get_absolute(&(*target_p)->abspath_or_url,
- path_or_url, pool));
- (*target_p)->peg_revision = peg_revision ? *peg_revision : unspecified_rev;
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_client__parse_target(svn_client_target_t **target,
- const char *target_string,
- apr_pool_t *pool)
-{
- svn_opt_revision_t peg_revision;
- const char *path_or_url;
-
- SVN_ERR(svn_opt_parse_path(&peg_revision, &path_or_url, target_string,
- pool));
- SVN_ERR(svn_client__target(target, path_or_url, &peg_revision, pool));
+ (*target_p)->peg = svn_client_peg_dup(peg, pool);
return SVN_NO_ERROR;
}
@@ -192,28 +189,10 @@ svn_client__resolve_location(const char
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_client__resolve_target_location(svn_client_target_t *target,
- svn_ra_session_t **ra_session_p,
- svn_client_ctx_t *ctx,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR(svn_client__resolve_location(&target->repos_root_url,
- &target->repos_uuid,
- &target->repos_revnum,
- &target->repos_relpath,
- ra_session_p,
- target->path_or_url,
- &target->peg_revision,
- &target->revision,
- ctx, target->pool, scratch_pool));
- return SVN_NO_ERROR;
-}
-
/* Set *MARKER to the value of the branch root marker property of TARGET. */
static svn_error_t *
get_branch_root_marker(const char **marker,
- svn_client_target_t *target,
+ svn_client_peg_t *target,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -221,7 +200,8 @@ get_branch_root_marker(const char **mark
const char *propname = SVN_PROP_BRANCH_ROOT;
svn_string_t *propval;
- SVN_ERR(svn_client_propget5(&props, propname, target, svn_depth_empty,
+ SVN_ERR(svn_client_propget5(&props, propname, target,
+ &target->peg_revision, svn_depth_empty,
NULL, ctx, pool, pool));
propval = apr_hash_get(props, target->abspath_or_url, APR_HASH_KEY_STRING);
*marker = propval ? propval->data : NULL;
@@ -236,8 +216,8 @@ get_branch_root_marker(const char **mark
svn_error_t *
svn_client__check_branch_root_marker(const char **marker,
- svn_client_target_t *source,
- svn_client_target_t *target,
+ const svn_client_peg_t *source,
+ const svn_client_peg_t *target,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
Modified: subversion/branches/showing-merge-info/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/cl.h?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/cl.h (original)
+++ subversion/branches/showing-merge-info/subversion/svn/cl.h Wed Nov 2 13:35:19 2011
@@ -833,6 +833,22 @@ svn_cl__local_style_skip_ancestor(const
const char *path,
apr_pool_t *pool);
+/** Return a peg created by parsing the given @a pegged_url_or_path,
+ * which is a WC path or URL optionally followed by '@' and a peg revision
+ * specifier. Allocate the result in @a pool.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_client__peg_parse(svn_client_peg_t **peg,
+ const char *pegged_url_or_path,
+ apr_pool_t *pool);
+
+/* */
+const char *
+svn_cl__peg_for_display(const svn_client_peg_t *target,
+ apr_pool_t *pool);
+
/* */
const char *
svn_cl__target_for_display(const svn_client_target_t *target,
@@ -841,8 +857,8 @@ svn_cl__target_for_display(const svn_cli
/* Find the preferred "parent" branch. At the moment, returns the
* copyfrom path, assumed still to exist at the same path in head. */
svn_error_t *
-svn_cl__find_merge_source_branch(svn_client_target_t **source_p,
- svn_client_target_t *target,
+svn_cl__find_merge_source_branch(svn_client_peg_t **source_p,
+ svn_client_peg_t *target,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
Modified: subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/merge-cmd.c Wed Nov 2 13:35:19 2011
@@ -117,16 +117,15 @@ svn_cl__merge(apr_getopt_t *os,
if (targets->nelts < 1)
{
/* Infer the merge source automatically, assuming a sync merge. */
- svn_client_target_t *source;
- svn_client_target_t *target;
+ svn_client_peg_t *target_peg, *source_peg;
- SVN_ERR(svn_client__target(&target, "", NULL, pool));
- SVN_ERR(svn_cl__find_merge_source_branch(&source, target, ctx, pool));
- SVN_ERR(svn_client__resolve_target_location(source, NULL, ctx, pool));
+ SVN_ERR(svn_client_peg_create(&target_peg, "", NULL, pool));
+ SVN_ERR(svn_cl__find_merge_source_branch(&source_peg, target_peg, ctx, pool));
+ /*SVN_ERR(svn_client__resolve_target_location_from_peg(&source, source_peg, NULL, ctx, pool));*/
printf("Assuming source branch is copy-source of target branch: '%s'\n",
- svn_cl__target_for_display(source, pool));
- peg_revision1 = source->peg_revision;
- sourcepath1 = source->path_or_url;
+ svn_cl__peg_for_display(source_peg, pool));
+ peg_revision1 = source_peg->peg_revision;
+ sourcepath1 = source_peg->path_or_url;
}
else /* Parse at least one, and possible two, sources. */
{
Modified: subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c Wed Nov 2 13:35:19 2011
@@ -148,7 +148,8 @@ print_recorded_ranges(svn_client_target_
int i;
SVN_ERR(svn_client__get_source_target_mergeinfo(
- &mergeinfo_cat, target, source, ctx, scratch_pool, scratch_pool));
+ &mergeinfo_cat, target->peg, source->peg,
+ ctx, scratch_pool, scratch_pool));
mergeinfo_cat_sorted = svn_sort__hash(mergeinfo_cat,
svn_sort_compare_items_as_paths,
scratch_pool);
@@ -211,6 +212,8 @@ svn_cl__mergeinfo(apr_getopt_t *os,
apr_array_header_t *targets;
svn_client_target_t *source;
svn_client_target_t *target;
+ svn_client_peg_t *source_peg;
+ svn_client_peg_t *target_peg;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -223,40 +226,36 @@ svn_cl__mergeinfo(apr_getopt_t *os,
/* Locate the target branch: the second argument or this dir. */
if (targets->nelts == 2)
{
- SVN_ERR(svn_client__parse_target(&target,
- APR_ARRAY_IDX(targets, 1, const char *),
- pool));
- target->revision.kind = svn_opt_revision_unspecified;
+ SVN_ERR(svn_client__peg_parse(&target_peg,
+ APR_ARRAY_IDX(targets, 1, const char *),
+ pool));
}
else
{
- svn_opt_revision_t peg_revision = { svn_opt_revision_working, { 0 } };
-
- SVN_ERR(svn_client__target(&target, "", &peg_revision, pool));
- target->revision.kind = svn_opt_revision_working;
+ SVN_ERR(svn_client__peg_parse(&target_peg, "", pool));
}
- SVN_ERR(svn_client__resolve_target_location(target, NULL, ctx, pool));
+ SVN_ERR(svn_client__peg_resolve(&target, NULL, target_peg,
+ ctx, pool, pool));
/* Locate the source branch: the first argument or automatic. */
if (targets->nelts >= 1)
{
- SVN_ERR(svn_client__parse_target(&source,
- APR_ARRAY_IDX(targets, 0, const char *),
- pool));
- source->revision.kind = svn_opt_revision_unspecified;
-
+ SVN_ERR(svn_client__peg_parse(&source_peg,
+ APR_ARRAY_IDX(targets, 0, const char *),
+ pool));
/* If no peg-rev was attached to the source URL, assume HEAD. */
- if (source->peg_revision.kind == svn_opt_revision_unspecified)
- source->peg_revision.kind = svn_opt_revision_head;
+ if (source_peg->peg_revision.kind == svn_opt_revision_unspecified)
+ source_peg->peg_revision.kind = svn_opt_revision_head;
}
else
{
printf("Assuming source branch is copy-source of target branch.\n");
- SVN_ERR(svn_cl__find_merge_source_branch(&source, target, ctx, pool));
+ SVN_ERR(svn_cl__find_merge_source_branch(&source_peg, target_peg, ctx, pool));
}
-
- SVN_ERR(svn_client__resolve_target_location(source, NULL, ctx, pool));
+
+ SVN_ERR(svn_client__peg_resolve(&source, NULL, source_peg,
+ ctx, pool, pool));
if (targets_are_same_branch(source, target, pool))
{
@@ -276,8 +275,8 @@ svn_cl__mergeinfo(apr_getopt_t *os,
SVN_ERR(svn_client_mergeinfo_log(
opt_state->show_revs == svn_cl__show_revs_merged,
- target->abspath_or_url, &target->peg_revision,
- source->abspath_or_url, &source->peg_revision,
+ target_peg->path_or_url, &target_peg->peg_revision,
+ source_peg->path_or_url, &source_peg->peg_revision,
print_log_rev, NULL /* baton */,
TRUE, depth, NULL, ctx, pool));
}
@@ -287,7 +286,8 @@ svn_cl__mergeinfo(apr_getopt_t *os,
const char *marker;
struct print_log_rev_baton_t log_rev_baton;
- SVN_ERR(svn_client__check_branch_root_marker(&marker, source, target,
+ SVN_ERR(svn_client__check_branch_root_marker(&marker,
+ source_peg, target_peg,
ctx, pool));
if (marker == NULL)
{
@@ -305,12 +305,12 @@ svn_cl__mergeinfo(apr_getopt_t *os,
/* If no peg-rev was attached to a URL target, then assume HEAD; if
no peg-rev was attached to a non-URL target, then assume BASE. */
- if (target->peg_revision.kind == svn_opt_revision_unspecified)
+ if (target_peg->peg_revision.kind == svn_opt_revision_unspecified)
{
- if (svn_path_is_url(target->path_or_url))
- target->peg_revision.kind = svn_opt_revision_head;
+ if (svn_path_is_url(target_peg->path_or_url))
+ target_peg->peg_revision.kind = svn_opt_revision_head;
else
- target->peg_revision.kind = svn_opt_revision_base;
+ target_peg->peg_revision.kind = svn_opt_revision_base;
}
printf(_("Revision range that could be merged:\n"));
@@ -324,14 +324,14 @@ svn_cl__mergeinfo(apr_getopt_t *os,
printf(_("Merged revisions:\n"));
log_rev_baton.count = 0;
SVN_ERR(svn_client_mergeinfo_log2(TRUE /* finding_merged */,
- target, source,
+ target_peg, source_peg,
print_merged_rev, &log_rev_baton,
NULL, ctx, pool));
printf(_("Eligible revisions:\n"));
log_rev_baton.count = 0;
SVN_ERR(svn_client_mergeinfo_log2(FALSE /* finding_merged */,
- target, source,
+ target_peg, source_peg,
print_merged_rev, &log_rev_baton,
NULL, ctx, pool));
}
Modified: subversion/branches/showing-merge-info/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/util.c?rev=1196573&r1=1196572&r2=1196573&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/util.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/util.c Wed Nov 2 13:35:19 2011
@@ -1420,6 +1420,19 @@ svn_cl__local_style_skip_ancestor(const
return svn_dirent_local_style(relpath ? relpath : path, pool);
}
+svn_error_t *
+svn_client__peg_parse(svn_client_peg_t **peg,
+ const char *pegged_url_or_path,
+ apr_pool_t *pool)
+{
+ svn_opt_revision_t rev;
+ const char *path_or_url;
+
+ SVN_ERR(svn_opt_parse_path(&rev, &path_or_url, pegged_url_or_path, pool));
+ SVN_ERR(svn_client_peg_create(peg, path_or_url, &rev, pool));
+ return SVN_NO_ERROR;
+}
+
/* */
static svn_boolean_t
location_is_resolved(const svn_client_target_t *location)
@@ -1434,13 +1447,13 @@ svn_cl__target_for_display(const svn_cli
SVN_ERR_ASSERT_NO_RETURN(location_is_resolved(target));
if (target->revision.kind == svn_opt_revision_working)
{
- SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_working);
+ SVN_ERR_ASSERT_NO_RETURN(target->peg->peg_revision.kind == svn_opt_revision_working);
return apr_psprintf(pool, "^/%s (working copy)",
target->repos_relpath);
}
if (target->revision.kind == svn_opt_revision_base)
{
- SVN_ERR_ASSERT_NO_RETURN(target->peg_revision.kind == svn_opt_revision_base);
+ SVN_ERR_ASSERT_NO_RETURN(target->peg->peg_revision.kind == svn_opt_revision_base);
return apr_psprintf(pool, "^/%s (wc base)",
target->repos_relpath);
}
@@ -1448,9 +1461,32 @@ svn_cl__target_for_display(const svn_cli
target->repos_relpath, target->repos_revnum);
}
+const char *
+svn_cl__peg_for_display(const svn_client_peg_t *peg,
+ apr_pool_t *pool)
+{
+ if (peg->peg_revision.kind == svn_opt_revision_unspecified)
+ {
+ return apr_psprintf(pool, "%s",
+ peg->path_or_url);
+ }
+ if (peg->peg_revision.kind == svn_opt_revision_working)
+ {
+ return apr_psprintf(pool, "%s (working copy)",
+ peg->path_or_url);
+ }
+ else
+ {
+ return apr_psprintf(pool, "%s@%s",
+ peg->path_or_url,
+ svn_opt__revision_to_string(&peg->peg_revision,
+ pool));
+ }
+}
+
svn_error_t *
-svn_cl__find_merge_source_branch(svn_client_target_t **source_p,
- svn_client_target_t *target,
+svn_cl__find_merge_source_branch(svn_client_peg_t **source_p,
+ svn_client_peg_t *target,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -1466,8 +1502,7 @@ svn_cl__find_merge_source_branch(svn_cli
ctx, pool));
copyfrom_url = APR_ARRAY_IDX(suggestions, 0, const char *);
- SVN_ERR(svn_client__target(source_p, copyfrom_url, &peg_revision, pool));
- (*source_p)->revision.kind = svn_opt_revision_unspecified;
+ SVN_ERR(svn_client_peg_create(source_p, copyfrom_url, &peg_revision, pool));
return SVN_NO_ERROR;
}