You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/05/11 02:10:38 UTC
svn commit: r1336975 - /subversion/trunk/subversion/libsvn_client/switch.c
Author: rhuijben
Date: Fri May 11 00:10:37 2012
New Revision: 1336975
URL: http://svn.apache.org/viewvc?rev=1336975&view=rev
Log:
* subversion/libsvn_client/switch.c
(switch_internal): Don't perform 2 wc_db calls when one by itself provides
all the information we need.
Modified:
subversion/trunk/subversion/libsvn_client/switch.c
Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1336975&r1=1336974&r2=1336975&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Fri May 11 00:10:37 2012
@@ -197,26 +197,39 @@ switch_internal(svn_revnum_t *result_rev
### okay? */
if (! ignore_ancestry)
{
- const char *target_url;
+ const char *repos_root_url;
+ const char *repos_relpath;
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(&target_rev, NULL, NULL, NULL, ctx->wc_ctx,
+ SVN_ERR(svn_wc__node_get_base(&target_rev, &repos_relpath,
+ &repos_root_url, NULL, ctx->wc_ctx,
local_abspath, pool, 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
+
+ if (!repos_relpath)
+ yca = NULL; /* Not versioned */
+ else
+ {
+ const char *url = svn_path_url_add_component2(repos_root_url,
+ repos_relpath, pool);
+
+ SVN_ERR(svn_client__pathrev_create_with_session(&target_loc,
+ ra_session,
+ target_rev, url,
+ pool));
+
+ /* ### 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_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));
}