I don't think the flag is permanent. So if you *do* keep it in there,
then add a bunch of markers to that effect.
When we add a directory, it will be "complete", but it will have
incomplete nodes for all of its children. Thus, the determination for
"incomplete" will be count(*) for parent_relpath=?1 where
presence='incomplete'.
Also: in your code below, the other uses of insert_base_baton_t do not
clear the new flag (each user initializes all fields). And the
"incomplete_children" is listed under absent nodes, when it is
actually a directory flag (for now).
Cheers,
-g
On Tue, Mar 24, 2009 at 22:16, Hyrum K. Wright
<hyrum_wright_at_mail.utexas.edu> wrote:
> A question about this, for those that care: Should the
> incomplete_children bit of the insert_base_baton, insert_base(), etc.
> be removed? Â If this happens, we could still set the flag, just not as
> part of wc_db.
>
> -Hyrum
>
> On Mar 24, 2009, at 4:09 PM, Hyrum K. Wright wrote:
>
>> Author: hwright
>> Date: Tue Mar 24 14:09:14 2009
>> New Revision: 36758
>>
>> Log:
>> Move the directory initialization code into wc_db.
>>
>> * subversion/libsvn_wc/entries.c
>> Â (statements, statement_keys): Remove a statement.
>> Â (svn_wc__entries_init): Largely gut, calling the wc_db API instead.
>>
>> * subversion/libsvn_wc/wc_db.c
>> Â (statement_keys, statements): New statement. Â Also, when inserting
>> the
>> Â Â base_node, also insert the incomplete children flag.
>> Â (insert_base_baton): Add incomplete_children flag.
>> Â (insert_base_node): Insert the incomplete children flag.
>> Â (svn_wc__db_init): New.
>>
>> * subversion/libsvn_wc/wc_db.h
>> Â (svn_wc__db_init): New.
>>
>> Modified:
>> Â trunk/subversion/libsvn_wc/entries.c
>> Â trunk/subversion/libsvn_wc/wc_db.c
>> Â trunk/subversion/libsvn_wc/wc_db.h
>>
>> Modified: trunk/subversion/libsvn_wc/entries.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=36758&r1=36757&r2=36758
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- trunk/subversion/libsvn_wc/entries.c    Tue Mar 24 09:59:55 2009
>> (r36757)
>> +++ trunk/subversion/libsvn_wc/entries.c    Tue Mar 24 14:09:14 2009
>> (r36758)
>> @@ -59,7 +59,6 @@ static const char * const upgrade_sql[]
>> Â Â and removed at the same time. */
>> enum statement_keys {
>> Â STMT_INSERT_REPOSITORY,
>> - Â STMT_INSERT_WCROOT,
>> Â STMT_INSERT_BASE_NODE,
>> Â STMT_INSERT_WORKING_NODE,
>> Â STMT_INSERT_ACTUAL_NODE,
>> @@ -81,9 +80,6 @@ static const char * const statements[] =
>> Â "insert into repository (root, uuid) "
>> Â "values (?1, ?2);",
>>
>> - Â "insert into wcroot (local_abspath) "
>> - Â "values (?1);",
>> -
>> Â "insert or replace into base_node "
>> Â Â "(wc_id, local_relpath, repos_id, repos_relpath, parent_relpath, "
>> Â Â Â "presence, "
>> @@ -2935,77 +2931,31 @@ svn_error_t *
>> svn_wc__entries_init(const char *path,
>> Â Â Â Â Â Â Â Â Â Â Â const char *uuid,
>> Â Â Â Â Â Â Â Â Â Â Â const char *url,
>> - Â Â Â Â Â Â Â Â Â Â const char *repos,
>> + Â Â Â Â Â Â Â Â Â Â const char *repos_root,
>> Â Â Â Â Â Â Â Â Â Â Â svn_revnum_t initial_rev,
>> Â Â Â Â Â Â Â Â Â Â Â svn_depth_t depth,
>> Â Â Â Â Â Â Â Â Â Â Â apr_pool_t *pool)
>> {
>> - Â svn_sqlite__db_t *wc_db;
>> - Â svn_wc__db_t *db;
>> - Â svn_sqlite__stmt_t *stmt;
>> Â apr_pool_t *scratch_pool = svn_pool_create(pool);
>> - Â const char *wc_db_path = db_path(path, scratch_pool);
>> - Â apr_int64_t wc_id;
>> - Â apr_int64_t repos_id;
>> - Â svn_wc_entry_t *entry = alloc_entry(scratch_pool);
>> + Â const char *abspath;
>> + Â const char *repos_relpath;
>>
>> Â if (!should_create_next_gen())
>> - Â Â return svn_wc__entries_init_old(path, uuid, url, repos,
>> initial_rev,
>> + Â Â return svn_wc__entries_init_old(path, uuid, url, repos_root,
>> initial_rev,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â depth, pool);
>>
>> - Â SVN_ERR_ASSERT(! repos || svn_path_is_ancestor(repos, url));
>> + Â SVN_ERR_ASSERT(! repos_root || svn_path_is_ancestor(repos_root,
>> url));
>> Â SVN_ERR_ASSERT(depth == svn_depth_empty
>> Â Â Â Â Â Â Â Â Â || depth == svn_depth_files
>> Â Â Â Â Â Â Â Â Â || depth == svn_depth_immediates
>> Â Â Â Â Â Â Â Â Â || depth == svn_depth_infinity);
>>
>> - Â /* ### chicken and egg problem: we don't have an adm_access baton
>> to
>> - Â Â ### use to open the initial entries database, we we've got to
>> do it
>> - Â Â ### manually. */
>> - Â SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_readwrite, path,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, scratch_pool, scratch_pool));
>> -
>> - Â /* Open the sqlite database, and insert the REPOS and WCROOT.
>> - Â Â ### this is redundant, but we currently need it for the entry
>> - Â Â ### inserting API. Â DB and WC_DB should be pointing to the
>> *same*
>> - Â Â ### sqlite database, and it works fine thanks for sqlite's
>> - Â Â ### concurrency handling. Â However, this should eventually
>> disappear. */
>> - Â SVN_ERR(svn_sqlite__open(&wc_db, wc_db_path,
>> svn_sqlite__mode_rwcreate,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â statements,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â SVN_WC__VERSION_EXPERIMENTAL, upgrade_sql,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â scratch_pool, scratch_pool));
>> -
>> -#ifdef SVN_DEBUG
>> - Â {
>> - Â Â SVN_ERR(svn_sqlite__exec(wc_db, WC_CHECKS_SQL));
>> - Â }
>> -#endif
>> -
>> - Â /* Insert the repository. */
>> - Â SVN_ERR(svn_sqlite__get_statement(&stmt, wc_db,
>> STMT_INSERT_REPOSITORY));
>> - Â SVN_ERR(svn_sqlite__bindf(stmt, "ss", repos, uuid));
>> - Â SVN_ERR(svn_sqlite__insert(&repos_id, stmt));
>> -
>> - Â /* Insert the wcroot. */
>> - Â /* ### Right now, this just assumes wc metadata is being stored
>> locally. */
>> - Â SVN_ERR(svn_sqlite__get_statement(&stmt, wc_db,
>> STMT_INSERT_WCROOT));
>> - Â SVN_ERR(svn_sqlite__insert(&wc_id, stmt));
>> -
>> - Â /* Add an entry for the dir itself. Â The directory has no name. Â It
>> - Â Â might have a UUID, but otherwise only the revision and default
>> - Â Â ancestry are present, and possibly an 'incomplete' flag if the
>> revnum
>> - Â Â is > 0. */
>> - Â entry->kind = svn_node_dir;
>> - Â entry->url = url;
>> - Â entry->revision = initial_rev;
>> - Â entry->uuid = uuid;
>> - Â entry->repos = repos;
>> - Â entry->depth = depth;
>> - Â if (initial_rev > 0)
>> - Â Â entry->incomplete = TRUE;
>> -
>> - Â SVN_ERR(write_entry(db, wc_db, wc_id, repos_id, repos, entry,
>> - Â Â Â Â Â Â Â Â Â Â Â SVN_WC_ENTRY_THIS_DIR, path, entry,
>> scratch_pool));
>> + Â /* Initialize the db for this directory. */
>> + Â SVN_ERR(svn_dirent_get_absolute(&abspath, path, scratch_pool));
>> + Â repos_relpath = svn_uri_is_child(repos_root, url, scratch_pool);
>> + Â SVN_ERR(svn_wc__db_init(abspath, repos_relpath == NULL ? ""
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â : svn_path_uri_decode(repos_relpath,
>> scratch_pool),
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â repos_root, uuid, initial_rev, depth,
>> scratch_pool));
>>
>> Â svn_pool_destroy(scratch_pool);
>> Â return SVN_NO_ERROR;
>>
>> Modified: trunk/subversion/libsvn_wc/wc_db.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.c?pathrev=36758&r1=36757&r2=36758
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- trunk/subversion/libsvn_wc/wc_db.c     Tue Mar 24 09:59:55 2009
>> (r36757)
>> +++ trunk/subversion/libsvn_wc/wc_db.c     Tue Mar 24 14:09:14 2009
>> (r36758)
>> @@ -166,7 +166,8 @@ enum statement_keys {
>> Â STMT_UPDATE_ACTUAL_PROPS,
>> Â STMT_SELECT_ALL_PROPS,
>> Â STMT_SELECT_PRISTINE_PROPS,
>> - Â STMT_INSERT_LOCK
>> + Â STMT_INSERT_LOCK,
>> + Â STMT_INSERT_WCROOT
>> };
>>
>> static const char * const statements[] = {
>> @@ -209,9 +210,9 @@ static const char * const statements[] =
>> Â "insert or replace into base_node ("
>> Â " Â wc_id, local_relpath, repos_id, repos_relpath, parent_relpath,
>> presence, "
>> Â " Â kind, revnum, properties, changed_rev, changed_date,
>> changed_author, "
>> - Â " Â depth, checksum, translated_size, symlink_target) "
>> + Â " Â depth, checksum, translated_size, symlink_target,
>> incomplete_children) "
>> Â "values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?
>> 14, "
>> - Â " Â Â Â Â ?15, ?16);",
>> + Â " Â Â Â Â ?15, ?16, ?17);",
>>
>> Â "insert or ignore into base_node ("
>> Â " Â wc_id, local_relpath, parent_relpath, presence, kind, revnum) "
>> @@ -258,6 +259,9 @@ static const char * const statements[] =
>> Â Â " lock_date)"
>> Â "values (?1, ?2, ?3, ?4, ?5, ?6);",
>>
>> + Â "insert into wcroot (local_abspath) "
>> + Â "values (?1);",
>> +
>> Â NULL
>> };
>>
>> @@ -289,6 +293,7 @@ typedef struct {
>> Â const char *target;
>>
>> Â /* for inserting absent nodes */
>> + Â svn_boolean_t incomplete_children;
>>
>> Â /* for temporary allocations */
>> Â apr_pool_t *scratch_pool;
>> @@ -1102,6 +1107,8 @@ insert_base_node(void *baton, svn_sqlite
>> Â Â Â Â SVN_ERR(svn_sqlite__bind_text(stmt, 16, pibb->target));
>> Â Â }
>>
>> + Â SVN_ERR(svn_sqlite__bind_int64(stmt, 17, pibb-
>> >incomplete_children));
>> +
>> Â SVN_ERR(svn_sqlite__insert(NULL, stmt));
>>
>> Â if (pibb->kind == svn_wc__db_kind_dir && pibb->children)
>> @@ -1304,6 +1311,62 @@ svn_wc__db_close(svn_wc__db_t *db,
>>
>>
>> svn_error_t *
>> +svn_wc__db_init(const char *local_abspath,
>> + Â Â Â Â Â Â Â Â const char *repos_relpath,
>> + Â Â Â Â Â Â Â Â const char *repos_root_url,
>> + Â Â Â Â Â Â Â Â const char *repos_uuid,
>> + Â Â Â Â Â Â Â Â svn_revnum_t initial_rev,
>> + Â Â Â Â Â Â Â Â svn_depth_t depth,
>> + Â Â Â Â Â Â Â Â apr_pool_t *scratch_pool)
>> +{
>> + Â svn_sqlite__db_t *sdb;
>> + Â svn_sqlite__stmt_t *stmt;
>> + Â apr_int64_t repos_id;
>> + Â apr_int64_t wc_id;
>> + Â insert_base_baton_t ibb;
>> +
>> + Â SVN_ERR(svn_sqlite__open(&sdb,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â svn_wc__adm_child(local_abspath, "wc.db",
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â scratch_pool),
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â svn_sqlite__mode_rwcreate, statements,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â SVN_WC__VERSION_EXPERIMENTAL, upgrade_sql,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â scratch_pool, scratch_pool));
>> +
>> + Â /* Insert the repository. */
>> + Â SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid, sdb,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â scratch_pool));
>> +
>> + Â /* Insert the wcroot. */
>> + Â /* ### Right now, this just assumes wc metadata is being stored
>> locally. */
>> + Â SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_WCROOT));
>> + Â SVN_ERR(svn_sqlite__insert(&wc_id, stmt));
>> +
>> + Â ibb.status = svn_wc__db_status_normal;
>> + Â ibb.kind = svn_wc__db_kind_dir;
>> + Â ibb.wc_id = wc_id;
>> + Â ibb.local_relpath = "";
>> + Â ibb.repos_id = repos_id;
>> + Â ibb.repos_relpath = repos_relpath;
>> + Â ibb.revision = initial_rev;
>> +
>> + Â ibb.props = NULL;
>> + Â ibb.changed_rev = SVN_INVALID_REVNUM;
>> + Â ibb.changed_date = 0;
>> + Â ibb.changed_author = NULL;
>> +
>> + Â ibb.children = NULL;
>> + Â ibb.incomplete_children = TRUE;
>> + Â ibb.depth = depth;
>> +
>> + Â ibb.scratch_pool = scratch_pool;
>> +
>> + Â SVN_ERR(insert_base_node(&ibb, sdb));
>> +
>> + Â return svn_sqlite__close(sdb);
>> +}
>> +
>> +
>> +svn_error_t *
>> svn_wc__db_base_add_directory(svn_wc__db_t *db,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â const char *local_abspath,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â const char *repos_relpath,
>>
>> Modified: trunk/subversion/libsvn_wc/wc_db.h
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.h?pathrev=36758&r1=36757&r2=36758
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- trunk/subversion/libsvn_wc/wc_db.h     Tue Mar 24 09:59:55 2009
>> (r36757)
>> +++ trunk/subversion/libsvn_wc/wc_db.h     Tue Mar 24 14:09:14 2009
>> (r36758)
>> @@ -274,6 +274,21 @@ svn_error_t *
>> svn_wc__db_close(svn_wc__db_t *db,
>> Â Â Â Â Â Â Â Â Â apr_pool_t *scratch_pool);
>>
>> +
>> +/**
>> + * Initialize the DB for LOCAL_ABSPATH, which should be a working
>> copy path.
>> + * Use SCRATCH_POOL for temporary allocations.
>> + */
>> +svn_error_t *
>> +svn_wc__db_init(const char *local_abspath,
>> + Â Â Â Â Â Â Â Â const char *repos_relpath,
>> + Â Â Â Â Â Â Â Â const char *repos_root_url,
>> + Â Â Â Â Â Â Â Â const char *repos_uuid,
>> + Â Â Â Â Â Â Â Â svn_revnum_t initial_rev,
>> + Â Â Â Â Â Â Â Â svn_depth_t depth,
>> + Â Â Â Â Â Â Â Â apr_pool_t *scratch_pool);
>> +
>> +
>> /** @} */
>>
>> /**
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1406091
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1406129
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1415606
Received on 2009-03-25 14:49:20 CET