You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/06/29 12:28:58 UTC
svn commit: r958918 - in /subversion/trunk/subversion/libsvn_wc: upgrade.c
wc.h
Author: philip
Date: Tue Jun 29 10:28:58 2010
New Revision: 958918
URL: http://svn.apache.org/viewvc?rev=958918&view=rev
Log:
Switch the order of the text-base and in-db-props upgrades. At present both
upgrades are still disabled by default.
* subversion/libsvn_wc/wc.h
(SVN_WC__PROPS_IN_DB): Increase.
* subversion/libsvn_wc/upgrade.c
(struct bump_to_17_baton): Renamed to bump_to_18_baton.
(bump_to_17): Renamed to bump_to_18.
(migrate_text_bases): Allow pristine directory to exist, include
checksum in path.
(bump_to_18): Renamed to bump_to_17.
(svn_wc__upgrade_sdb): Swap cases 16 and 17.
Modified:
subversion/trunk/subversion/libsvn_wc/upgrade.c
subversion/trunk/subversion/libsvn_wc/wc.h
Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=958918&r1=958917&r2=958918&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Tue Jun 29 10:28:58 2010
@@ -1120,7 +1120,7 @@ migrate_props(const char *wcroot_abspath
/* */
-struct bump_to_17_baton
+struct bump_to_18_baton
{
const char *wcroot_abspath;
int original_format;
@@ -1128,16 +1128,16 @@ struct bump_to_17_baton
static svn_error_t *
-bump_to_17(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+bump_to_18(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
{
- struct bump_to_17_baton *b17 = baton;
+ struct bump_to_18_baton *b18 = baton;
#if 0
/* ### no schema changes (yet)... */
SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_17));
#endif
- SVN_ERR(migrate_props(b17->wcroot_abspath, sdb, b17->original_format,
+ SVN_ERR(migrate_props(b18->wcroot_abspath, sdb, b18->original_format,
scratch_pool));
return SVN_NO_ERROR;
@@ -1167,6 +1167,7 @@ migrate_text_bases(const char *wcroot_ab
svn_checksum_t *sha1_checksum;
svn_sqlite__stmt_t *stmt;
apr_finfo_t finfo;
+ const char *hex_digest;
svn_pool_clear(iterpool);
text_base_path = svn_dirent_join(text_base_dir, text_base_basename,
@@ -1198,16 +1199,21 @@ migrate_text_bases(const char *wcroot_ab
SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
SVN_ERR(svn_sqlite__insert(NULL, stmt));
- /* Compute the path of the pristine.
- Note: in format 18, pristines are not yet sharded, so don't include
- that in the path computation. */
+ /* ### Compute the path of the pristine. We should use some
+ standard function to do this, to handle sharding etc.
+ Will we need an svn_wc__db_t?
+
+ ### Should we be doing all this IO inside the transaction?
+ Why not use the workqueue? */
+ hex_digest = svn_checksum_to_cstring(sha1_checksum, iterpool);
pristine_path = svn_dirent_join_many(iterpool,
wcroot_abspath,
svn_wc_get_adm_dir(iterpool),
PRISTINE_STORAGE_RELPATH,
+ hex_digest,
NULL);
- /* Finally, copy the file over. */
+ /* Finally, copy the file over. ### Why not move? */
SVN_ERR(svn_io_copy_file(text_base_path, pristine_path, TRUE,
iterpool));
}
@@ -1219,7 +1225,7 @@ migrate_text_bases(const char *wcroot_ab
static svn_error_t *
-bump_to_18(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+bump_to_17(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
{
const char *wcroot_abspath = baton;
@@ -1317,33 +1323,35 @@ svn_wc__upgrade_sdb(int *result_format,
#if (SVN_WC__VERSION > 16)
case 16:
{
- struct bump_to_17_baton b17;
+ const char *pristine_dir;
- b17.wcroot_abspath = wcroot_abspath;
- b17.original_format = start_format;
+ /* Create the '.svn/pristine' directory. */
+ pristine_dir = svn_wc__adm_child(wcroot_abspath,
+ SVN_WC__ADM_PRISTINE,
+ scratch_pool);
+ SVN_ERR(svn_wc__ensure_directory(pristine_dir, scratch_pool));
- /* Move the properties into the database. */
- SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_17, &b17,
+ /* Move text bases into the pristine directory, and update the db */
+ SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_17, wcroot_abspath,
scratch_pool));
+
+ /* ### Remove old text-base directory? */
}
*result_format = 17;
/* FALLTHROUGH */
#endif
-#if 0
+#if (SVN_WC__VERSION > 17)
case 17:
{
- const char *pristine_dir;
+ struct bump_to_18_baton b18;
- /* Create the '.svn/pristine' directory. */
- pristine_dir = svn_wc__adm_child(wcroot_abspath,
- SVN_WC__ADM_PRISTINE,
- scratch_pool);
- SVN_ERR(svn_io_dir_make(pristine_dir, APR_OS_DEFAULT, scratch_pool));
+ b18.wcroot_abspath = wcroot_abspath;
+ b18.original_format = start_format;
- /* Move text bases into the pristine directory, and update the db */
- SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_18, wcroot_abspath,
+ /* Move the properties into the database. */
+ SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_18, &b18,
scratch_pool));
}
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=958918&r1=958917&r2=958918&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Jun 29 10:28:58 2010
@@ -157,7 +157,7 @@ extern "C" {
#define SVN_WC__USES_DAV_CACHE 13
/* A version < this does not store properties in wc.db. */
-#define SVN_WC__PROPS_IN_DB 17
+#define SVN_WC__PROPS_IN_DB 18
/* Return true iff error E indicates an "is not a working copy" type
of error, either because something wasn't a working copy at all, or