You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/06/14 02:22:50 UTC
svn commit: r954333 - in /subversion/trunk/subversion/libsvn_wc:
update_editor.c wc-queries.sql wc_db.c wc_db.h
Author: rhuijben
Date: Mon Jun 14 00:22:50 2010
New Revision: 954333
URL: http://svn.apache.org/viewvc?rev=954333&view=rev
Log:
Remove another entry write invocation and replace it with a custom db
operation.
* subversion/libsvn_wc/update_editor.c
(add_directory): Use db functions to fix node and stub.
* subversion/libsvn_wc/wc-queries.sql
(STMT_INSERT_BASE_NODE_INCOMPLETE_DIR): New statement.
* subversion/libsvn_wc/wc_db.c
(insert_base_node): Use svn_relpath_join()
(set_new_dir_to_incomplete_baton): New struct.
(set_new_dir_to_incomplete_baton_txn): New function.
(svn_wc__db_temp_op_set_new_dir_to_incomplete): New function.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_temp_op_set_new_dir_to_incomplete): New function.
Modified:
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=954333&r1=954332&r2=954333&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Jun 14 00:22:50 2010
@@ -2593,26 +2593,24 @@ add_directory(const char *path,
/* Immediately tweak the schedule for "this dir" so it too
is no longer scheduled for addition. Change rev from 0
to the target revision allowing prep_directory() to do
- its thing without error. */
- svn_wc_entry_t tmp_entry;
- int modify_flags = (SVN_WC__ENTRY_MODIFY_SCHEDULE
- | SVN_WC__ENTRY_MODIFY_FORCE
- | SVN_WC__ENTRY_MODIFY_REVISION);
+ its thing without error.
- tmp_entry.schedule = svn_wc_schedule_normal;
- tmp_entry.revision = *(eb->target_revision);
-
- if (eb->switch_relpath)
- {
- tmp_entry.url = svn_path_url_add_component2(eb->repos_root,
- db->new_relpath,
- pool);
- modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
- }
+ ### In the future this should probably become a proper
+ ### tree conflict and just handled by putting a base
+ ### directory below the existing working node.
+ */
+ SVN_ERR(svn_wc__db_temp_op_set_new_dir_to_incomplete(
+ eb->db,
+ db->local_abspath,
+ db->new_relpath,
+ eb->repos_root,
+ eb->repos_uuid,
+ *eb->target_revision,
+ pool));
- SVN_ERR(svn_wc__entry_modify(eb->db, db->local_abspath,
- svn_node_dir,
- &tmp_entry, modify_flags, pool));
+ SVN_ERR(svn_wc__db_temp_set_parent_stub_to_normal(eb->db,
+ db->local_abspath,
+ TRUE, pool));
}
}
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=954333&r1=954332&r2=954333&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon Jun 14 00:22:50 2010
@@ -82,6 +82,12 @@ insert or ignore into base_node (
wc_id, local_relpath, parent_relpath, presence, kind, revnum)
values (?1, ?2, ?3, 'incomplete', 'unknown', ?4);
+-- STMT_INSERT_BASE_NODE_INCOMPLETE_DIR
+insert or ignore into base_node (
+ wc_id, local_relpath, repos_id, repos_relpath, parent_relpath, presence,
+ kind, revnum)
+values (?1, ?2, ?3, ?4, ?5, 'incomplete', 'dir', ?6);
+
-- STMT_INSERT_WORKING_NODE_INCOMPLETE
INSERT OR IGNORE INTO WORKING_NODE (
wc_id, local_relpath, parent_relpath, presence, kind)
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=954333&r1=954332&r2=954333&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Jun 14 00:22:50 2010
@@ -672,9 +672,9 @@ insert_base_node(void *baton, svn_sqlite
SVN_ERR(svn_sqlite__bindf(stmt, "issi",
pibb->wc_id,
- svn_dirent_join(pibb->local_relpath,
- name,
- scratch_pool),
+ svn_relpath_join(pibb->local_relpath,
+ name,
+ scratch_pool),
pibb->local_relpath,
(apr_int64_t)pibb->revision));
SVN_ERR(svn_sqlite__insert(NULL, stmt));
@@ -8475,3 +8475,103 @@ svn_wc__db_temp_op_set_rev_and_repos_rel
return SVN_NO_ERROR;
}
+
+struct set_new_dir_to_incomplete_baton
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ const char *repos_relpath;
+ const char *repos_root_url;
+ const char *repos_uuid;
+ svn_revnum_t revision;
+};
+
+static svn_error_t *
+set_new_dir_to_incomplete_baton_txn(void *baton,
+ svn_sqlite__db_t *sdb,
+ apr_pool_t *scratch_pool)
+{
+ struct set_new_dir_to_incomplete_baton *dtb = baton;
+ svn_sqlite__stmt_t *stmt;
+ apr_int64_t repos_id;
+ const char *parent_relpath = (*dtb->local_relpath == '\0')
+ ? NULL
+ : svn_relpath_dirname(dtb->local_relpath,
+ scratch_pool);
+
+ SVN_ERR(create_repos_id(&repos_id, dtb->repos_root_url, dtb->repos_uuid,
+ sdb, scratch_pool));
+
+ /* Delete the working node */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
+ STMT_DELETE_WORKING_NODE));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", dtb->pdh->wcroot->wc_id,
+ dtb->local_relpath));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ /* Delete the base node if there is a not present one */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
+ STMT_DELETE_BASE_NODE));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", dtb->pdh->wcroot->wc_id,
+ dtb->local_relpath));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+
+ /* Insert the incomplete base node */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
+ STMT_INSERT_BASE_NODE_INCOMPLETE_DIR));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "isissi", dtb->pdh->wcroot->wc_id,
+ dtb->local_relpath,
+ repos_id,
+ dtb->repos_relpath,
+ parent_relpath,
+ (apr_int64_t)dtb->revision));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__db_temp_op_set_new_dir_to_incomplete(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ apr_pool_t *scratch_pool)
+{
+ struct set_new_dir_to_incomplete_baton baton;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
+ SVN_ERR_ASSERT(repos_relpath && repos_root_url && repos_uuid);
+
+ baton.repos_relpath = repos_relpath;
+ baton.repos_root_url = repos_root_url;
+ baton.repos_uuid = repos_uuid;
+ baton.revision = revision;
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&baton.pdh, &baton.local_relpath,
+ db, local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+
+ VERIFY_USABLE_PDH(baton.pdh);
+
+ flush_entries(baton.pdh);
+
+ SVN_DBG(("Performing on %s\n", local_abspath));
+
+ SVN_ERR(svn_sqlite__with_transaction(baton.pdh->wcroot->sdb,
+ set_new_dir_to_incomplete_baton_txn,
+ &baton, scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=954333&r1=954332&r2=954333&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Jun 14 00:22:50 2010
@@ -2456,7 +2456,24 @@ svn_wc__db_temp_op_set_rev_and_repos_rel
svn_boolean_t update_stub,
apr_pool_t *scratch_pool);
-
+/* Tweak a locally added existing directory LOCAL_ABSPATH to have a base
+ node with incomplete status and revision REVISION instead. If
+ REPOS_RELPATH is not NULL, apply REPOS_RELPATH, REPOS_ROOT_URL and
+ REPOS_UUID.
+ Perform all temporary allocations in SCRATCH_POOL.
+
+ ### For 1.7 this should probably become a proper tree conflict and
+ ### just handled by putting a base directory below the existing
+ ### working node.
+ */
+svn_error_t *
+svn_wc__db_temp_op_set_new_dir_to_incomplete(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ apr_pool_t *scratch_pool);
/* @} */