You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/02/14 14:50:49 UTC
svn commit: r1243920 - in /subversion/trunk/subversion/libsvn_client:
checkout.c client.h copy.c externals.c
Author: stsp
Date: Tue Feb 14 13:50:49 2012
New Revision: 1243920
URL: http://svn.apache.org/viewvc?rev=1243920&view=rev
Log:
Retire unused struct svn_client__ra_session_from_path_results.
This structure was used by svn_client__checkout_internal() and allowed
callers to provide cached results obtained from the RA layer.
However, current callers either passed NULL for the cache, or used the
cache only for a single invocation of svn_client__checkout_internal(),
which defeats its purpose.
* subversion/libsvn_client/copy.c
(repos_to_wc_copy_single): Track removed ra_cache parameter.
* subversion/libsvn_client/externals.c
(switch_dir_external): Drop ra_cache param of svn_client__checkout_internal().
(handle_external_item_change): Instead of using ra_cache as essentially
a mixed bag of random local variables, use local variables instead.
* subversion/libsvn_client/client.h
(svn_client__ra_session_from_path_results): Remove.
(svn_client__checkout_internal): Update declaration (ra_cache param removed).
* subversion/libsvn_client/checkout.c
(svn_client__checkout_internal): Remove ra_cache parameter. As a side-effect
this simplifies the implementation of this function quite a bit.
(svn_client_checkout3): No ra_cache param for svn_client__checkout_internal().
Modified:
subversion/trunk/subversion/libsvn_client/checkout.c
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/copy.c
subversion/trunk/subversion/libsvn_client/externals.c
Modified: subversion/trunk/subversion/libsvn_client/checkout.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/checkout.c?rev=1243920&r1=1243919&r2=1243920&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/checkout.c (original)
+++ subversion/trunk/subversion/libsvn_client/checkout.c Tue Feb 14 13:50:49 2012
@@ -73,7 +73,6 @@ svn_client__checkout_internal(svn_revnum
const char *local_abspath,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- const svn_client__ra_session_from_path_results *ra_cache,
svn_depth_t depth,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
@@ -88,6 +87,10 @@ svn_client__checkout_internal(svn_revnum
const char *session_url;
svn_node_kind_t kind;
const char *uuid, *repos_root;
+ apr_pool_t *session_pool = svn_pool_create(pool);
+ svn_ra_session_t *ra_session;
+ svn_revnum_t tmp_revnum;
+ const char *tmp_session_url;
/* Sanity check. Without these, the checkout is meaningless. */
SVN_ERR_ASSERT(local_abspath != NULL);
@@ -100,60 +103,19 @@ svn_client__checkout_internal(svn_revnum
&& (revision->kind != svn_opt_revision_head))
return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
- {
- svn_boolean_t have_repos_root_url;
- svn_boolean_t have_repos_uuid;
- svn_boolean_t have_session_url;
- svn_boolean_t have_revnum;
- svn_boolean_t have_kind;
-
- if ((have_repos_root_url = (ra_cache && ra_cache->repos_root_url)))
- repos_root = ra_cache->repos_root_url;
-
- if ((have_repos_uuid = (ra_cache && ra_cache->repos_uuid)))
- uuid = ra_cache->repos_uuid;
-
- if ((have_session_url = (ra_cache && ra_cache->ra_session_url)))
- session_url = ra_cache->ra_session_url;
-
- if ((have_revnum = (ra_cache && SVN_IS_VALID_REVNUM(ra_cache->ra_revnum))))
- revnum = ra_cache->ra_revnum;
-
- if ((have_kind = (ra_cache && ra_cache->kind != svn_node_unknown)))
- kind = ra_cache->kind;
-
- if (! have_repos_root_url || ! have_repos_uuid || ! have_session_url ||
- ! have_revnum || ! have_kind)
- {
- apr_pool_t *session_pool = svn_pool_create(pool);
- svn_ra_session_t *ra_session;
- svn_revnum_t tmp_revnum;
- const char *tmp_session_url;
-
- /* Get the RA connection. */
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &tmp_revnum,
- &tmp_session_url, url, NULL,
- peg_revision, revision, ctx,
- session_pool));
-
- if (! have_repos_root_url)
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
-
- if (! have_repos_uuid)
- SVN_ERR(svn_ra_get_uuid2(ra_session, &uuid, pool));
-
- if (! have_session_url)
- session_url = apr_pstrdup(pool, tmp_session_url);
-
- if (! have_revnum)
- revnum = tmp_revnum;
-
- if (! have_kind)
- SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
-
- svn_pool_destroy(session_pool);
- }
- }
+ /* Get the RA connection. */
+ SVN_ERR(svn_client__ra_session_from_path(&ra_session, &tmp_revnum,
+ &tmp_session_url, url, NULL,
+ peg_revision, revision, ctx,
+ session_pool));
+
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &uuid, pool));
+ session_url = apr_pstrdup(pool, tmp_session_url);
+ revnum = tmp_revnum;
+ SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
+
+ svn_pool_destroy(session_pool);
if (kind == svn_node_none)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
@@ -253,7 +215,7 @@ svn_client_checkout3(svn_revnum_t *resul
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
return svn_client__checkout_internal(result_rev, URL, local_abspath,
- peg_revision, revision, NULL, depth,
+ peg_revision, revision, depth,
ignore_externals,
allow_unver_obstructions, NULL,
ctx, pool);
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1243920&r1=1243919&r2=1243920&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Feb 14 13:50:49 2012
@@ -499,36 +499,6 @@ svn_client__update_internal(svn_revnum_t
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Structure holding the results of svn_client__ra_session_from_path()
- plus the repository root URL and UUID and the node kind for the
- input URL, REVISION and PEG_REVISION . See
- svn_client__ra_session_from_path() for the meaning of these fields.
- This structure is used by svn_client__checkout_internal() to save
- one or more round-trips if the client already gathered some of this
- information. Not all the fields need to be filled in. */
-typedef struct svn_client__ra_session_from_path_results
-{
- /* The repository root URL. A NULL value means the root URL is
- unknown.*/
- const char *repos_root_url;
-
- /* The repository UUID. A NULL value means the UUID is unknown. */
- const char *repos_uuid;
-
- /* The actual final resulting URL for the input URL. This may be
- different because of copy history. A NULL value means the
- resulting URL is unknown. */
- const char *ra_session_url;
-
- /* The actual final resulting revision for the input URL. An
- invalid revnum as determined by SVN_IS_VALID_REVNUM() means the
- revnum is unknown. */
- svn_revnum_t ra_revnum;
-
- /* An optional node kind for the URL. svn_node_unknown if unknown */
- svn_node_kind_t kind;
-} svn_client__ra_session_from_path_results;
-
/* Checkout into LOCAL_ABSPATH a working copy of URL at REVISION, and (if not
NULL) set RESULT_REV to the checked out revision.
@@ -565,7 +535,6 @@ svn_client__checkout_internal(svn_revnum
const char *local_abspath,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- const svn_client__ra_session_from_path_results *ra_cache,
svn_depth_t depth,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1243920&r1=1243919&r2=1243920&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Tue Feb 14 13:50:49 2012
@@ -1503,7 +1503,7 @@ repos_to_wc_copy_single(svn_client__copy
pair->src_original,
tmp_abspath,
&pair->src_peg_revision,
- &pair->src_op_revision, NULL,
+ &pair->src_op_revision,
svn_depth_infinity,
ignore_externals, FALSE,
&sleep_needed, ctx, pool);
Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1243920&r1=1243919&r2=1243920&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Tue Feb 14 13:50:49 2012
@@ -277,7 +277,7 @@ switch_dir_external(const char *local_ab
/* ... Hello, new hotness. */
SVN_ERR(svn_client__checkout_internal(NULL, url, local_abspath, peg_revision,
- revision, NULL, svn_depth_infinity,
+ revision, svn_depth_infinity,
FALSE, FALSE, timestamp_sleep,
ctx, pool));
@@ -604,11 +604,15 @@ handle_external_item_change(const struct
apr_pool_t *scratch_pool)
{
svn_ra_session_t *ra_session;
- svn_client__ra_session_from_path_results ra_cache = { 0 };
+ svn_revnum_t ra_revnum;
+ const char *ra_session_url;
+ const char *repos_root_url;
+ const char *repos_uuid;
const char *new_url;
- svn_node_kind_t kind;
+ svn_node_kind_t ext_kind;
+ svn_node_kind_t local_kind;
- ra_cache.kind = svn_node_unknown;
+ local_kind = svn_node_unknown;
SVN_ERR_ASSERT(eb->repos_root_url && parent_dir_url);
SVN_ERR_ASSERT(new_item != NULL);
@@ -628,34 +632,30 @@ handle_external_item_change(const struct
/* Determine if the external is a file or directory. */
/* Get the RA connection. */
SVN_ERR(svn_client__ra_session_from_path(&ra_session,
- &ra_cache.ra_revnum,
- &ra_cache.ra_session_url,
+ &ra_revnum,
+ &ra_session_url,
new_url, NULL,
&(new_item->peg_revision),
&(new_item->revision), eb->ctx,
scratch_pool));
- SVN_ERR(svn_ra_get_uuid2(ra_session, &ra_cache.repos_uuid,
- scratch_pool));
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &ra_cache.repos_root_url,
- scratch_pool));
- SVN_ERR(svn_ra_check_path(ra_session, "", ra_cache.ra_revnum, &kind,
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &repos_uuid, scratch_pool));
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url, scratch_pool));
+ SVN_ERR(svn_ra_check_path(ra_session, "", ra_revnum, &ext_kind,
scratch_pool));
- if (svn_node_none == kind)
+ if (svn_node_none == ext_kind)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
_("URL '%s' at revision %ld doesn't exist"),
- ra_cache.ra_session_url,
- ra_cache.ra_revnum);
+ ra_session_url, ra_revnum);
- if (svn_node_dir != kind && svn_node_file != kind)
+ if (svn_node_dir != ext_kind && svn_node_file != ext_kind)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
_("URL '%s' at revision %ld is not a file "
"or a directory"),
- ra_cache.ra_session_url,
- ra_cache.ra_revnum);
+ ra_session_url, ra_revnum);
- ra_cache.kind = kind;
+ local_kind = ext_kind;
/* Not protecting against recursive externals. Detecting them in
@@ -682,7 +682,7 @@ handle_external_item_change(const struct
scratch_pool));
}
- switch (ra_cache.kind)
+ switch (local_kind)
{
case svn_node_dir:
SVN_ERR(switch_dir_external(local_abspath, new_url,
@@ -693,9 +693,9 @@ handle_external_item_change(const struct
scratch_pool));
break;
case svn_node_file:
- if (strcmp(eb->repos_root_url, ra_cache.repos_root_url))
+ if (strcmp(eb->repos_root_url, repos_root_url))
{
- const char *repos_uuid;
+ const char *old_repos_uuid;
const char *ext_repos_relpath;
/*
@@ -708,18 +708,18 @@ handle_external_item_change(const struct
*/
SVN_ERR(svn_client__ra_session_from_path(&ra_session,
- &ra_cache.ra_revnum,
- &ra_cache.ra_session_url,
+ &ra_revnum,
+ &ra_session_url,
eb->repos_root_url,
NULL,
&(new_item->peg_revision),
&(new_item->revision),
eb->ctx, scratch_pool));
- SVN_ERR(svn_ra_get_uuid2(ra_session, &repos_uuid,
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &old_repos_uuid,
scratch_pool));
- ext_repos_relpath = svn_uri_skip_ancestor(ra_cache.repos_root_url,
+ ext_repos_relpath = svn_uri_skip_ancestor(repos_root_url,
new_url, scratch_pool);
- if (strcmp(repos_uuid, ra_cache.repos_uuid) != 0 ||
+ if (strcmp(old_repos_uuid, repos_uuid) != 0 ||
ext_repos_relpath == NULL)
return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
_("Unsupported external: url of file external '%s' "
@@ -727,9 +727,9 @@ handle_external_item_change(const struct
new_url, eb->repos_root_url);
SVN_ERR(svn_ra_get_repos_root2(ra_session,
- &ra_cache.repos_root_url,
+ &repos_root_url,
scratch_pool));
- new_url = svn_path_url_add_component2(ra_cache.repos_root_url,
+ new_url = svn_path_url_add_component2(repos_root_url,
ext_repos_relpath,
scratch_pool);
SVN_ERR(svn_ra_reparent(ra_session, new_url, scratch_pool));
@@ -742,9 +742,9 @@ handle_external_item_change(const struct
&new_item->revision,
parent_dir_abspath,
ra_session,
- ra_cache.ra_session_url,
- ra_cache.ra_revnum,
- ra_cache.repos_root_url,
+ ra_session_url,
+ ra_revnum,
+ repos_root_url,
eb->timestamp_sleep, eb->ctx,
scratch_pool));
break;