You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/09 20:29:33 UTC
svn commit: r932538 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
crop.c update_editor.c wc_db.c wc_db.h workqueue.c
Author: gstein
Date: Fri Apr 9 18:29:32 2010
New Revision: 932538
URL: http://svn.apache.org/viewvc?rev=932538&view=rev
Log:
Expand the db_base_add_* functions to allow creation of nodes-in-conflict
and to schedule work items for later completion.
* subversion/libsvn_wc/wc_db.h:
(svn_wc__db_base_add_directory, svn_wc__db_base_add_file,
svn_wc__db_base_add_symlink, svn_wc__db_base_add_absent_node): add
new CONFLICT and WORK_ITEMS parameters
(svn_wc__db_global_update): add a couple new parameters, but I don't
think we'll use this function...
* subversion/libsvn_wc/wc_db.c:
(insert_base_baton_t): add CONFLICT and WORK_ITEMS members
(add_work_items): forward declare this
(blank_ibb): handy utility to ensure the baton is "zeroed"
(insert_base_node): can't do anything with a conflict yet, but we can
add work items to the queue.
(svn_wc__db_init): call blank_ibb, and remove a few inits.
(svn_wc__db_base_add_directory): add new params, and stash them into the
baton. call blank_ibb. flush the entries before exit.
(svn_wc__db_base_add_file, svn_wc__db_base_add_symlink,
svn_wc__db_base_add_absent_node): add new params and stash them into
the baton. call blank_ibb. switch the insert_base_node() call over to
a transaction for work item insertion. flush entries.
(svn_wc__db_temp_base_add_subdir): add an svn_error_return
(svn_wc__db_global_update): add the two new params
* subversion/libsvn_wc/adm_ops.c:
(revert_entry): pass NULL parms to db_base_add_absent_node
* subversion/libsvn_wc/crop.c:
(svn_wc_exclude): pass NULL parms to db_base_add_absent_node
* subversion/libsvn_wc/update_editor.c:
(absent_file_or_dir): pass NULL parms to db_base_add_absent_node
* subversion/libsvn_wc/workqueue.c:
(run_killme, run_deletion_postcommit): pass NULL parms to
db_base_add_absent_node
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/crop.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/libsvn_wc/workqueue.c
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Apr 9 18:29:32 2010
@@ -1943,6 +1943,7 @@ revert_entry(svn_depth_t *depth,
base_revision,
kind,
svn_wc__db_status_not_present,
+ NULL, NULL,
pool));
}
}
Modified: subversion/trunk/subversion/libsvn_wc/crop.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/crop.c?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/crop.c (original)
+++ subversion/trunk/subversion/libsvn_wc/crop.c Fri Apr 9 18:29:32 2010
@@ -301,6 +301,7 @@ svn_wc_exclude(svn_wc_context_t *wc_ctx,
revision,
kind,
svn_wc__db_status_excluded,
+ NULL, NULL,
scratch_pool));
if (notify_func)
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Apr 9 18:29:32 2010
@@ -3119,6 +3119,7 @@ absent_file_or_dir(const char *path,
repos_relpath, repos_root_url,
repos_uuid, *(eb->target_revision),
db_kind, svn_wc__db_status_absent,
+ NULL, NULL,
pool));
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Apr 9 18:29:32 2010
@@ -239,6 +239,12 @@ typedef struct {
/* for inserting symlinks */
const char *target;
+ /* may need to insert/update ACTUAL to record a conflict */
+ const svn_skel_t *conflict;
+
+ /* may have work items to queue in this transaction */
+ const svn_skel_t *work_items;
+
} insert_base_baton_t;
@@ -264,6 +270,13 @@ static const svn_token_map_t presence_ma
};
+/* Forward declarations */
+static svn_error_t *
+add_work_items(svn_sqlite__db_t *sdb,
+ const svn_skel_t *skel,
+ apr_pool_t *scratch_pool);
+
+
/* */
static svn_filesize_t
get_translated_size(svn_sqlite__stmt_t *stmt, int slot)
@@ -1332,6 +1345,19 @@ create_repos_id(apr_int64_t *repos_id,
}
+/* Initialize the baton with appropriate "blank" values. This allows the
+ insertion function to leave certain columns null. */
+static void
+blank_ibb(insert_base_baton_t *pibb)
+{
+ memset(pibb, 0, sizeof(*pibb));
+ pibb->revision = SVN_INVALID_REVNUM;
+ pibb->changed_rev = SVN_INVALID_REVNUM;
+ pibb->depth = svn_depth_infinity;
+ pibb->translated_size = SVN_INVALID_FILESIZE;
+}
+
+
/* */
static svn_error_t *
insert_base_node(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
@@ -1339,6 +1365,9 @@ insert_base_node(void *baton, svn_sqlite
const insert_base_baton_t *pibb = baton;
svn_sqlite__stmt_t *stmt;
+ /* ### we can't handle this right now */
+ SVN_ERR_ASSERT(pibb->conflict == NULL);
+
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pibb->wc_id, pibb->local_relpath));
@@ -1409,6 +1438,8 @@ insert_base_node(void *baton, svn_sqlite
}
}
+ SVN_ERR(add_work_items(sdb, pibb->work_items, scratch_pool));
+
return SVN_NO_ERROR;
}
@@ -1703,6 +1734,8 @@ svn_wc__db_init(svn_wc__db_t *db,
/* The PDH is complete. Stash it into DB. */
apr_hash_set(db->dir_data, pdh->local_abspath, APR_HASH_KEY_STRING, pdh);
+ blank_ibb(&ibb);
+
if (initial_rev > 0)
ibb.status = svn_wc__db_status_incomplete;
else
@@ -1714,14 +1747,12 @@ svn_wc__db_init(svn_wc__db_t *db,
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;
-
+ /* ### what about the children? */
ibb.children = NULL;
ibb.depth = depth;
+ /* ### no children, conflicts, or work items to install in a txn... */
+
return svn_error_return(insert_base_node(&ibb, sdb, scratch_pool));
}
@@ -1739,6 +1770,8 @@ svn_wc__db_base_add_directory(svn_wc__db
const char *changed_author,
const apr_array_header_t *children,
svn_depth_t depth,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *pdh;
@@ -1763,6 +1796,8 @@ svn_wc__db_base_add_directory(svn_wc__db
SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
pdh->wcroot->sdb, scratch_pool));
+ blank_ibb(&ibb);
+
ibb.status = svn_wc__db_status_normal;
ibb.kind = svn_wc__db_kind_dir;
ibb.wc_id = pdh->wcroot->wc_id;
@@ -1779,13 +1814,20 @@ svn_wc__db_base_add_directory(svn_wc__db
ibb.children = children;
ibb.depth = depth;
+ ibb.conflict = conflict;
+ ibb.work_items = work_items;
+
/* Insert the directory and all its children transactionally.
Note: old children can stick around, even if they are no longer present
in this directory's revision. */
- return svn_sqlite__with_transaction(pdh->wcroot->sdb,
- insert_base_node, &ibb,
- scratch_pool);
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_base_node, &ibb,
+ scratch_pool));
+
+ /* ### worry about flushing child subdirs? */
+ flush_entries(pdh);
+ return SVN_NO_ERROR;
}
@@ -1802,6 +1844,8 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
const char *changed_author,
const svn_checksum_t *checksum,
svn_filesize_t translated_size,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *pdh;
@@ -1826,6 +1870,8 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
pdh->wcroot->sdb, scratch_pool));
+ blank_ibb(&ibb);
+
ibb.status = svn_wc__db_status_normal;
ibb.kind = svn_wc__db_kind_file;
ibb.wc_id = pdh->wcroot->wc_id;
@@ -1842,11 +1888,19 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
ibb.checksum = checksum;
ibb.translated_size = translated_size;
+ ibb.conflict = conflict;
+ ibb.work_items = work_items;
+
/* ### hmm. if this used to be a directory, we should remove children.
### or maybe let caller deal with that, if there is a possibility
### of a node kind change (rather than eat an extra lookup here). */
- return insert_base_node(&ibb, pdh->wcroot->sdb, scratch_pool);
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_base_node, &ibb,
+ scratch_pool));
+
+ flush_entries(pdh);
+ return SVN_NO_ERROR;
}
@@ -1862,6 +1916,8 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
apr_time_t changed_date,
const char *changed_author,
const char *target,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *pdh;
@@ -1886,6 +1942,8 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
pdh->wcroot->sdb, scratch_pool));
+ blank_ibb(&ibb);
+
ibb.status = svn_wc__db_status_normal;
ibb.kind = svn_wc__db_kind_symlink;
ibb.wc_id = pdh->wcroot->wc_id;
@@ -1901,11 +1959,19 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
ibb.target = target;
+ ibb.conflict = conflict;
+ ibb.work_items = work_items;
+
/* ### hmm. if this used to be a directory, we should remove children.
### or maybe let caller deal with that, if there is a possibility
### of a node kind change (rather than eat an extra lookup here). */
- return insert_base_node(&ibb, pdh->wcroot->sdb, scratch_pool);
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_base_node, &ibb,
+ scratch_pool));
+
+ flush_entries(pdh);
+ return SVN_NO_ERROR;
}
@@ -1918,6 +1984,8 @@ svn_wc__db_base_add_absent_node(svn_wc__
svn_revnum_t revision,
svn_wc__db_kind_t kind,
svn_wc__db_status_t status,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *pdh;
@@ -1942,6 +2010,8 @@ svn_wc__db_base_add_absent_node(svn_wc__
SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
pdh->wcroot->sdb, scratch_pool));
+ blank_ibb(&ibb);
+
ibb.status = status;
ibb.kind = kind;
ibb.wc_id = pdh->wcroot->wc_id;
@@ -1950,11 +2020,6 @@ svn_wc__db_base_add_absent_node(svn_wc__
ibb.repos_relpath = repos_relpath;
ibb.revision = revision;
- ibb.props = NULL;
- ibb.changed_rev = SVN_INVALID_REVNUM;
- ibb.changed_date = 0;
- ibb.changed_author = NULL;
-
/* Depending upon KIND, any of these might get used. */
ibb.children = NULL;
ibb.depth = svn_depth_unknown;
@@ -1962,13 +2027,18 @@ svn_wc__db_base_add_absent_node(svn_wc__
ibb.translated_size = SVN_INVALID_FILESIZE;
ibb.target = NULL;
+ ibb.conflict = conflict;
+ ibb.work_items = work_items;
+
/* ### hmm. if this used to be a directory, we should remove children.
### or maybe let caller deal with that, if there is a possibility
### of a node kind change (rather than eat an extra lookup here). */
- SVN_ERR(insert_base_node(&ibb, pdh->wcroot->sdb, scratch_pool));
- flush_entries(pdh);
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_base_node, &ibb,
+ scratch_pool));
+ flush_entries(pdh);
return SVN_NO_ERROR;
}
@@ -2025,7 +2095,10 @@ svn_wc__db_temp_base_add_subdir(svn_wc__
ibb.children = NULL;
ibb.depth = depth;
- return insert_base_node(&ibb, pdh->wcroot->sdb, scratch_pool);
+ /* ### no children, conflicts, or work items to install in a txn... */
+
+ return svn_error_return(insert_base_node(&ibb, pdh->wcroot->sdb,
+ scratch_pool));
}
@@ -4698,6 +4771,7 @@ struct update_baton {
svn_error_t *
svn_wc__db_global_update(svn_wc__db_t *db,
const char *local_abspath,
+ svn_wc__db_kind_t new_kind,
const char *new_repos_relpath,
svn_revnum_t new_revision,
const apr_hash_t *new_props,
@@ -4707,6 +4781,7 @@ svn_wc__db_global_update(svn_wc__db_t *d
const apr_array_header_t *new_children,
const svn_checksum_t *new_checksum,
const char *new_target,
+ const apr_hash_t *new_dav_cache,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Apr 9 18:29:32 2010
@@ -411,6 +411,12 @@ svn_wc__db_init(svn_wc__db_t *db,
This subsystem does not use DEPTH, but it can be recorded here in
the BASE tree for higher-level code to use.
+ If CONFLICT is not NULL, then it describes a conflict for this node. The
+ node will be record as conflicted (in ACTUAL).
+
+ Any work items that are necessary as part of this node construction may
+ be passed in WORK_ITEMS.
+
All temporary allocations will be made in SCRATCH_POOL.
*/
svn_error_t *
@@ -426,6 +432,8 @@ svn_wc__db_base_add_directory(svn_wc__db
const char *changed_author,
const apr_array_header_t *children,
svn_depth_t depth,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -448,6 +456,12 @@ svn_wc__db_base_add_directory(svn_wc__db
by its properties) is known, then pass it as TRANSLATED_SIZE. Otherwise,
pass SVN_INVALID_FILESIZE.
+ If CONFLICT is not NULL, then it describes a conflict for this node. The
+ node will be record as conflicted (in ACTUAL).
+
+ Any work items that are necessary as part of this node construction may
+ be passed in WORK_ITEMS.
+
All temporary allocations will be made in SCRATCH_POOL.
*/
svn_error_t *
@@ -463,6 +477,8 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
const char *changed_author,
const svn_checksum_t *checksum,
svn_filesize_t translated_size,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -480,6 +496,12 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
The target of the symlink is specified by TARGET.
+ If CONFLICT is not NULL, then it describes a conflict for this node. The
+ node will be record as conflicted (in ACTUAL).
+
+ Any work items that are necessary as part of this node construction may
+ be passed in WORK_ITEMS.
+
All temporary allocations will be made in SCRATCH_POOL.
*/
/* ### KFF: This is an interesting question, because currently
@@ -522,6 +544,8 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
apr_time_t changed_date,
const char *changed_author,
const char *target,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -538,6 +562,12 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
svn_wc__db_status_excluded
svn_wc__db_status_not_present
+ If CONFLICT is not NULL, then it describes a conflict for this node. The
+ node will be record as conflicted (in ACTUAL).
+
+ Any work items that are necessary as part of this node construction may
+ be passed in WORK_ITEMS.
+
All temporary allocations will be made in SCRATCH_POOL.
*/
svn_error_t *
@@ -549,6 +579,8 @@ svn_wc__db_base_add_absent_node(svn_wc__
svn_revnum_t revision,
svn_wc__db_kind_t kind,
svn_wc__db_status_t status,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -1491,6 +1523,7 @@ svn_wc__db_global_commit(svn_wc__db_t *d
svn_error_t *
svn_wc__db_global_update(svn_wc__db_t *db,
const char *local_abspath,
+ svn_wc__db_kind_t new_kind,
const char *new_repos_relpath,
svn_revnum_t new_revision,
const apr_hash_t *new_props,
@@ -1500,6 +1533,7 @@ svn_wc__db_global_update(svn_wc__db_t *d
const apr_array_header_t *new_children,
const svn_checksum_t *new_checksum,
const char *new_target,
+ const apr_hash_t *new_dav_cache,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=932538&r1=932537&r2=932538&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri Apr 9 18:29:32 2010
@@ -899,6 +899,7 @@ run_killme(svn_wc__db_t *db,
repos_relpath, repos_root_url, repos_uuid,
original_revision, svn_wc__db_kind_dir,
svn_wc__db_status_not_present,
+ NULL, NULL,
scratch_pool));
}
@@ -1079,6 +1080,7 @@ run_deletion_postcommit(svn_wc__db_t *db
repos_relpath, repos_root_url, repos_uuid,
new_revision, svn_wc__db_kind_file,
svn_wc__db_status_not_present,
+ NULL, NULL,
scratch_pool));
}
}