You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/05/16 22:32:54 UTC
svn commit: r1339349 [10/37] - in /subversion/branches/fix-rdump-editor: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/client-side/vim/
contrib/server-side/ notes/ notes/api-errat...
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.c Wed May 16 20:32:43 2012
@@ -43,6 +43,7 @@
#include "private/svn_wc_private.h"
#include "private/svn_ra_private.h"
#include "private/svn_fspath.h"
+#include "private/svn_client_private.h"
#include "client.h"
#include "mergeinfo.h"
#include "svn_private_config.h"
@@ -216,8 +217,9 @@ svn_client__get_wc_mergeinfo(svn_mergein
if (limit_abspath)
SVN_ERR_ASSERT(svn_dirent_is_absolute(limit_abspath));
- SVN_ERR(svn_wc__node_get_base_rev(&base_revision, ctx->wc_ctx,
- local_abspath, scratch_pool));
+ SVN_ERR(svn_wc__node_get_base(&base_revision, NULL, NULL, NULL, ctx->wc_ctx,
+ local_abspath,
+ scratch_pool, scratch_pool));
iterpool = svn_pool_create(scratch_pool);
while (TRUE)
@@ -283,9 +285,9 @@ svn_client__get_wc_mergeinfo(svn_mergein
walk_relpath, result_pool);
local_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
- SVN_ERR(svn_wc__node_get_base_rev(&parent_base_rev,
- ctx->wc_ctx, local_abspath,
- scratch_pool));
+ SVN_ERR(svn_wc__node_get_base(&parent_base_rev, NULL, NULL, NULL,
+ ctx->wc_ctx, local_abspath,
+ scratch_pool, scratch_pool));
SVN_ERR(svn_wc__node_get_changed_info(&parent_changed_rev,
NULL, NULL,
ctx->wc_ctx, local_abspath,
@@ -747,26 +749,26 @@ svn_client__get_wc_or_repos_mergeinfo_ca
svn_error_t *
svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
- svn_boolean_t *has_rev_zero_history,
- const char *url,
- svn_revnum_t peg_revnum,
- svn_revnum_t range_youngest,
- svn_revnum_t range_oldest,
- svn_ra_session_t *ra_session,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+ svn_boolean_t *has_rev_zero_history,
+ const svn_client__pathrev_t *pathrev,
+ svn_revnum_t range_youngest,
+ svn_revnum_t range_oldest,
+ svn_ra_session_t *ra_session,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
{
apr_array_header_t *segments;
/* Fetch the location segments for our URL@PEG_REVNUM. */
if (! SVN_IS_VALID_REVNUM(range_youngest))
- range_youngest = peg_revnum;
+ range_youngest = pathrev->rev;
if (! SVN_IS_VALID_REVNUM(range_oldest))
range_oldest = 0;
- SVN_ERR(svn_client__repos_location_segments(&segments, ra_session, url,
- peg_revnum, range_youngest,
- range_oldest, ctx, pool));
+ SVN_ERR(svn_client__repos_location_segments(&segments, ra_session,
+ pathrev->url, pathrev->rev,
+ range_youngest, range_oldest,
+ ctx, pool));
if (has_rev_zero_history)
{
@@ -1049,38 +1051,27 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
apr_pool_t *scratch_pool)
{
svn_ra_session_t *ra_session;
- svn_revnum_t rev;
const char *local_abspath;
- const char *url;
svn_boolean_t use_url = svn_path_is_url(path_or_url);
- svn_revnum_t peg_rev;
+ svn_client__pathrev_t *peg_loc;
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &peg_rev, &url,
- path_or_url, NULL, peg_revision,
- peg_revision, ctx, scratch_pool));
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &peg_loc,
+ path_or_url, NULL, peg_revision,
+ peg_revision, ctx, scratch_pool));
/* If PATH_OR_URL is as working copy path determine if we will need to
contact the repository for the requested PEG_REVISION. */
if (!use_url)
{
- const char *repos_root_url;
- const char *repos_relpath;
- const char *origin_url = NULL;
+ svn_client__pathrev_t *origin;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
scratch_pool));
- SVN_ERR(svn_wc__node_get_origin(NULL, &rev, &repos_relpath,
- &repos_root_url, NULL, NULL,
- ctx->wc_ctx, local_abspath, FALSE,
- scratch_pool, scratch_pool));
-
- if(repos_relpath)
- origin_url = svn_path_url_add_component2(repos_root_url, repos_relpath,
- scratch_pool);
-
- if (!origin_url
- || strcmp(origin_url, url) != 0
- || peg_rev != rev)
+ SVN_ERR(svn_client__wc_node_get_origin(&origin, local_abspath, ctx,
+ scratch_pool, scratch_pool));
+ if (!origin
+ || strcmp(origin->url, peg_loc->url) != 0
+ || peg_loc->rev != origin->rev)
{
use_url = TRUE; /* Don't rely on local mergeinfo */
}
@@ -1094,10 +1085,9 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
if (use_url)
{
- rev = peg_rev;
SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
- mergeinfo_catalog, ra_session, url, rev, svn_mergeinfo_inherited,
- FALSE, include_descendants,
+ mergeinfo_catalog, ra_session, peg_loc->url, peg_loc->rev,
+ svn_mergeinfo_inherited, FALSE, include_descendants,
result_pool, scratch_pool));
}
else /* ! svn_path_is_url() */
@@ -1721,32 +1711,30 @@ svn_client_mergeinfo_log(svn_boolean_t f
if (!finding_merged)
{
svn_ra_session_t *target_session;
- svn_revnum_t rev;
- const char *url;
+ svn_client__pathrev_t *pathrev;
- SVN_ERR(svn_client__ra_session_from_path(
- &target_session, &rev, &url,
+ SVN_ERR(svn_client__ra_session_from_path2(
+ &target_session, &pathrev,
target_path_or_url, NULL,
target_peg_revision, target_peg_revision,
ctx, sesspool));
SVN_ERR(svn_client__get_history_as_mergeinfo(
&target_history, NULL,
- url, rev, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ pathrev, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
target_session, ctx, scratch_pool));
}
{
svn_ra_session_t *source_session;
- svn_revnum_t rev;
- const char *url;
+ svn_client__pathrev_t *pathrev;
- SVN_ERR(svn_client__ra_session_from_path(
- &source_session, &rev, &url,
+ SVN_ERR(svn_client__ra_session_from_path2(
+ &source_session, &pathrev,
source_path_or_url, NULL,
source_peg_revision, source_peg_revision,
ctx, sesspool));
SVN_ERR(svn_client__get_history_as_mergeinfo(
&source_history, NULL,
- url, rev, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ pathrev, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
source_session, ctx, scratch_pool));
}
/* Close the source and target sessions. */
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.h?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/mergeinfo.h Wed May 16 20:32:43 2012
@@ -26,6 +26,7 @@
#include "svn_wc.h"
#include "svn_client.h"
+#include "private/svn_client_private.h"
/*** Data Structures ***/
@@ -289,7 +290,7 @@ svn_client__get_wc_or_repos_mergeinfo_ca
apr_pool_t *scratch_pool);
/* Set *MERGEINFO_P to a mergeinfo constructed solely from the
- natural history of URL at PEG_REVNUM.
+ natural history of PATHREV.
If RANGE_YOUNGEST and RANGE_OLDEST are valid, use them to bound the
revision ranges of returned mergeinfo. They are governed by the same
@@ -305,8 +306,7 @@ svn_client__get_wc_or_repos_mergeinfo_ca
svn_error_t *
svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
svn_boolean_t *has_rev_zero_history,
- const char *url,
- svn_revnum_t peg_revnum,
+ const svn_client__pathrev_t *pathrev,
svn_revnum_t range_youngest,
svn_revnum_t range_oldest,
svn_ra_session_t *ra_session,
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/patch.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/patch.c Wed May 16 20:32:43 2012
@@ -47,6 +47,7 @@
#include "private/svn_wc_private.h"
#include "private/svn_dep_compat.h"
#include "private/svn_string_private.h"
+#include "private/svn_subr_private.h"
typedef struct hunk_info_t {
/* The hunk. */
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/prop_commands.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/prop_commands.c Wed May 16 20:32:43 2012
@@ -75,7 +75,7 @@ is_revision_prop_name(const char *name)
static svn_error_t *
error_if_wcprop_name(const char *name)
{
- if (svn_property_kind(NULL, name) == svn_prop_wc_kind)
+ if (svn_property_kind2(name) == svn_prop_wc_kind)
{
return svn_error_createf
(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
@@ -162,7 +162,7 @@ propset_on_url(const char *propname,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- enum svn_prop_kind prop_kind = svn_property_kind(NULL, propname);
+ enum svn_prop_kind prop_kind = svn_property_kind2(propname);
svn_ra_session_t *ra_session;
svn_node_kind_t node_kind;
const char *message;
@@ -344,7 +344,7 @@ svn_client_propset_local(const char *pro
iterpool);
if ((err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- || kind == svn_node_unknown || kind == svn_node_none)
+ || (!err && (kind == svn_node_unknown || kind == svn_node_none)))
{
if (ctx->notify_func2)
{
@@ -847,21 +847,22 @@ svn_client_propget4(apr_hash_t **props,
}
else
{
- const char *url;
+ svn_client__pathrev_t *loc;
svn_ra_session_t *ra_session;
svn_node_kind_t kind;
/* Get an RA plugin for this filesystem object. */
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
- &url, target, NULL,
- peg_revision,
- revision, ctx, scratch_pool));
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+ target, NULL,
+ peg_revision,
+ revision, ctx, scratch_pool));
- SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, scratch_pool));
+ SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, scratch_pool));
- SVN_ERR(remote_propget(*props, propname, url, "",
- kind, revnum, ra_session,
+ SVN_ERR(remote_propget(*props, propname, loc->url, "",
+ kind, loc->rev, ra_session,
depth, result_pool, scratch_pool));
+ revnum = loc->rev;
}
if (actual_revnum)
@@ -980,7 +981,7 @@ remote_proplist(const char *target_prefi
svn_string_t *value = svn__apr_hash_index_val(hi);
svn_prop_kind_t prop_kind;
- prop_kind = svn_property_kind(NULL, name);
+ prop_kind = svn_property_kind2(name);
if (prop_kind == svn_prop_regular_kind)
{
@@ -1088,8 +1089,6 @@ svn_client_proplist3(const char *path_or
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- const char *url;
-
peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision,
path_or_url);
revision = svn_cl__rev_default_to_peg(revision, peg_revision);
@@ -1172,17 +1171,17 @@ svn_client_proplist3(const char *path_or
svn_ra_session_t *ra_session;
svn_node_kind_t kind;
apr_pool_t *subpool = svn_pool_create(pool);
- svn_revnum_t revnum;
+ svn_client__pathrev_t *loc;
/* Get an RA session for this URL. */
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
- &url, path_or_url, NULL,
- peg_revision,
- revision, ctx, pool));
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+ path_or_url, NULL,
+ peg_revision,
+ revision, ctx, pool));
- SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
+ SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, pool));
- SVN_ERR(remote_proplist(url, "", kind, revnum, ra_session, depth,
+ SVN_ERR(remote_proplist(loc->url, "", kind, loc->rev, ra_session, depth,
receiver, receiver_baton, pool, subpool));
svn_pool_destroy(subpool);
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/ra.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/ra.c Wed May 16 20:32:43 2012
@@ -52,6 +52,13 @@ typedef struct callback_baton_t
this base directory. */
const char *base_dir_abspath;
+ /* TEMPORARY: Is 'base_dir_abspath' a versioned path? cmpilato
+ suspects that the commit-to-multiple-disjoint-working-copies
+ code is getting this all wrong, sometimes passing an unversioned
+ (or versioned in a foreign wc) path here which sorta kinda
+ happens to work most of the time but is ultimately incorrect. */
+ svn_boolean_t base_dir_isversioned;
+
/* An array of svn_client_commit_item3_t * structures, present only
during working copy commits. */
const apr_array_header_t *commit_items;
@@ -234,6 +241,30 @@ invalidate_wc_props(void *baton,
}
+/* This implements the `svn_ra_get_wc_contents_func_t' interface. */
+static svn_error_t *
+get_wc_contents(void *baton,
+ svn_stream_t **contents,
+ const svn_checksum_t *sha1_checksum,
+ apr_pool_t *pool)
+{
+ callback_baton_t *cb = baton;
+
+ if (! (cb->base_dir_abspath && cb->base_dir_isversioned))
+ {
+ *contents = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ return svn_error_trace(
+ svn_wc__get_pristine_contents_by_checksum(contents,
+ cb->ctx->wc_ctx,
+ cb->base_dir_abspath,
+ sha1_checksum,
+ pool, pool));
+}
+
+
static svn_error_t *
cancel_callback(void *baton)
{
@@ -284,6 +315,7 @@ svn_client__open_ra_session_internal(svn
cbtable->progress_baton = ctx->progress_baton;
cbtable->cancel_func = ctx->cancel_func ? cancel_callback : NULL;
cbtable->get_client_string = get_client_string;
+ cbtable->get_wc_contents = get_wc_contents;
cb->base_dir_abspath = base_dir_abspath;
cb->commit_items = commit_items;
@@ -303,7 +335,10 @@ svn_client__open_ra_session_internal(svn
uuid = NULL;
}
else
- SVN_ERR(err);
+ {
+ SVN_ERR(err);
+ cb->base_dir_isversioned = TRUE;
+ }
}
/* If the caller allows for auto-following redirections, and the
@@ -391,9 +426,7 @@ svn_client_open_ra_session(svn_ra_sessio
for a URL or 'working' for a WC path. If REVISION->kind is
'unspecified', the operative revision is the peg revision.
- Store the actual revision number of the object in *REV_P, and the
- final resulting URL in *URL_P. REV_P and/or URL_P may be NULL if not
- wanted.
+ Store the actual location of the object in *RESOLVED_LOC_P.
RA_SESSION should be an open RA session pointing at the URL of
PATH_OR_URL, or NULL, in which case this function will open its own
@@ -404,8 +437,7 @@ svn_client_open_ra_session(svn_ra_sessio
Use POOL for all allocations. */
static svn_error_t *
-resolve_rev_and_url(svn_revnum_t *rev_p,
- const char **url_p,
+resolve_rev_and_url(svn_client__pathrev_t **resolved_loc_p,
svn_ra_session_t *ra_session,
const char *path_or_url,
const svn_opt_revision_t *peg_revision,
@@ -430,29 +462,25 @@ resolve_rev_and_url(svn_revnum_t *rev_p,
ra_session, path_or_url, &peg_rev,
&start_rev, NULL, ctx, pool));
- if (rev_p)
- *rev_p = rev;
- if (url_p)
- *url_p = url;
-
+ SVN_ERR(svn_client__pathrev_create_with_session(resolved_loc_p,
+ ra_session, rev, url, pool));
return SVN_NO_ERROR;
}
svn_error_t *
-svn_client__ra_session_from_path(svn_ra_session_t **ra_session_p,
- svn_revnum_t *rev_p,
- const char **url_p,
- const char *path_or_url,
- const char *base_dir_abspath,
- const svn_opt_revision_t *peg_revision,
- const svn_opt_revision_t *revision,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+svn_client__ra_session_from_path2(svn_ra_session_t **ra_session_p,
+ svn_client__pathrev_t **resolved_loc_p,
+ const char *path_or_url,
+ const char *base_dir_abspath,
+ const svn_opt_revision_t *peg_revision,
+ const svn_opt_revision_t *revision,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
{
svn_ra_session_t *ra_session;
const char *initial_url;
const char *corrected_url;
- const char *resolved_url;
+ svn_client__pathrev_t *resolved_loc;
SVN_ERR(svn_client_url_from_path2(&initial_url, path_or_url, ctx, pool,
pool));
@@ -471,16 +499,16 @@ svn_client__ra_session_from_path(svn_ra_
if (corrected_url && svn_path_is_url(path_or_url))
path_or_url = corrected_url;
- SVN_ERR(resolve_rev_and_url(rev_p, &resolved_url, ra_session,
+ SVN_ERR(resolve_rev_and_url(&resolved_loc, ra_session,
path_or_url, peg_revision, revision,
ctx, pool));
/* Make the session point to the real URL. */
- SVN_ERR(svn_ra_reparent(ra_session, resolved_url, pool));
+ SVN_ERR(svn_ra_reparent(ra_session, resolved_loc->url, pool));
*ra_session_p = ra_session;
- if (url_p)
- *url_p = resolved_url;
+ if (resolved_loc_p)
+ *resolved_loc_p = resolved_loc;
return SVN_NO_ERROR;
}
@@ -649,24 +677,28 @@ repos_locations(const char **start_url,
}
svn_error_t *
-svn_client__repos_location(const char **op_url,
+svn_client__repos_location(svn_client__pathrev_t **op_loc_p,
svn_ra_session_t *ra_session,
- const char *peg_url,
- svn_revnum_t peg_revnum,
+ const svn_client__pathrev_t *peg_loc,
svn_revnum_t op_revnum,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
const char *old_session_url;
+ const char *op_url;
SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
- peg_url, scratch_pool));
- SVN_ERR(repos_locations(op_url, NULL,
- ra_session, peg_url, peg_revnum,
+ peg_loc->url, scratch_pool));
+ SVN_ERR(repos_locations(&op_url, NULL, ra_session,
+ peg_loc->url, peg_loc->rev,
op_revnum, SVN_INVALID_REVNUM,
result_pool, scratch_pool));
SVN_ERR(svn_ra_reparent(ra_session, old_session_url, scratch_pool));
+
+ *op_loc_p = svn_client__pathrev_create(peg_loc->repos_root_url,
+ peg_loc->repos_uuid,
+ op_revnum, op_url, result_pool);
return SVN_NO_ERROR;
}
@@ -808,19 +840,15 @@ svn_client__repos_locations(const char *
svn_error_t *
-svn_client__get_youngest_common_ancestor(const char **ancestor_relpath,
- const char **ancestor_url,
- svn_revnum_t *ancestor_revision,
- const char *url1,
- svn_revnum_t rev1,
- const char *url2,
- svn_revnum_t rev2,
+svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p,
+ const svn_client__pathrev_t *loc1,
+ const svn_client__pathrev_t *loc2,
svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- apr_pool_t *sesspool = svn_pool_create(pool);
+ apr_pool_t *sesspool = svn_pool_create(scratch_pool);
svn_ra_session_t *session;
- const char *repos_root_url;
apr_hash_t *history1, *history2;
apr_hash_index_t *hi;
svn_revnum_t yc_revision = SVN_INVALID_REVNUM;
@@ -828,31 +856,36 @@ svn_client__get_youngest_common_ancestor
svn_boolean_t has_rev_zero_history1;
svn_boolean_t has_rev_zero_history2;
+ if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0)
+ {
+ *ancestor_p = NULL;
+ return SVN_NO_ERROR;
+ }
+
/* Open an RA session for the two locations. */
- SVN_ERR(svn_client_open_ra_session(&session, url1, ctx, sesspool));
- SVN_ERR(svn_ra_get_repos_root2(session, &repos_root_url, pool));
+ SVN_ERR(svn_client_open_ra_session(&session, loc1->url, ctx, sesspool));
/* We're going to cheat and use history-as-mergeinfo because it
saves us a bunch of annoying custom data comparisons and such. */
SVN_ERR(svn_client__get_history_as_mergeinfo(&history1,
&has_rev_zero_history1,
- url1, rev1,
+ loc1,
SVN_INVALID_REVNUM,
SVN_INVALID_REVNUM,
- session, ctx, pool));
+ session, ctx, scratch_pool));
SVN_ERR(svn_client__get_history_as_mergeinfo(&history2,
&has_rev_zero_history2,
- url2, rev2,
+ loc2,
SVN_INVALID_REVNUM,
SVN_INVALID_REVNUM,
- session, ctx, pool));
+ session, ctx, scratch_pool));
/* Close the source and target sessions. */
svn_pool_destroy(sesspool);
/* Loop through the first location's history, check for overlapping
paths and ranges in the second location's history, and
remembering the youngest matching location. */
- for (hi = apr_hash_first(pool, history1); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(scratch_pool, history1); hi; hi = apr_hash_next(hi))
{
const char *path = svn__apr_hash_index_key(hi);
apr_ssize_t path_len = svn__apr_hash_index_klen(hi);
@@ -865,7 +898,7 @@ svn_client__get_youngest_common_ancestor
/* We have a path match. Now, did our two histories share
any revisions at that path? */
SVN_ERR(svn_rangelist_intersect(&common, ranges1, ranges2,
- TRUE, pool));
+ TRUE, scratch_pool));
if (common->nelts)
{
svn_merge_range_t *yc_range =
@@ -888,14 +921,16 @@ svn_client__get_youngest_common_ancestor
yc_revision = 0;
}
- if (ancestor_relpath)
- *ancestor_relpath = yc_relpath;
- if (ancestor_url)
- *ancestor_url
- = yc_relpath ? svn_path_url_add_component2(repos_root_url, yc_relpath,
- pool) : NULL;
- if (ancestor_revision)
- *ancestor_revision = yc_revision;
+ if (yc_relpath)
+ {
+ *ancestor_p = svn_client__pathrev_create_with_relpath(
+ loc1->repos_root_url, loc1->repos_uuid,
+ yc_revision, yc_relpath, result_pool);
+ }
+ else
+ {
+ *ancestor_p = NULL;
+ }
return SVN_NO_ERROR;
}
@@ -912,22 +947,176 @@ svn_client__youngest_common_ancestor(con
{
apr_pool_t *sesspool = svn_pool_create(scratch_pool);
svn_ra_session_t *session;
- const char *url1, *url2;
- svn_revnum_t rev1, rev2;
+ svn_client__pathrev_t *loc1, *loc2, *ancestor;
/* Resolve the two locations */
- SVN_ERR(svn_client__ra_session_from_path(&session, &rev1, &url1,
- path_or_url1, NULL,
- revision1, revision1,
- ctx, sesspool));
- SVN_ERR(resolve_rev_and_url(&rev2, &url2, session,
+ SVN_ERR(svn_client__ra_session_from_path2(&session, &loc1,
+ path_or_url1, NULL,
+ revision1, revision1,
+ ctx, sesspool));
+ SVN_ERR(resolve_rev_and_url(&loc2, session,
path_or_url2, revision2, revision2,
ctx, scratch_pool));
SVN_ERR(svn_client__get_youngest_common_ancestor(
- NULL, ancestor_url, ancestor_rev,
- url1, rev1, url2, rev2, ctx, result_pool));
+ &ancestor, loc1, loc2, ctx, result_pool, scratch_pool));
+ if (ancestor)
+ {
+ *ancestor_url = ancestor->url;
+ *ancestor_rev = ancestor->rev;
+ }
+ else
+ {
+ *ancestor_url = NULL;
+ *ancestor_rev = SVN_INVALID_REVNUM;
+ }
svn_pool_destroy(sesspool);
return SVN_NO_ERROR;
}
+
+
+struct ra_ev2_baton {
+ /* The working copy context, from the client context. */
+ svn_wc_context_t *wc_ctx;
+
+ /* For a given REPOS_RELPATH, provide a LOCAL_ABSPATH that represents
+ that repository node. */
+ apr_hash_t *relpath_map;
+};
+
+
+svn_error_t *
+svn_client__ra_provide_base(svn_stream_t **contents,
+ svn_revnum_t *revision,
+ void *baton,
+ const char *repos_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct ra_ev2_baton *reb = baton;
+ const char *local_abspath;
+ svn_error_t *err;
+
+ local_abspath = apr_hash_get(reb->relpath_map, repos_relpath,
+ APR_HASH_KEY_STRING);
+ if (!local_abspath)
+ {
+ *contents = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ err = svn_wc_get_pristine_contents2(contents, reb->wc_ctx, local_abspath,
+ result_pool, scratch_pool);
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ *contents = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ if (*contents != NULL)
+ {
+ /* The pristine contents refer to the BASE, or to the pristine of
+ a copy/move to this location. Fetch the correct revision. */
+ SVN_ERR(svn_wc__node_get_commit_base(revision, NULL, NULL, NULL,
+ reb->wc_ctx, local_abspath,
+ scratch_pool, scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_client__ra_provide_props(apr_hash_t **props,
+ svn_revnum_t *revision,
+ void *baton,
+ const char *repos_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct ra_ev2_baton *reb = baton;
+ const char *local_abspath;
+ svn_error_t *err;
+
+ local_abspath = apr_hash_get(reb->relpath_map, repos_relpath,
+ APR_HASH_KEY_STRING);
+ if (!local_abspath)
+ {
+ *props = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ err = svn_wc_get_pristine_props(props, reb->wc_ctx, local_abspath,
+ result_pool, scratch_pool);
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ *props = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ if (*props != NULL)
+ {
+ /* The pristine props refer to the BASE, or to the pristine props of
+ a copy/move to this location. Fetch the correct revision. */
+ SVN_ERR(svn_wc__node_get_commit_base(revision, NULL, NULL, NULL,
+ reb->wc_ctx, local_abspath,
+ scratch_pool, scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_client__ra_get_copysrc_kind(svn_kind_t *kind,
+ void *baton,
+ const char *repos_relpath,
+ svn_revnum_t src_revision,
+ apr_pool_t *scratch_pool)
+{
+ struct ra_ev2_baton *reb = baton;
+ svn_node_kind_t node_kind;
+ const char *local_abspath;
+
+ local_abspath = apr_hash_get(reb->relpath_map, repos_relpath,
+ APR_HASH_KEY_STRING);
+ if (!local_abspath)
+ {
+ *kind = svn_kind_unknown;
+ return SVN_NO_ERROR;
+ }
+
+ /* ### what to do with SRC_REVISION? */
+
+ SVN_ERR(svn_wc_read_kind(&node_kind, reb->wc_ctx, local_abspath, FALSE,
+ scratch_pool));
+ *kind = svn__kind_from_node_kind(node_kind, FALSE);
+
+ return SVN_NO_ERROR;
+}
+
+
+void *
+svn_client__ra_make_cb_baton(svn_wc_context_t *wc_ctx,
+ apr_hash_t *relpath_map,
+ apr_pool_t *result_pool)
+{
+ struct ra_ev2_baton *reb = apr_palloc(result_pool, sizeof(*reb));
+
+ SVN_ERR_ASSERT_NO_RETURN(wc_ctx != NULL);
+ SVN_ERR_ASSERT_NO_RETURN(relpath_map != NULL);
+
+ reb->wc_ctx = wc_ctx;
+ reb->relpath_map = relpath_map;
+
+ return reb;
+}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/repos_diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/repos_diff.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/repos_diff.c Wed May 16 20:32:43 2012
@@ -47,6 +47,7 @@
#include "client.h"
+#include "private/svn_subr_private.h"
#include "private/svn_wc_private.h"
/* Overall crawler editor baton. */
@@ -418,17 +419,6 @@ remove_non_prop_changes(apr_hash_t *pris
}
}
-/* Get the props attached to a directory in the repository at BASE_REVISION. */
-static svn_error_t *
-get_dirprops_from_ra(struct dir_baton *b, svn_revnum_t base_revision)
-{
- return svn_ra_get_dir2(b->edit_baton->ra_session,
- NULL, NULL, &(b->pristine_props),
- b->path,
- base_revision,
- 0,
- b->pool);
-}
/* Get the empty file associated with the edit baton. This is cached so
* that it can be reused, all empty files are the same.
@@ -472,7 +462,8 @@ open_root(void *edit_baton,
struct edit_baton *eb = edit_baton;
struct dir_baton *b = make_dir_baton("", NULL, eb, FALSE, pool);
- SVN_ERR(get_dirprops_from_ra(b, base_revision));
+ SVN_ERR(svn_ra_get_dir2(eb->ra_session, NULL, NULL, &b->pristine_props,
+ b->path, base_revision, 0, pool));
*root_baton = b;
return SVN_NO_ERROR;
@@ -766,7 +757,8 @@ open_directory(const char *path,
return SVN_NO_ERROR;
}
- SVN_ERR(get_dirprops_from_ra(b, base_revision));
+ SVN_ERR(svn_ra_get_dir2(eb->ra_session, NULL, NULL, &b->pristine_props,
+ b->path, base_revision, 0, pool));
SVN_ERR(eb->diff_callbacks->dir_opened(
&b->tree_conflicted, &b->skip,
@@ -849,9 +841,8 @@ window_handler(svn_txdelta_window_t *win
if (!window)
{
- b->result_md5_checksum = svn_checksum__from_digest(b->result_digest,
- svn_checksum_md5,
- b->pool);
+ b->result_md5_checksum = svn_checksum__from_digest_md5(b->result_digest,
+ b->pool);
}
return SVN_NO_ERROR;
@@ -1473,7 +1464,7 @@ svn_client__get_diff_editor(const svn_de
shim_callbacks->fetch_baton = eb;
SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
- shim_callbacks,
+ NULL, NULL, shim_callbacks,
result_pool, result_pool));
return SVN_NO_ERROR;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/resolved.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/resolved.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/resolved.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/resolved.c Wed May 16 20:32:43 2012
@@ -55,12 +55,14 @@ svn_client_resolve(const char *path,
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
- SVN_ERR(svn_wc_resolved_conflict5(ctx->wc_ctx, local_abspath,
+ SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, local_abspath,
depth,
TRUE /* resolve_text */,
"" /* resolve_prop (ALL props) */,
TRUE /* resolve_tree */,
conflict_choice,
+ ctx->conflict_func2,
+ ctx->conflict_baton2,
ctx->cancel_func, ctx->cancel_baton,
ctx->notify_func2, ctx->notify_baton2,
pool));
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/revisions.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/revisions.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/revisions.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/revisions.c Wed May 16 20:32:43 2012
@@ -91,9 +91,9 @@ svn_client__get_revision_number(svn_revn
if (svn_path_is_url(local_abspath))
goto invalid_rev_arg;
- err = svn_wc__node_get_commit_base_rev(revnum, wc_ctx,
- local_abspath,
- scratch_pool);
+ err = svn_wc__node_get_commit_base(revnum, NULL, NULL, NULL,
+ wc_ctx, local_abspath,
+ scratch_pool, scratch_pool);
/* Return the same error as older code did (before and at r935091).
At least svn_client_proplist3 promises SVN_ERR_ENTRY_NOT_FOUND. */
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/status.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/status.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/status.c Wed May 16 20:32:43 2012
@@ -516,13 +516,13 @@ svn_client_status5(svn_revnum_t *result_
*/
if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
{
- apr_hash_t *externals_new;
- SVN_ERR(svn_wc__externals_gather_definitions(&externals_new, NULL,
- ctx->wc_ctx, target_abspath,
- depth, pool, pool));
+ apr_hash_t *external_map;
+ SVN_ERR(svn_wc__externals_defined_below(&external_map,
+ ctx->wc_ctx, target_abspath,
+ pool, pool));
- SVN_ERR(svn_client__do_external_status(ctx, externals_new,
+ SVN_ERR(svn_client__do_external_status(ctx, external_map,
depth, get_all,
update, no_ignore,
status_func, status_baton, pool));
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/switch.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/switch.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/switch.c Wed May 16 20:32:43 2012
@@ -73,7 +73,8 @@ switch_internal(svn_revnum_t *result_rev
{
const svn_ra_reporter3_t *reporter;
void *report_baton;
- const char *url, *target, *source_root, *switch_rev_url;
+ const char *anchor_url, *target;
+ svn_client__pathrev_t *switch_loc;
svn_ra_session_t *ra_session;
svn_revnum_t revnum;
svn_error_t *err = SVN_NO_ERROR;
@@ -141,8 +142,9 @@ switch_internal(svn_revnum_t *result_rev
else
target = "";
- SVN_ERR(svn_wc__node_get_url(&url, ctx->wc_ctx, anchor_abspath, pool, pool));
- if (! url)
+ SVN_ERR(svn_wc__node_get_url(&anchor_url, ctx->wc_ctx, anchor_abspath,
+ pool, pool));
+ if (! anchor_url)
return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
_("Directory '%s' has no URL"),
svn_dirent_local_style(anchor_abspath, pool));
@@ -175,20 +177,17 @@ switch_internal(svn_revnum_t *result_rev
}
/* Open an RA session to 'source' URL */
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
- &switch_rev_url,
- switch_url, anchor_abspath,
- peg_revision, revision,
- ctx, pool));
-
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_root, pool));
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &switch_loc,
+ switch_url, anchor_abspath,
+ peg_revision, revision,
+ ctx, pool));
/* Disallow a switch operation to change the repository root of the
target. */
- if (! svn_uri__is_ancestor(source_root, url))
+ if (! svn_uri__is_ancestor(switch_loc->repos_root_url, anchor_url))
return svn_error_createf(SVN_ERR_WC_INVALID_SWITCH, NULL,
_("'%s'\nis not the same repository as\n'%s'"),
- url, source_root);
+ anchor_url, switch_loc->repos_root_url);
/* If we're not ignoring ancestry, then error out if the switch
source and target don't have a common ancestory.
@@ -197,27 +196,29 @@ switch_internal(svn_revnum_t *result_rev
### okay? */
if (! ignore_ancestry)
{
- const char *target_url, *yc_url;
- svn_revnum_t target_rev, yc_rev;
+ svn_client__pathrev_t *target_base_loc, *yca;
+
+ SVN_ERR(svn_client__wc_node_get_base(&target_base_loc, local_abspath,
+ ctx, pool, pool));
- SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx, local_abspath,
- pool, pool));
- SVN_ERR(svn_wc__node_get_base_rev(&target_rev, ctx->wc_ctx,
- local_abspath, pool));
- /* ### It would be nice if this function could reuse the existing
+ if (!target_base_loc)
+ yca = NULL; /* Not versioned */
+ else
+ {
+ /* ### It would be nice if this function could reuse the existing
ra session instead of opening two for its own use. */
- SVN_ERR(svn_client__get_youngest_common_ancestor(NULL, &yc_url, &yc_rev,
- switch_rev_url, revnum,
- target_url, target_rev,
- ctx, pool));
- if (! (yc_url && SVN_IS_VALID_REVNUM(yc_rev)))
+ SVN_ERR(svn_client__get_youngest_common_ancestor(
+ &yca, switch_loc, target_base_loc, ctx, pool, pool));
+ }
+ if (! yca)
return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
_("'%s' shares no common ancestry with '%s'"),
- switch_url, local_abspath);
+ switch_url,
+ svn_dirent_dirname(local_abspath, pool));
}
- SVN_ERR(svn_ra_reparent(ra_session, url, pool));
+ SVN_ERR(svn_ra_reparent(ra_session, anchor_url, pool));
/* Fetch the switch (update) editor. If REVISION is invalid, that's
okay; the RA driver will call editor->set_target_revision() later on. */
@@ -226,11 +227,11 @@ switch_internal(svn_revnum_t *result_rev
dfb.ra_session = ra_session;
SVN_ERR(svn_ra_get_session_url(ra_session, &dfb.anchor_url, pool));
- dfb.target_revision = revnum;
+ dfb.target_revision = switch_loc->rev;
SVN_ERR(svn_wc__get_switch_editor(&switch_editor, &switch_edit_baton,
&revnum, ctx->wc_ctx, anchor_abspath,
- target, switch_rev_url, use_commit_times,
+ target, switch_loc->url, use_commit_times,
depth,
depth_is_sticky, allow_unver_obstructions,
server_supports_depth,
@@ -244,10 +245,11 @@ switch_internal(svn_revnum_t *result_rev
/* Tell RA to do an update of URL+TARGET to REVISION; if we pass an
invalid revnum, that means RA will use the latest revision. */
- SVN_ERR(svn_ra_do_switch2(ra_session, &reporter, &report_baton, revnum,
+ SVN_ERR(svn_ra_do_switch2(ra_session, &reporter, &report_baton,
+ switch_loc->rev,
target,
depth_is_sticky ? depth : svn_depth_unknown,
- switch_rev_url,
+ switch_loc->url,
switch_editor, switch_edit_baton, pool));
/* Drive the reporter structure, describing the revisions within
@@ -288,7 +290,8 @@ switch_internal(svn_revnum_t *result_rev
SVN_ERR(svn_client__handle_externals(new_externals,
new_depths,
- source_root, local_abspath,
+ switch_loc->repos_root_url,
+ local_abspath,
depth, use_sleep,
ctx, pool));
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/update.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/update.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/update.c Wed May 16 20:32:43 2012
@@ -191,10 +191,9 @@ update_internal(svn_revnum_t *result_rev
void *update_edit_baton;
const svn_ra_reporter3_t *reporter;
void *report_baton;
- const char *anchor_url;
const char *corrected_url;
const char *target;
- const char *repos_root;
+ svn_client__pathrev_t *anchor_loc;
svn_error_t *err;
svn_revnum_t revnum;
svn_boolean_t use_commit_times;
@@ -207,7 +206,7 @@ update_internal(svn_revnum_t *result_rev
apr_array_header_t *preserved_exts;
struct svn_client__dirent_fetcher_baton_t dfb;
svn_boolean_t server_supports_depth;
- svn_boolean_t tree_conflicted;
+ svn_boolean_t text_conflicted, prop_conflicted, tree_conflicted;
svn_config_t *cfg = ctx->config ? apr_hash_get(ctx->config,
SVN_CONFIG_CATEGORY_CONFIG,
APR_HASH_KEY_STRING) : NULL;
@@ -221,39 +220,34 @@ update_internal(svn_revnum_t *result_rev
else
target = "";
- /* Get full URL from the ANCHOR. */
- SVN_ERR(svn_wc__node_get_url(&anchor_url, ctx->wc_ctx, anchor_abspath,
- pool, pool));
- if (! anchor_url)
- return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
- _("'%s' has no URL"),
- svn_dirent_local_style(anchor_abspath, pool));
-
- /* Check if our anchor exists in BASE. If it doesn't we can't update.
- ### For performance reasons this should be handled with the same query
- ### as retrieving the anchor url. */
- SVN_ERR(svn_wc__node_get_base_rev(&revnum, ctx->wc_ctx, anchor_abspath,
- pool));
-
- /* It does not make sense to update tree-conflict victims. */
- err = svn_wc_conflicted_p3(NULL, NULL, &tree_conflicted,
+ /* Check if our anchor exists in BASE. If it doesn't we can't update. */
+ SVN_ERR(svn_client__wc_node_get_base(&anchor_loc, anchor_abspath,
+ ctx, pool, pool));
+
+ /* It does not make sense to update conflict victims. */
+ err = svn_wc_conflicted_p3(&text_conflicted, &prop_conflicted,
+ &tree_conflicted,
ctx->wc_ctx, local_abspath, pool);
if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
{
svn_error_clear(err);
+ text_conflicted = FALSE;
+ prop_conflicted = FALSE;
tree_conflicted = FALSE;
}
else
SVN_ERR(err);
- if (!SVN_IS_VALID_REVNUM(revnum) || tree_conflicted)
+ if (! anchor_loc
+ || text_conflicted || prop_conflicted || tree_conflicted)
{
if (ctx->notify_func2)
{
svn_wc_notify_t *nt;
nt = svn_wc_create_notify(local_abspath,
- tree_conflicted
+ (text_conflicted || prop_conflicted
+ || tree_conflicted)
? svn_wc_notify_skip_conflicted
: svn_wc_notify_update_skip_working_only,
pool);
@@ -330,29 +324,30 @@ update_internal(svn_revnum_t *result_rev
/* Open an RA session for the URL */
SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
- anchor_url,
+ anchor_loc->url,
anchor_abspath, NULL, TRUE,
TRUE, ctx, pool));
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
-
/* If we got a corrected URL from the RA subsystem, we'll need to
relocate our working copy first. */
if (corrected_url)
{
- const char *current_repos_root;
- const char *current_uuid;
+ const char *new_repos_root_url;
/* To relocate everything inside our repository we need the old and new
- repos root. ### And we should only perform relocates on the wcroot */
- SVN_ERR(svn_wc__node_get_repos_info(¤t_repos_root, ¤t_uuid,
- ctx->wc_ctx, anchor_abspath,
- pool, pool));
-
- /* ### Check uuid here before calling relocate? */
- SVN_ERR(svn_client_relocate2(anchor_abspath, current_repos_root,
- repos_root, ignore_externals, ctx, pool));
- anchor_url = corrected_url;
+ repos root. */
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &new_repos_root_url, pool));
+
+ /* svn_client_relocate2() will check the uuid */
+ SVN_ERR(svn_client_relocate2(anchor_abspath, anchor_loc->url,
+ new_repos_root_url, ignore_externals,
+ ctx, pool));
+
+ /* Store updated repository root for externals */
+ anchor_loc->repos_root_url = new_repos_root_url;
+ /* ### We should update anchor_loc->repos_uuid too, although currently
+ * we don't use it. */
+ anchor_loc->url = corrected_url;
}
/* ### todo: shouldn't svn_client__get_revision_number be able
@@ -366,7 +361,7 @@ update_internal(svn_revnum_t *result_rev
dfb.ra_session = ra_session;
dfb.target_revision = revnum;
- dfb.anchor_url = anchor_url;
+ dfb.anchor_url = anchor_loc->url;
/* Fetch the update editor. If REVISION is invalid, that's okay;
the RA driver will call editor->set_target_revision later on. */
@@ -428,7 +423,7 @@ update_internal(svn_revnum_t *result_rev
SVN_ERR(svn_client__handle_externals(new_externals,
new_depths,
- repos_root, local_abspath,
+ anchor_loc->repos_root_url, local_abspath,
depth, use_sleep,
ctx, pool));
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_client/util.c?rev=1339349&r1=1339348&r2=1339349&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_client/util.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_client/util.c Wed May 16 20:32:43 2012
@@ -41,6 +41,99 @@
#include "svn_private_config.h"
+svn_client__pathrev_t *
+svn_client__pathrev_create(const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t rev,
+ const char *url,
+ apr_pool_t *result_pool)
+{
+ svn_client__pathrev_t *loc = apr_palloc(result_pool, sizeof(*loc));
+
+ SVN_ERR_ASSERT_NO_RETURN(svn_path_is_url(repos_root_url));
+ SVN_ERR_ASSERT_NO_RETURN(svn_path_is_url(url));
+
+ loc->repos_root_url = apr_pstrdup(result_pool, repos_root_url);
+ loc->repos_uuid = apr_pstrdup(result_pool, repos_uuid);
+ loc->rev = rev;
+ loc->url = apr_pstrdup(result_pool, url);
+ return loc;
+}
+
+svn_client__pathrev_t *
+svn_client__pathrev_create_with_relpath(const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t rev,
+ const char *relpath,
+ apr_pool_t *result_pool)
+{
+ SVN_ERR_ASSERT_NO_RETURN(svn_relpath_is_canonical(relpath));
+
+ return svn_client__pathrev_create(
+ repos_root_url, repos_uuid, rev,
+ svn_path_url_add_component2(repos_root_url, relpath, result_pool),
+ result_pool);
+}
+
+svn_error_t *
+svn_client__pathrev_create_with_session(svn_client__pathrev_t **pathrev_p,
+ svn_ra_session_t *ra_session,
+ svn_revnum_t rev,
+ const char *url,
+ apr_pool_t *result_pool)
+{
+ svn_client__pathrev_t *pathrev = apr_palloc(result_pool, sizeof(*pathrev));
+
+ SVN_ERR_ASSERT(svn_path_is_url(url));
+
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &pathrev->repos_root_url,
+ result_pool));
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &pathrev->repos_uuid, result_pool));
+ pathrev->rev = rev;
+ pathrev->url = apr_pstrdup(result_pool, url);
+ *pathrev_p = pathrev;
+ return SVN_NO_ERROR;
+}
+
+svn_client__pathrev_t *
+svn_client__pathrev_dup(const svn_client__pathrev_t *pathrev,
+ apr_pool_t *result_pool)
+{
+ return svn_client__pathrev_create(
+ pathrev->repos_root_url, pathrev->repos_uuid,
+ pathrev->rev, pathrev->url, result_pool);
+}
+
+svn_client__pathrev_t *
+svn_client__pathrev_join_relpath(const svn_client__pathrev_t *pathrev,
+ const char *relpath,
+ apr_pool_t *result_pool)
+{
+ return svn_client__pathrev_create(
+ pathrev->repos_root_url, pathrev->repos_uuid, pathrev->rev,
+ svn_path_url_add_component2(pathrev->url, relpath, result_pool),
+ result_pool);
+}
+
+const char *
+svn_client__pathrev_relpath(const svn_client__pathrev_t *pathrev,
+ apr_pool_t *result_pool)
+{
+ return svn_uri_skip_ancestor(pathrev->repos_root_url, pathrev->url,
+ result_pool);
+}
+
+const char *
+svn_client__pathrev_fspath(const svn_client__pathrev_t *pathrev,
+ apr_pool_t *result_pool)
+{
+ return svn_fspath__canonicalize(svn_uri_skip_ancestor(
+ pathrev->repos_root_url, pathrev->url,
+ result_pool),
+ result_pool);
+}
+
+
svn_client_commit_item3_t *
svn_client_commit_item3_create(apr_pool_t *pool)
{
@@ -90,10 +183,7 @@ svn_client__path_relative_to_root(const
/* If we have a WC path... */
if (! svn_path_is_url(abspath_or_url))
{
- /* ...fetch its entry, and attempt to get both its full URL and
- repository root URL. If we can't get REPOS_ROOT from the WC
- entry, we'll get it from the RA layer.*/
-
+ /* ... query it directly. */
SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
wc_ctx,
abspath_or_url,
@@ -142,6 +232,66 @@ svn_client__path_relative_to_root(const
}
svn_error_t *
+svn_client__wc_node_get_base(svn_client__pathrev_t **base_p,
+ const char *wc_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *relpath;
+
+ *base_p = apr_palloc(result_pool, sizeof(**base_p));
+
+ SVN_ERR(svn_wc__node_get_base(&(*base_p)->rev,
+ &relpath,
+ &(*base_p)->repos_root_url,
+ &(*base_p)->repos_uuid,
+ ctx->wc_ctx, wc_abspath,
+ result_pool, scratch_pool));
+ if ((*base_p)->repos_root_url && relpath)
+ {
+ (*base_p)->url = svn_path_url_add_component2(
+ (*base_p)->repos_root_url, relpath, result_pool);
+ }
+ else
+ {
+ *base_p = NULL;
+ }
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p,
+ const char *wc_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *relpath;
+
+ *origin_p = apr_palloc(result_pool, sizeof(**origin_p));
+
+ SVN_ERR(svn_wc__node_get_origin(NULL /* is_copy */,
+ &(*origin_p)->rev,
+ &relpath,
+ &(*origin_p)->repos_root_url,
+ &(*origin_p)->repos_uuid,
+ NULL, ctx->wc_ctx, wc_abspath,
+ FALSE /* scan_deleted */,
+ result_pool, scratch_pool));
+ if ((*origin_p)->repos_root_url && relpath)
+ {
+ (*origin_p)->url = svn_path_url_add_component2(
+ (*origin_p)->repos_root_url, relpath, result_pool);
+ }
+ else
+ {
+ *origin_p = NULL;
+ }
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_client_get_repos_root(const char **repos_root,
const char **repos_uuid,
const char *abspath_or_url,
@@ -244,38 +394,10 @@ svn_client__assert_homogeneous_target_ty
struct shim_callbacks_baton
{
svn_wc_context_t *wc_ctx;
- const char *anchor_abspath;
+ apr_hash_t *relpath_map;
};
static svn_error_t *
-rationalize_shim_path(const char **local_abspath,
- struct shim_callbacks_baton *scb,
- const char *path,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- if (svn_path_is_url(path))
- {
- /* This is a copyfrom URL */
- const char *wcroot_abspath;
- const char *wcroot_url;
- const char *relpath;
-
- SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, scb->wc_ctx,
- scb->anchor_abspath,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__node_get_url(&wcroot_url, scb->wc_ctx, wcroot_abspath,
- scratch_pool, scratch_pool));
- relpath = svn_uri_skip_ancestor(wcroot_url, path, scratch_pool);
- *local_abspath = svn_dirent_join(wcroot_abspath, relpath, result_pool);
- }
- else
- *local_abspath = svn_dirent_join(scb->anchor_abspath, path, result_pool);
-
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
fetch_props_func(apr_hash_t **props,
void *baton,
const char *path,
@@ -286,17 +408,13 @@ fetch_props_func(apr_hash_t **props,
struct shim_callbacks_baton *scb = baton;
const char *local_abspath;
- /* Early out: if we didn't get an anchor_abspath, it means we don't have a
- working copy, and hence no method of fetching the requisite information. */
- if (!scb->anchor_abspath)
+ local_abspath = apr_hash_get(scb->relpath_map, path, APR_HASH_KEY_STRING);
+ if (!local_abspath)
{
*props = apr_hash_make(result_pool);
return SVN_NO_ERROR;
}
- SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
- scratch_pool));
-
SVN_ERR(svn_wc_get_pristine_props(props, scb->wc_ctx, local_abspath,
result_pool, scratch_pool));
@@ -317,17 +435,13 @@ fetch_kind_func(svn_kind_t *kind,
svn_node_kind_t node_kind;
const char *local_abspath;
- /* Early out: if we didn't get an anchor_abspath, it means we don't have a
- working copy, and hence no method of fetching the requisite information. */
- if (!scb->anchor_abspath)
+ local_abspath = apr_hash_get(scb->relpath_map, path, APR_HASH_KEY_STRING);
+ if (!local_abspath)
{
*kind = svn_kind_unknown;
return SVN_NO_ERROR;
}
- SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
- scratch_pool));
-
SVN_ERR(svn_wc_read_kind(&node_kind, scb->wc_ctx, local_abspath, FALSE,
scratch_pool));
*kind = svn__kind_from_node_kind(node_kind, FALSE);
@@ -349,17 +463,13 @@ fetch_base_func(const char **filename,
svn_stream_t *temp_stream;
svn_error_t *err;
- /* Early out: if we didn't get an anchor_abspath, it means we don't have a
- working copy, and hence no method of fetching the requisite information. */
- if (!scb->anchor_abspath)
+ local_abspath = apr_hash_get(scb->relpath_map, path, APR_HASH_KEY_STRING);
+ if (!local_abspath)
{
*filename = NULL;
return SVN_NO_ERROR;
}
- SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
- scratch_pool));
-
err = svn_wc_get_pristine_contents2(&pristine_stream, scb->wc_ctx,
local_abspath, scratch_pool,
scratch_pool);
@@ -383,7 +493,7 @@ fetch_base_func(const char **filename,
svn_delta_shim_callbacks_t *
svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
- const char *anchor_abspath,
+ apr_hash_t *relpath_map,
apr_pool_t *result_pool)
{
svn_delta_shim_callbacks_t *callbacks =
@@ -391,7 +501,10 @@ svn_client__get_shim_callbacks(svn_wc_co
struct shim_callbacks_baton *scb = apr_pcalloc(result_pool, sizeof(*scb));
scb->wc_ctx = wc_ctx;
- scb->anchor_abspath = apr_pstrdup(result_pool, anchor_abspath);
+ if (relpath_map)
+ scb->relpath_map = relpath_map;
+ else
+ scb->relpath_map = apr_hash_make(result_pool);
callbacks->fetch_props_func = fetch_props_func;
callbacks->fetch_kind_func = fetch_kind_func;