Author: rhuijben Date: Mon May 9 15:43:56 2011 New Revision: 1101071 URL: http://svn.apache.org/viewvc?rev=1101071&view=rev Log: Prepare some things for a future version 29 format bump and at the same time document some of my ideas.
* subversion/libsvn_wc/upgrade.c (bump_to_29): New function. Malfunctioning just to be sure. (svn_wc__upgrade_sdb): Call bump_to_29 when the format is bumped. * subversion/libsvn_wc/wc-metadata.sql (STMT_CREATE_EXTERNALS): Add new statement (untested). (STMT_UPGRADE_TO_29): Update documentation. * subversion/libsvn_wc/wc_db.c (create_db): Execute STMT_CREATE_EXTERNALS once the format is bumped. Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c subversion/trunk/subversion/libsvn_wc/wc-metadata.sql subversion/trunk/subversion/libsvn_wc/wc_db.c Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1101071&r1=1101070&r2=1101071&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/upgrade.c (original) +++ subversion/trunk/subversion/libsvn_wc/upgrade.c Mon May 9 15:43:56 2011 @@ -1213,6 +1213,19 @@ bump_to_28(void *baton, svn_sqlite__db_t return SVN_NO_ERROR; } +static svn_error_t * +bump_to_29(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool) +{ + SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_CREATE_EXTERNALS)); + SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_29)); + + /* ### Before enabling this code we should be able to upgrade existing + ### file externals to their new location */ + SVN_ERR_MALFUNCTION(); + return SVN_NO_ERROR; +} + + struct upgrade_data_t { svn_sqlite__db_t *sdb; const char *root_abspath; @@ -1498,6 +1511,14 @@ svn_wc__upgrade_sdb(int *result_format, *result_format = 28; /* FALLTHROUGH */ +#if SVN_WC__VERSION >= SVN_WC__HAS_EXTERNALS_STORE + case 28: + SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_29, &bb, + scratch_pool)); + *result_format = 29; + /* FALLTHROUGH */ +#endif + /* ### future bumps go here. */ #if 0 case XXX-1: Modified: subversion/trunk/subversion/libsvn_wc/wc-metadata.sql URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-metadata.sql?rev=1101071&r1=1101070&r2=1101071&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc-metadata.sql (original) +++ subversion/trunk/subversion/libsvn_wc/wc-metadata.sql Mon May 9 15:43:56 2011 @@ -530,7 +530,64 @@ BEGIN WHERE checksum = OLD.checksum; END; +-- STMT_CREATE_EXTERNALS +CREATE TABLE EXTERNALS ( + /* Working copy location related fields (like NODES)*/ + + wc_id INTEGER NOT NULL REFERENCES WCROOT (id), + local_relpath TEXT NOT NULL, + + /* The working copy root can't be recorded as an external in itself + so this will never be NULL. */ + parent_relpath TEXT NOT NULL, + + /* Repository location fields */ + + /* Always set for file and symlink externals. NULL for directory externals */ + repos_id INTEGER REFERENCES REPOSITORY (id), + repos_path TEXT, + revision INTEGER, + + /* Content fields */ + + /* the kind of the external. */ + kind TEXT NOT NULL, + + /* Variouse information (NULL for directories; see NODES for explanation) */ + properties BLOB, + checksum TEXT REFERENCES PRISTINE (checksum), + symlink_target TEXT, + + /* Last-Change fields (NULL for directories; see NODES for explanation) */ + changed_revision INTEGER, + changed_date INTEGER, + changed_author TEXT, + + /* Various cache fields (NULL for directories; see NODES for explanation) */ + translated_size INTEGER, + last_mod_time INTEGER, + dav_cache BLOB, + + + /* The local relpath of the directory NODE defining this external + (Defaults to the parent directory of the file external after upgrade) */ + record_relpath TEXT NOT NULL, + + /* The url of the external as used in the definition */ + recorded_url TEXT NOT NULL, + + /* The operational (peg) and node revision if this is a revision fixed + external; otherwise NULL. (Usually these will both have the same value) */ + recorded_operational_revision TEXT NOT NULL, + recorded_revision TEXT NOT NULL, + + PRIMARY KEY (wc_id, local_relpath) +); + +CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath); +CREATE UNIQUE INDEX I_EXTERNALS_RECORDED ON EXTERNALS (wc_id, record_relpath, + local_relpath); /* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */ @@ -664,7 +721,8 @@ PRAGMA user_version = 28; /* ------------------------------------------------------------------------- */ -/* Format 29 introduces ... */ +/* Format 29 introduces the EXTERNALS table (See STMT_CREATE_TRIGGERS) and + optimizes a trigger definition. ... */ -- STMT_UPGRADE_TO_29 Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1101071&r1=1101070&r2=1101071&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon May 9 15:43:56 2011 @@ -1364,6 +1364,9 @@ create_db(svn_sqlite__db_t **sdb, SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_SCHEMA)); SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES)); SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES_TRIGGERS)); +#if SVN_WC__VERSION >= SVN_WC__HAS_EXTERNALS_STORE + SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_EXTERNALS)); +#endif /* Insert the repository. */ SVN_ERR(create_repos_id(repos_id, repos_root_url, repos_uuid, *sdb,