Modified: subversion/branches/javahl-ra/subversion/libsvn_client/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/mergeinfo.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/mergeinfo.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/mergeinfo.c Tue May 29 01:39:41 2012 @@ -217,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) @@ -284,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, @@ -1050,15 +1051,13 @@ 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. */ @@ -1070,10 +1069,9 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m SVN_ERR(svn_client__wc_node_get_origin(&origin, local_abspath, ctx, scratch_pool, scratch_pool)); - rev = origin ? origin->rev : SVN_INVALID_REVNUM; if (!origin - || strcmp(origin->url, url) != 0 - || peg_rev != rev) + || strcmp(origin->url, peg_loc->url) != 0 + || peg_loc->rev != origin->rev) { use_url = TRUE; /* Don't rely on local mergeinfo */ } @@ -1087,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() */
Modified: subversion/branches/javahl-ra/subversion/libsvn_client/patch.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/patch.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/patch.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/patch.c Tue May 29 01:39:41 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/javahl-ra/subversion/libsvn_client/prop_commands.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/prop_commands.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/prop_commands.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/prop_commands.c Tue May 29 01:39:41 2012 @@ -769,7 +769,7 @@ get_prop_from_wc(apr_hash_t *props, rb.wc_ctx = ctx->wc_ctx; SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, target_abspath, - propname, depth, FALSE, pristine, + propname, depth, pristine, changelists, recursive_propget_receiver, &rb, ctx->cancel_func, ctx->cancel_baton, @@ -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) @@ -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); @@ -1149,8 +1148,7 @@ svn_client_proplist3(const char *path_or } SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL, - depth, - FALSE, pristine, changelists, + depth, pristine, changelists, recursive_proplist_receiver, &rb, ctx->cancel_func, ctx->cancel_baton, pool)); @@ -1172,17 +1170,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/javahl-ra/subversion/libsvn_client/ra.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/ra.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/ra.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/ra.c Tue May 29 01:39:41 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 @@ -478,31 +513,6 @@ svn_client__ra_session_from_path2(svn_ra 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__pathrev_t *resolved_loc; - - SVN_ERR(svn_client__ra_session_from_path2(ra_session_p, &resolved_loc, - path_or_url, base_dir_abspath, - peg_revision, revision, - ctx, pool)); - if (rev_p) - *rev_p = resolved_loc->rev; - if (url_p) - *url_p = resolved_loc->url; - - return SVN_NO_ERROR; -} - svn_error_t * svn_client__ensure_ra_session_url(const char **old_session_url, @@ -964,3 +974,149 @@ svn_client__youngest_common_ancestor(con 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/javahl-ra/subversion/libsvn_client/resolved.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/resolved.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/resolved.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/resolved.c Tue May 29 01:39:41 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/javahl-ra/subversion/libsvn_client/revisions.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/revisions.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/revisions.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/revisions.c Tue May 29 01:39:41 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/javahl-ra/subversion/libsvn_client/status.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/status.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/status.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/status.c Tue May 29 01:39:41 2012 @@ -292,40 +292,51 @@ svn_client_status5(svn_revnum_t *result_ sb.wc_ctx = ctx->wc_ctx; SVN_ERR(svn_dirent_get_absolute(&target_abspath, path, pool)); - { - svn_node_kind_t kind; - SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, target_abspath, FALSE, pool)); + if (update) + { + /* The status editor only works on directories, so get the ancestor + if necessary */ + + svn_node_kind_t kind; + + SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, target_abspath, FALSE, + pool)); - /* Dir must be a working copy directory or the status editor fails */ - if (kind == svn_node_dir) - { - dir_abspath = target_abspath; - target_basename = ""; - dir = path; - } - else - { - dir_abspath = svn_dirent_dirname(target_abspath, pool); - target_basename = svn_dirent_basename(target_abspath, NULL); - dir = svn_dirent_dirname(path, pool); - - if (kind != svn_node_file) - { - err = svn_wc_read_kind(&kind, ctx->wc_ctx, dir_abspath, FALSE, - pool); - - svn_error_clear(err); - - if (err || kind != svn_node_dir) - { - return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL, - _("'%s' is not a working copy"), - svn_dirent_local_style(path, pool)); - } - } - } - } + /* Dir must be a working copy directory or the status editor fails */ + if (kind == svn_node_dir) + { + dir_abspath = target_abspath; + target_basename = ""; + dir = path; + } + else + { + dir_abspath = svn_dirent_dirname(target_abspath, pool); + target_basename = svn_dirent_basename(target_abspath, NULL); + dir = svn_dirent_dirname(path, pool); + + if (kind != svn_node_file) + { + err = svn_wc_read_kind(&kind, ctx->wc_ctx, dir_abspath, FALSE, + pool); + + svn_error_clear(err); + + if (err || kind != svn_node_dir) + { + return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL, + _("'%s' is not a working copy"), + svn_dirent_local_style(path, pool)); + } + } + } + } + else + { + dir = path; + dir_abspath = target_abspath; + } if (svn_dirent_is_absolute(dir)) { @@ -516,13 +527,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)); @@ -625,7 +636,6 @@ svn_client__create_status(svn_client_sta if (status->file_external) { (*cst)->switched = FALSE; - (*cst)->node_status = (*cst)->text_status; } (*cst)->lock = status->lock; Modified: subversion/branches/javahl-ra/subversion/libsvn_client/switch.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/switch.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/switch.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/switch.c Tue May 29 01:39:41 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,30 +196,29 @@ switch_internal(svn_revnum_t *result_rev ### okay? */ if (! ignore_ancestry) { - const char *target_url; - svn_revnum_t target_rev; - svn_client__pathrev_t *switch_loc, *target_loc, *yca; - - SVN_ERR(svn_client__pathrev_create_with_session( - &switch_loc, ra_session, revnum, switch_rev_url, 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)); - SVN_ERR(svn_client__pathrev_create_with_session( - &target_loc, ra_session, target_rev, target_url, pool)); - /* ### It would be nice if this function could reuse the existing + svn_client__pathrev_t *target_base_loc, *yca; + + SVN_ERR(svn_client__wc_node_get_base(&target_base_loc, local_abspath, + ctx, pool, pool)); + + 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( - &yca, switch_loc, target_loc, ctx, pool, pool)); + 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. */ @@ -229,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, @@ -247,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 @@ -291,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/javahl-ra/subversion/libsvn_client/update.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/update.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/update.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/update.c Tue May 29 01:39:41 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/javahl-ra/subversion/libsvn_client/util.c URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/util.c?rev=1343447&r1=1343446&r2=1343447&view=diff ============================================================================== --- subversion/branches/javahl-ra/subversion/libsvn_client/util.c (original) +++ subversion/branches/javahl-ra/subversion/libsvn_client/util.c Tue May 29 01:39:41 2012 @@ -232,6 +232,35 @@ 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,
