You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/05/12 20:13:11 UTC
svn commit: r943606 - in /subversion/trunk/subversion: include/svn_wc.h
libsvn_client/cleanup.c libsvn_wc/upgrade.c
Author: gstein
Date: Wed May 12 18:13:10 2010
New Revision: 943606
URL: http://svn.apache.org/viewvc?rev=943606&view=rev
Log:
Fix pool parameter order on svn_wc_upgrade_get_repos_info_t. Some minor
renames and clarifications.
* subversion/include/svn_wc.h:
(svn_wc_upgrade_get_repos_info_t): swap RESULT/SCRATCH_POOL order.
* subversion/libsvn_client/cleanup.c:
(struct repos_info_baton): rename POOL to STATE_POOL
(fetch_repos_info): swap RESULT/SCRATCH_POOL order. track STATE_POOL
rename for the LAST_* allocations.
(svn_client_upgrade): track STATE_POOL rename
* subversion/libsvn_wc/upgrade.c:
(fetch_missing_entry_data): renamed to ...
(ensure_repos_info): ... this. we only want to ensure the repos info is
present, rather than "missing entry data". update docstring. toss out
localvars, and just fetch right into the entry. use == NULL for
clarity. swap pool order on the callback.
(upgrade_to_wcng): track function rename
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/cleanup.c
subversion/trunk/subversion/libsvn_wc/upgrade.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=943606&r1=943605&r2=943606&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed May 12 18:13:10 2010
@@ -6727,8 +6727,9 @@ typedef svn_error_t * (*svn_wc_upgrade_g
const char **repos_uuid,
void *baton,
const char *url,
- apr_pool_t *scratch_pool,
- apr_pool_t *result_pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/**
* Upgrade the working copy at @a local_abspath to the latest metadata
@@ -6759,7 +6760,8 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
- apr_pool_t *pool);
+ apr_pool_t *scratch_pool);
+
/** Relocation validation callback typedef.
*
Modified: subversion/trunk/subversion/libsvn_client/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cleanup.c?rev=943606&r1=943605&r2=943606&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cleanup.c (original)
+++ subversion/trunk/subversion/libsvn_client/cleanup.c Wed May 12 18:13:10 2010
@@ -62,7 +62,7 @@ svn_client_cleanup(const char *path,
/* callback baton for fetch_repos_info */
struct repos_info_baton
{
- apr_pool_t *pool;
+ apr_pool_t *state_pool;
svn_client_ctx_t *ctx;
const char *last_repos;
const char *last_uuid;
@@ -75,8 +75,8 @@ fetch_repos_info(const char **repos_root
const char **repos_uuid,
void *baton,
const char *url,
- apr_pool_t *scratch_pool,
- apr_pool_t *result_pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
struct repos_info_baton *ri = baton;
apr_pool_t *subpool;
@@ -98,8 +98,8 @@ fetch_repos_info(const char **repos_root
SVN_ERR(svn_ra_get_uuid2(ra_session, repos_uuid, result_pool));
/* Store data for further calls */
- ri->last_repos = apr_pstrdup(ri->pool, *repos_root);
- ri->last_uuid = apr_pstrdup(ri->pool, *repos_uuid);
+ ri->last_repos = apr_pstrdup(ri->state_pool, *repos_root);
+ ri->last_uuid = apr_pstrdup(ri->state_pool, *repos_uuid);
svn_pool_destroy(subpool);
@@ -117,7 +117,8 @@ svn_client_upgrade(const char *path,
apr_pool_t *iterpool;
svn_opt_revision_t rev = {svn_opt_revision_unspecified, {0}};
struct repos_info_baton info_baton;
- info_baton.pool = scratch_pool;
+
+ info_baton.state_pool = scratch_pool;
info_baton.ctx = ctx;
info_baton.last_repos = NULL;
info_baton.last_uuid = NULL;
Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=943606&r1=943605&r2=943606&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Wed May 12 18:13:10 2010
@@ -383,52 +383,51 @@ wipe_wcprops(const char *wcroot_abspath,
TRUE, scratch_pool));
}
-/* Checks ENTRY to see if it misses critical information. Attempts to
- retrieve this information from REPOS_INFO_FUNC, passing REPOS_INFO_BATON.
- Returns a user understandable error using LOCAL_ABSPATH if vital
- information would not be available after this function returns */
-static svn_error_t *
-fetch_missing_entry_data(svn_wc_entry_t *entry,
- const char *local_abspath,
- svn_wc_upgrade_get_repos_info_t repos_info_func,
- void *repos_info_baton,
- apr_pool_t *scratch_pool,
- apr_pool_t *result_pool)
-{
- const char *repos_root;
- const char *repos_uuid;
- if (entry->repos && entry->uuid)
- return SVN_NO_ERROR; /* We are done here */
- if (!entry->repos && !repos_info_func)
+/* Ensure that ENTRY has its REPOS and UUID fields set. These will be
+ used to establish the REPOSITORY row in the new database, and then
+ used within the upgraded entries as they are written into the database.
+
+ If one or both are not available, then it attempts to retrieve this
+ information from REPOS_INFO_FUNC, passing REPOS_INFO_BATON.
+ Returns a user understandable error using LOCAL_ABSPATH if the
+ information cannot be obtained. */
+static svn_error_t *
+ensure_repos_info(svn_wc_entry_t *entry,
+ const char *local_abspath,
+ svn_wc_upgrade_get_repos_info_t repos_info_func,
+ void *repos_info_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ /* Easy exit. */
+ if (entry->repos != NULL && entry->uuid != NULL)
+ return SVN_NO_ERROR;
+
+ if (entry->repos == NULL && repos_info_func == NULL)
return svn_error_createf(
SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
_("Working copy '%s' can't be upgraded because the repository root is "
"not available and can't be retrieved"),
svn_dirent_local_style(local_abspath, scratch_pool));
- if (!entry->uuid && !repos_info_func)
+ if (entry->uuid == NULL && repos_info_func == NULL)
return svn_error_createf(
SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
_("Working copy '%s' can't be upgraded because the repository uuid is "
"not available and can't be retrieved"),
svn_dirent_local_style(local_abspath, scratch_pool));
- if (!entry->url)
+ if (entry->url == NULL)
return svn_error_createf(
SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
_("Working copy '%s' can't be upgraded because it doesn't have a url"),
svn_dirent_local_style(local_abspath, scratch_pool));
- SVN_ERR(repos_info_func(&repos_root, &repos_uuid, repos_info_baton,
- entry->url, scratch_pool, result_pool));
-
- if (!entry->repos)
- entry->repos = repos_root;
- if (!entry->uuid)
- entry->uuid = repos_uuid;
-
- return SVN_NO_ERROR;
+ return svn_error_return((*repos_info_func)(&entry->repos, &entry->uuid,
+ repos_info_baton,
+ entry->url,
+ result_pool, scratch_pool));
}
@@ -489,10 +488,9 @@ upgrade_to_wcng(svn_wc__db_t *db,
scratch_pool, scratch_pool));
this_dir = apr_hash_get(entries, SVN_WC_ENTRY_THIS_DIR, APR_HASH_KEY_STRING);
-
- SVN_ERR(fetch_missing_entry_data(this_dir, dir_abspath,
- repos_info_func, repos_info_baton,
- scratch_pool, apr_hash_pool_get(entries)));
+ SVN_ERR(ensure_repos_info(this_dir, dir_abspath,
+ repos_info_func, repos_info_baton,
+ scratch_pool, scratch_pool));
/* Create an empty sqlite database for this directory. */
SVN_ERR(svn_wc__db_upgrade_begin(&sdb, &repos_id, &wc_id, dir_abspath,