Oh! Those two status values *imply* that a row in the WORKING_NODE
table is present.
Maybe add a comment to that effect?
In any case: great change. The removal of that reading code is xlnt.
On Tue, Mar 24, 2009 at 00:18, Greg Stein <gstein_at_gmail.com> wrote:
> Is this going to work the same? The step_row is going to throw an
> error if a row is not present, right?
>
> On Mon, Mar 23, 2009 at 20:57, Hyrum K. Wright <hyrum_at_hyrumwright.org> wrote:
>> Author: hwright
>> Date: Mon Mar 23 12:57:33 2009
>> New Revision: 36748
>>
>> Log:
>> Don't fetch all the working nodes inside of entries.c, instead, fetch the
>> keep_local flag on demand.
>>
>> * subversion/libsvn_wc/entries.c
>> Â (statement_keys, statements): Remove a statement, and add a statement.
>> Â (fetch_working_nodes): Remove.
>> Â (determine_keep_local): New.
>> Â (read_entries): Don't fetch all the working nodes, but call
>> Â Â determine_keep_local() as required.
>>
>> Modified:
>> Â trunk/subversion/libsvn_wc/entries.c
>>
>> Modified: trunk/subversion/libsvn_wc/entries.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=36748&r1=36747&r2=36748
>> ==============================================================================
>> --- trunk/subversion/libsvn_wc/entries.c     Mon Mar 23 12:24:54 2009     (r36747)
>> +++ trunk/subversion/libsvn_wc/entries.c     Mon Mar 23 12:57:33 2009     (r36748)
>> @@ -65,13 +65,13 @@ enum statement_keys {
>> Â STMT_INSERT_ACTUAL_NODE,
>> Â STMT_SELECT_REPOSITORY,
>> Â STMT_SELECT_WCROOT_NULL,
>> - Â STMT_SELECT_WORKING_NODE,
>> Â STMT_SELECT_ACTUAL_NODE,
>> Â STMT_DELETE_ALL_WORKING,
>> Â STMT_DELETE_ALL_BASE,
>> Â STMT_DELETE_ALL_ACTUAL,
>> Â STMT_DELETE_ALL_LOCK,
>> Â STMT_SELECT_INCOMPLETE_FLAG,
>> + Â STMT_SELECT_KEEP_LOCAL_FLAG,
>> Â STMT_SELECT_NOT_PRESENT,
>> Â STMT_SELECT_FILE_EXTERNAL,
>> Â STMT_UPDATE_FILE_EXTERNAL
>> @@ -112,13 +112,6 @@ static const char * const statements[] =
>>
>> Â "select id from wcroot where local_abspath is null;",
>>
>> - Â "select wc_id, local_relpath, parent_relpath, presence, kind, "
>> - Â Â "copyfrom_repos_id, "
>> - Â Â "copyfrom_repos_path, copyfrom_revnum, moved_here, moved_to, checksum, "
>> - Â Â "translated_size, changed_rev, changed_date, changed_author, depth, "
>> - Â Â "last_mod_time, properties, keep_local "
>> - Â "from working_node;",
>> -
>> Â "select wc_id, local_relpath, parent_relpath, properties, conflict_old, "
>> Â Â Â "conflict_new, "
>> Â Â Â "conflict_working, prop_reject, changelist, text_mod, "
>> @@ -136,6 +129,9 @@ static const char * const statements[] =
>> Â "select incomplete_children from base_node "
>> Â "where wc_id = ?1 and local_relpath = ?2;",
>>
>> + Â "select keep_local from working_node "
>> + Â "where wc_id = ?1 and local_relpath = ?2;",
>> +
>> Â "select 1 from base_node "
>> Â "where wc_id = ?1 and local_relpath = ?2 and presence = 'not-present';",
>>
>> @@ -678,96 +674,6 @@ take_from_entry(const svn_wc_entry_t *sr
>> Â }
>>
>>
>> -/* Select all the rows from working_node table in WC_DB and put them into
>> - Â *NODES allocated in RESULT_POOL. */
>> -static svn_error_t *
>> -fetch_working_nodes(apr_hash_t **nodes,
>> - Â Â Â Â Â Â Â Â Â Â svn_sqlite__db_t *wc_db,
>> - Â Â Â Â Â Â Â Â Â Â apr_pool_t *result_pool,
>> - Â Â Â Â Â Â Â Â Â Â apr_pool_t *scratch_pool)
>> -{
>> - Â svn_sqlite__stmt_t *stmt;
>> - Â svn_boolean_t have_row;
>> -
>> - Â *nodes = apr_hash_make(result_pool);
>> -
>> - Â SVN_ERR(svn_sqlite__get_statement(&stmt, wc_db, STMT_SELECT_WORKING_NODE));
>> - Â SVN_ERR(svn_sqlite__step(&have_row, stmt));
>> - Â while (have_row)
>> - Â Â {
>> - Â Â Â apr_size_t len;
>> - Â Â Â const void *val;
>> - Â Â Â db_working_node_t *working_node = apr_pcalloc(result_pool,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sizeof(*working_node));
>> - Â Â Â const char *presence;
>> -
>> - Â Â Â working_node->wc_id = svn_sqlite__column_int(stmt, 0);
>> - Â Â Â working_node->local_relpath = svn_sqlite__column_text(stmt, 1,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result_pool);
>> - Â Â Â working_node->parent_relpath = svn_sqlite__column_text(stmt, 2,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result_pool);
>> -
>> - Â Â Â /* ### only bother with a couple values for now */
>> - Â Â Â presence = svn_sqlite__column_text(stmt, 3, NULL);
>> - Â Â Â if (strcmp(presence, "not-present") == 0)
>> - Â Â Â Â working_node->presence = svn_wc__db_status_not_present;
>> - Â Â Â else
>> - Â Â Â Â working_node->presence = svn_wc__db_status_normal;
>> -
>> - Â Â Â working_node->kind = svn_node_kind_from_word(
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â svn_sqlite__column_text(stmt, 4, NULL));
>> -
>> - Â Â Â if (!svn_sqlite__column_is_null(stmt, 5))
>> - Â Â Â Â {
>> - Â Â Â Â Â working_node->copyfrom_repos_id = svn_sqlite__column_int(stmt, 5);
>> - Â Â Â Â Â working_node->copyfrom_repos_path = svn_sqlite__column_text(stmt, 6,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result_pool);
>> - Â Â Â Â Â working_node->copyfrom_revnum = svn_sqlite__column_revnum(stmt, 7);
>> - Â Â Â Â }
>> -
>> - Â Â Â if (!svn_sqlite__column_is_null(stmt, 8))
>> - Â Â Â Â working_node->moved_here = svn_sqlite__column_boolean(stmt, 8);
>> -
>> - Â Â Â if (!svn_sqlite__column_is_null(stmt, 9))
>> - Â Â Â Â working_node->moved_to = svn_sqlite__column_text(stmt, 9, result_pool);
>> -
>> - Â Â Â if (!svn_sqlite__column_is_null(stmt, 10))
>> - Â Â Â Â {
>> - Â Â Â Â Â const char *digest = svn_sqlite__column_text(stmt, 10, NULL);
>> - Â Â Â Â Â svn_checksum_kind_t kind = (digest[1] == 'm'
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ? svn_checksum_md5 : svn_checksum_sha1);
>> - Â Â Â Â Â SVN_ERR(svn_checksum_parse_hex(&working_node->checksum, kind,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â digest + 6, result_pool));
>> - Â Â Â Â Â working_node->translated_size = svn_sqlite__column_int(stmt, 11);
>> - Â Â Â Â }
>> -
>> - Â Â Â if (!svn_sqlite__column_is_null(stmt, 12))
>> - Â Â Â Â {
>> - Â Â Â Â Â working_node->changed_rev = svn_sqlite__column_revnum(stmt, 12);
>> - Â Â Â Â Â working_node->changed_date = svn_sqlite__column_int(stmt, 13);
>> - Â Â Â Â Â working_node->changed_author = svn_sqlite__column_text(stmt, 14,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result_pool);
>> - Â Â Â Â }
>> -
>> - Â Â Â working_node->depth = svn_depth_from_word(
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â svn_sqlite__column_text(stmt, 15, NULL));
>> - Â Â Â working_node->last_mod_time = svn_sqlite__column_int(stmt, 16);
>> -
>> - Â Â Â val = svn_sqlite__column_blob(stmt, 17, &len);
>> - Â Â Â SVN_ERR(svn_skel__parse_proplist(&working_node->properties,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â svn_skel__parse(val, len, scratch_pool),
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â result_pool));
>> -
>> - Â Â Â working_node->keep_local = svn_sqlite__column_boolean(stmt, 18);
>> -
>> - Â Â Â apr_hash_set(*nodes, working_node->local_relpath, APR_HASH_KEY_STRING,
>> - Â Â Â Â Â Â Â Â Â working_node);
>> - Â Â Â SVN_ERR(svn_sqlite__step(&have_row, stmt));
>> - Â Â }
>> -
>> - Â return SVN_NO_ERROR;
>> -}
>> -
>> Â /* Select all the rows from actual_node table in WC_DB and put them into
>> Â Â *NODES allocated in RESULT_POOL. */
>> Â static svn_error_t *
>> @@ -854,6 +760,24 @@ fetch_wc_id(apr_int64_t *wc_id, svn_sqli
>>
>>
>> Â static svn_error_t *
>> +determine_keep_local(svn_boolean_t *keep_local,
>> + Â Â Â Â Â Â Â Â Â Â svn_sqlite__db_t *sdb,
>> + Â Â Â Â Â Â Â Â Â Â apr_int64_t wc_id,
>> + Â Â Â Â Â Â Â Â Â Â const char *local_relpath)
>> +{
>> + Â svn_sqlite__stmt_t *stmt;
>> +
>> + Â SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_KEEP_LOCAL_FLAG));
>> + Â SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
>> + Â SVN_ERR(svn_sqlite__step_row(stmt));
>> +
>> + Â *keep_local = svn_sqlite__column_boolean(stmt, 0);
>> +
>> + Â return svn_sqlite__reset(stmt);
>> +}
>> +
>> +
>> +static svn_error_t *
>> Â determine_incomplete(svn_boolean_t *incomplete,
>> Â Â Â Â Â Â Â Â Â Â Â svn_sqlite__db_t *sdb,
>> Â Â Â Â Â Â Â Â Â Â Â apr_int64_t wc_id,
>> @@ -884,7 +808,6 @@ static svn_error_t *
>> Â read_entries(svn_wc_adm_access_t *adm_access,
>> Â Â Â Â Â Â Â apr_pool_t *scratch_pool)
>> Â {
>> - Â apr_hash_t *working_nodes;
>> Â apr_hash_t *actual_nodes;
>> Â svn_sqlite__db_t *wc_db;
>> Â apr_pool_t *result_pool;
>> @@ -916,8 +839,6 @@ read_entries(svn_wc_adm_access_t *adm_ac
>>
>> Â /* ### some of the data is not in the wc_db interface. grab it manually.
>> Â Â Â ### trim back the columns fetched? Â */
>> - Â SVN_ERR(fetch_working_nodes(&working_nodes, wc_db, scratch_pool,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â scratch_pool));
>> Â SVN_ERR(fetch_actual_nodes(&actual_nodes, wc_db, scratch_pool, scratch_pool));
>>
>> Â SVN_ERR(svn_dirent_get_absolute(&local_abspath,
>> @@ -1036,16 +957,12 @@ read_entries(svn_wc_adm_access_t *adm_ac
>> Â Â Â else if (status == svn_wc__db_status_deleted
>> Â Â Â Â Â Â Â Â || status == svn_wc__db_status_obstructed_delete)
>> Â Â Â Â {
>> - Â Â Â Â Â const db_working_node_t *working_node;
>> -
>> Â Â Â Â Â /* ### we don't have to worry about moves, so this is a delete. */
>> Â Â Â Â Â entry->schedule = svn_wc_schedule_delete;
>>
>> - Â Â Â Â Â /* ### keep_local */
>> - Â Â Â Â Â working_node = apr_hash_get(working_nodes,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â entry->name, APR_HASH_KEY_STRING);
>> - Â Â Â Â Â if (working_node && working_node->keep_local)
>> - Â Â Â Â Â Â entry->keep_local = TRUE;
>> + Â Â Â Â Â /* ### keep_local (same hack as determine_incomplete) */
>> + Â Â Â Â Â SVN_ERR(determine_keep_local(&entry->keep_local, wc_db,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 1 /* wc_id */, entry->name));
>> Â Â Â Â }
>> Â Â Â else if (status == svn_wc__db_status_added
>> Â Â Â Â Â Â Â Â || status == svn_wc__db_status_obstructed_add)
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1392190
>>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1394253
Received on 2009-03-24 00:21:03 CET