You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2013/01/03 22:51:04 UTC
svn commit: r1428621 [2/3] - in /subversion/trunk/subversion/libsvn_wc:
wc_db.c wc_db_pristine.c wc_db_private.h wc_db_update_move.c
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1428621&r1=1428620&r2=1428621&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jan 3 21:51:03 2013
@@ -360,15 +360,9 @@ wclock_owns_lock(svn_boolean_t *own_lock
svn_boolean_t exact,
apr_pool_t *scratch_pool);
-/* Baton for passing args to db_is_switched(). */
-struct db_is_switched_baton_t
-{
- svn_boolean_t *is_switched;
- svn_kind_t *kind;
-};
-
static svn_error_t *
-db_is_switched(void *baton,
+db_is_switched(svn_boolean_t *is_switched,
+ svn_kind_t *kind,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
apr_pool_t *scratch_pool);
@@ -2086,28 +2080,20 @@ svn_wc__db_base_add_not_present_node(svn
kind, svn_wc__db_status_not_present, conflict, work_items, scratch_pool);
}
-/* Baton for passing args to db_base_remove(). */
-struct base_remove_baton
-{
- svn_wc__db_t *db; /* For checking conflicts */
- svn_boolean_t keep_as_working;
- svn_revnum_t not_present_revision;
- svn_skel_t *conflict;
- svn_skel_t *work_items;
-};
-
/* The body of svn_wc__db_base_remove().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-db_base_remove(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+db_base_remove(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_wc__db_t *db, /* For checking conflicts */
+ svn_boolean_t keep_as_working,
+ svn_revnum_t not_present_revision,
+ svn_skel_t *conflict,
+ svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
- struct base_remove_baton *rb = baton;
svn_wc__db_status_t status;
apr_int64_t repos_id;
const char *repos_relpath;
@@ -2122,9 +2108,9 @@ db_base_remove(void *baton,
scratch_pool, scratch_pool));
if (status == svn_wc__db_status_normal
- && rb->keep_as_working)
+ && keep_as_working)
{
- SVN_ERR(svn_wc__db_op_make_copy(rb->db,
+ SVN_ERR(svn_wc__db_op_make_copy(db,
svn_dirent_join(wcroot->abspath,
local_relpath,
scratch_pool),
@@ -2178,12 +2164,12 @@ db_base_remove(void *baton,
if (node_kind == svn_kind_dir)
SVN_ERR(svn_wc__wq_build_dir_remove(&work_item,
- rb->db, wcroot->abspath,
+ db, wcroot->abspath,
node_abspath, FALSE,
iterpool, iterpool));
else
SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- rb->db,
+ db,
wcroot->abspath,
node_abspath,
iterpool, iterpool));
@@ -2196,14 +2182,14 @@ db_base_remove(void *baton,
SVN_ERR(svn_sqlite__reset(stmt));
SVN_ERR(svn_wc__wq_build_dir_remove(&work_item,
- rb->db, wcroot->abspath,
+ db, wcroot->abspath,
local_abspath, FALSE,
scratch_pool, iterpool));
svn_pool_destroy(iterpool);
}
else
SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- rb->db, wcroot->abspath,
+ db, wcroot->abspath,
local_abspath,
scratch_pool, scratch_pool));
@@ -2220,7 +2206,7 @@ db_base_remove(void *baton,
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
}
- else if (! rb->keep_as_working)
+ else if (! keep_as_working)
{
/* Delete only the ACTUAL nodes that apply to a delete of a BASE node */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -2271,7 +2257,7 @@ db_base_remove(void *baton,
SVN_ERR(svn_sqlite__step_done(stmt));
}
- if (SVN_IS_VALID_REVNUM(rb->not_present_revision))
+ if (SVN_IS_VALID_REVNUM(not_present_revision))
{
struct insert_base_baton_t ibb;
blank_ibb(&ibb);
@@ -2280,7 +2266,7 @@ db_base_remove(void *baton,
ibb.status = svn_wc__db_status_not_present;
ibb.kind = kind;
ibb.repos_relpath = repos_relpath;
- ibb.revision = rb->not_present_revision;
+ ibb.revision = not_present_revision;
/* Depending upon KIND, any of these might get used. */
ibb.children = NULL;
@@ -2291,10 +2277,10 @@ db_base_remove(void *baton,
SVN_ERR(insert_base_node(&ibb, wcroot, local_relpath, scratch_pool));
}
- SVN_ERR(add_work_items(wcroot->sdb, rb->work_items, scratch_pool));
- if (rb->conflict)
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
+ if (conflict)
SVN_ERR(svn_wc__db_mark_conflict_internal(wcroot, local_relpath,
- rb->conflict, scratch_pool));
+ conflict, scratch_pool));
return SVN_NO_ERROR;
}
@@ -2311,7 +2297,6 @@ svn_wc__db_base_remove(svn_wc__db_t *db,
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct base_remove_baton rb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -2319,14 +2304,10 @@ svn_wc__db_base_remove(svn_wc__db_t *db,
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- rb.db = db;
- rb.keep_as_working = keep_as_working;
- rb.not_present_revision = not_present_revision;
- rb.conflict = conflict;
- rb.work_items = work_items;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_base_remove, &rb,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(db_base_remove(wcroot, local_relpath,
+ db, keep_as_working, not_present_revision,
+ conflict, work_items, scratch_pool),
+ wcroot);
/* If this used to be a directory we should remove children so pass
* depth infinity. */
@@ -3304,30 +3285,21 @@ svn_wc__db_external_add_dir(svn_wc__db_t
&ieb, scratch_pool));
}
-/* Baton for passing args to db_external_remove(). */
-struct external_remove_baton
-{
- const svn_skel_t *work_items;
-};
-
-/* The body of svn_wc__db_external_remove().
- *
- * Implements svn_wc__db_txn_callback_t. */
+/* The body of svn_wc__db_external_remove(). */
static svn_error_t *
-db_external_remove(void *baton,
+db_external_remove(const svn_skel_t *work_items,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
- struct external_remove_baton *rb = baton;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_DELETE_EXTERNAL));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(add_work_items(wcroot->sdb, rb->work_items, scratch_pool));
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
/* ### What about actual? */
return SVN_NO_ERROR;
@@ -3342,7 +3314,6 @@ svn_wc__db_external_remove(svn_wc__db_t
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct external_remove_baton rb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -3357,9 +3328,9 @@ svn_wc__db_external_remove(svn_wc__db_t
local_relpath = svn_dirent_skip_ancestor(wcroot->abspath, local_abspath);
- rb.work_items = work_items;
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_external_remove,
- &rb, scratch_pool));
+ SVN_WC__DB_WITH_TXN(db_external_remove(work_items, wcroot, local_relpath,
+ scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -5146,17 +5117,6 @@ set_actual_props(apr_int64_t wc_id,
}
-/* Baton for passing args to set_props_txn(). */
-struct set_props_baton_t
-{
- apr_hash_t *props;
- svn_boolean_t clear_recorded_info;
-
- const svn_skel_t *conflict;
- const svn_skel_t *work_items;
-};
-
-
/* The body of svn_wc__db_op_set_props().
Set the 'properties' column in the 'ACTUAL_NODE' table to BATON->props.
@@ -5164,16 +5124,16 @@ struct set_props_baton_t
have one.
To specify no properties, BATON->props must be an empty hash, not NULL.
BATON is of type 'struct set_props_baton_t'.
-
- Implements svn_wc__db_txn_callback_t.
*/
static svn_error_t *
-set_props_txn(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+set_props_txn(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ apr_hash_t *props,
+ svn_boolean_t clear_recorded_info,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
- struct set_props_baton_t *spb = baton;
apr_hash_t *pristine_props;
/* Check if the props are modified. If no changes, then wipe out the
@@ -5181,20 +5141,20 @@ set_props_txn(void *baton,
ACTUAL props are okay as provided, so go ahead and set them. */
SVN_ERR(db_read_pristine_props(&pristine_props, wcroot, local_relpath, FALSE,
scratch_pool, scratch_pool));
- if (spb->props && pristine_props)
+ if (props && pristine_props)
{
apr_array_header_t *prop_diffs;
- SVN_ERR(svn_prop_diffs(&prop_diffs, spb->props, pristine_props,
+ SVN_ERR(svn_prop_diffs(&prop_diffs, props, pristine_props,
scratch_pool));
if (prop_diffs->nelts == 0)
- spb->props = NULL;
+ props = NULL;
}
SVN_ERR(set_actual_props(wcroot->wc_id, local_relpath,
- spb->props, wcroot->sdb, scratch_pool));
+ props, wcroot->sdb, scratch_pool));
- if (spb->clear_recorded_info)
+ if (clear_recorded_info)
{
struct record_baton_t rb;
rb.recorded_size = SVN_INVALID_FILESIZE;
@@ -5203,10 +5163,10 @@ set_props_txn(void *baton,
}
/* And finally. */
- SVN_ERR(add_work_items(wcroot->sdb, spb->work_items, scratch_pool));
- if (spb->conflict)
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
+ if (conflict)
SVN_ERR(svn_wc__db_mark_conflict_internal(wcroot, local_relpath,
- spb->conflict, scratch_pool));
+ conflict, scratch_pool));
return SVN_NO_ERROR;
}
@@ -5221,7 +5181,6 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
- struct set_props_baton_t spb;
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
@@ -5231,14 +5190,11 @@ svn_wc__db_op_set_props(svn_wc__db_t *db
db, local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- spb.props = props;
- spb.clear_recorded_info = clear_recorded_info;
- spb.conflict = conflict;
- spb.work_items = work_items;
-
- return svn_error_trace(svn_wc__db_with_txn(wcroot, local_relpath,
- set_props_txn, &spb,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(set_props_txn(wcroot, local_relpath, props,
+ clear_recorded_info, conflict, work_items,
+ scratch_pool),
+ wcroot);
+ return SVN_NO_ERROR;
}
@@ -5651,26 +5607,18 @@ svn_wc__db_op_mark_conflict(svn_wc__db_t
}
-/* Baton for passing args to db_op_mark_resolved(). */
-struct op_mark_resolved_baton
-{
- svn_boolean_t resolved_text;
- svn_boolean_t resolved_props;
- svn_boolean_t resolved_tree;
- const svn_skel_t *work_items;
- svn_wc__db_t *db;
-};
-
/* The body of svn_wc__db_op_mark_resolved().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-db_op_mark_resolved(void *baton,
- svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool)
+db_op_mark_resolved(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ svn_wc__db_t *db,
+ svn_boolean_t resolved_text,
+ svn_boolean_t resolved_props,
+ svn_boolean_t resolved_tree,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
{
- struct op_mark_resolved_baton *rb = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
int total_affected_rows = 0;
@@ -5714,10 +5662,10 @@ db_op_mark_resolved(void *baton,
SVN_ERR(svn_sqlite__reset(stmt));
SVN_ERR(svn_wc__conflict_skel_resolve(&resolved_all, conflicts,
- rb->db, wcroot->abspath,
- rb->resolved_text,
- rb->resolved_props ? "" : NULL,
- rb->resolved_tree,
+ db, wcroot->abspath,
+ resolved_text,
+ resolved_props ? "" : NULL,
+ resolved_tree,
scratch_pool, scratch_pool));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -5743,7 +5691,7 @@ db_op_mark_resolved(void *baton,
SVN_ERR(svn_sqlite__step_done(stmt));
}
- SVN_ERR(add_work_items(wcroot->sdb, rb->work_items, scratch_pool));
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
return SVN_NO_ERROR;
}
@@ -5759,7 +5707,6 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct op_mark_resolved_baton rb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -5767,14 +5714,11 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- rb.resolved_props = resolved_props;
- rb.resolved_text = resolved_text;
- rb.resolved_tree = resolved_tree;
- rb.work_items = work_items;
- rb.db = db;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_op_mark_resolved,
- &rb, scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ db_op_mark_resolved(wcroot, local_relpath, db,
+ resolved_text, resolved_props, resolved_tree,
+ work_items, scratch_pool),
+ wcroot);
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
return SVN_NO_ERROR;
@@ -6094,33 +6038,26 @@ svn_wc__db_op_revert(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
-/* Baton for passing args to revert_list_read(). */
-struct revert_list_read_baton {
- svn_boolean_t *reverted;
- const apr_array_header_t *marker_paths;
- svn_boolean_t *copied_here;
- svn_kind_t *kind;
- apr_pool_t *result_pool;
- svn_wc__db_t *db;
-};
-
/* The body of svn_wc__db_revert_list_read().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-revert_list_read(void *baton,
+revert_list_read(svn_boolean_t *reverted,
+ const apr_array_header_t **marker_paths,
+ svn_boolean_t *copied_here,
+ svn_kind_t *kind,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_wc__db_t *db,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct revert_list_read_baton *b = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
- *(b->reverted) = FALSE;
- b->marker_paths = NULL;
- *(b->copied_here) = FALSE;
- *(b->kind) = svn_kind_unknown;
+ *reverted = FALSE;
+ *marker_paths = NULL;
+ *copied_here = FALSE;
+ *kind = svn_kind_unknown;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_REVERT_LIST));
@@ -6144,28 +6081,28 @@ revert_list_read(void *baton,
conflict_len,
scratch_pool);
- SVN_ERR(svn_wc__conflict_read_markers(&b->marker_paths,
- b->db, wcroot->abspath,
+ SVN_ERR(svn_wc__conflict_read_markers(marker_paths,
+ db, wcroot->abspath,
conflicts,
- b->result_pool,
+ result_pool,
scratch_pool));
}
if (!svn_sqlite__column_is_null(stmt, 1)) /* notify */
- *(b->reverted) = TRUE;
+ *reverted = TRUE;
SVN_ERR(svn_sqlite__step(&another_row, stmt));
}
if (!is_actual || another_row)
{
- *(b->reverted) = TRUE;
+ *reverted = TRUE;
if (!svn_sqlite__column_is_null(stmt, 4)) /* repos_id */
{
int op_depth = svn_sqlite__column_int(stmt, 3);
- *(b->copied_here) = (op_depth == relpath_depth(local_relpath));
+ *copied_here = (op_depth == relpath_depth(local_relpath));
}
- *(b->kind) = svn_sqlite__column_token(stmt, 2, kind_map);
+ *kind = svn_sqlite__column_token(stmt, 2, kind_map);
}
}
@@ -6194,47 +6131,35 @@ svn_wc__db_revert_list_read(svn_boolean_
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct revert_list_read_baton b;
-
- b.reverted = reverted;
- b.copied_here = copied_here;
- b.kind = kind;
- b.result_pool = result_pool;
- b.db = db;
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
db, local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, revert_list_read, &b,
- scratch_pool));
- *marker_files = b.marker_paths;
+ SVN_WC__DB_WITH_TXN(
+ revert_list_read(reverted, marker_files, copied_here, kind,
+ wcroot, local_relpath, db,
+ result_pool, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
-/* Baton for passing args to revert_list_read_copied_children(). */
-struct revert_list_read_copied_children_baton {
- const apr_array_header_t **children;
- apr_pool_t *result_pool;
-};
-
/* The body of svn_wc__db_revert_list_read_copied_children().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-revert_list_read_copied_children(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+revert_list_read_copied_children(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ const apr_array_header_t **children_p,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct revert_list_read_copied_children_baton *b = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
apr_array_header_t *children;
children =
- apr_array_make(b->result_pool, 0,
+ apr_array_make(result_pool, 0,
sizeof(svn_wc__db_revert_list_copied_child_info_t *));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -6247,11 +6172,11 @@ revert_list_read_copied_children(void *b
svn_wc__db_revert_list_copied_child_info_t *child_info;
const char *child_relpath;
- child_info = apr_palloc(b->result_pool, sizeof(*child_info));
+ child_info = apr_palloc(result_pool, sizeof(*child_info));
child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
child_info->abspath = svn_dirent_join(wcroot->abspath, child_relpath,
- b->result_pool);
+ result_pool);
child_info->kind = svn_sqlite__column_token(stmt, 1, kind_map);
APR_ARRAY_PUSH(
children,
@@ -6261,7 +6186,7 @@ revert_list_read_copied_children(void *b
}
SVN_ERR(svn_sqlite__reset(stmt));
- *b->children = children;
+ *children_p = children;
return SVN_NO_ERROR;
}
@@ -6276,18 +6201,15 @@ svn_wc__db_revert_list_read_copied_child
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct revert_list_read_copied_children_baton b;
-
- b.children = children;
- b.result_pool = result_pool;
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
db, local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath,
- revert_list_read_copied_children, &b,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ revert_list_read_copied_children(wcroot, local_relpath, children,
+ result_pool, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -6360,32 +6282,24 @@ svn_wc__db_revert_list_done(svn_wc__db_t
return SVN_NO_ERROR;
}
-/* Baton for passing args to remove_node_txn(). */
-struct remove_node_baton
-{
- svn_wc__db_t *db;
- svn_boolean_t left_changes;
- svn_boolean_t destroy_wc;
- svn_boolean_t destroy_changes;
- svn_revnum_t not_present_rev;
- svn_wc__db_status_t not_present_status;
- svn_kind_t not_present_kind;
- const svn_skel_t *conflict;
- const svn_skel_t *work_items;
- svn_cancel_func_t cancel_func;
- void *cancel_baton;
-};
-
/* The body of svn_wc__db_op_remove_node().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-remove_node_txn(void *baton,
+remove_node_txn(svn_boolean_t *left_changes,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_wc__db_t *db,
+ svn_boolean_t destroy_wc,
+ svn_boolean_t destroy_changes,
+ svn_revnum_t not_present_rev,
+ svn_wc__db_status_t not_present_status,
+ svn_kind_t not_present_kind,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
apr_pool_t *scratch_pool)
{
- struct remove_node_baton *rnb = baton;
svn_sqlite__stmt_t *stmt;
apr_int64_t repos_id;
@@ -6395,10 +6309,13 @@ remove_node_txn(void *baton,
function to be called on a wcroot! */
/* db set when destroying wc */
- SVN_ERR_ASSERT(!rnb->destroy_wc || rnb->db != NULL);
+ SVN_ERR_ASSERT(!destroy_wc || db != NULL);
+
+ if (left_changes)
+ *left_changes = FALSE;
/* Need info for not_present node? */
- if (SVN_IS_VALID_REVNUM(rnb->not_present_rev))
+ if (SVN_IS_VALID_REVNUM(not_present_rev))
SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
&repos_relpath, &repos_id,
NULL, NULL, NULL, NULL, NULL,
@@ -6406,8 +6323,8 @@ remove_node_txn(void *baton,
wcroot, local_relpath,
scratch_pool, scratch_pool));
- if (rnb->destroy_wc
- && (!rnb->destroy_changes || *local_relpath == '\0'))
+ if (destroy_wc
+ && (!destroy_changes || *local_relpath == '\0'))
{
svn_boolean_t have_row;
apr_pool_t *iterpool;
@@ -6450,8 +6367,8 @@ remove_node_txn(void *baton,
recorded_time = svn_sqlite__column_int64(stmt, 4);
}
- if (rnb->cancel_func)
- err = rnb->cancel_func(rnb->cancel_baton);
+ if (cancel_func)
+ err = cancel_func(cancel_baton);
if (err)
break;
@@ -6462,7 +6379,7 @@ remove_node_txn(void *baton,
if (err)
break;
- if (rnb->destroy_changes
+ if (destroy_changes
|| dirent->kind != svn_node_file
|| child_kind != svn_kind_file)
{
@@ -6478,25 +6395,28 @@ remove_node_txn(void *baton,
}
else if (have_checksum)
err = svn_wc__internal_file_modified_p(&modified_p,
- rnb->db, child_abspath,
+ db, child_abspath,
FALSE, iterpool);
if (err)
break;
if (modified_p)
- rnb->left_changes = TRUE;
+ {
+ if (left_changes)
+ *left_changes = TRUE;
+ }
else if (child_kind == svn_kind_dir)
{
err = svn_wc__wq_build_dir_remove(&work_item,
- rnb->db, wcroot->abspath,
+ db, wcroot->abspath,
child_abspath, FALSE,
iterpool, iterpool);
}
else /* svn_kind_file || svn_kind_symlink */
{
err = svn_wc__wq_build_file_remove(&work_item,
- rnb->db, wcroot->abspath,
+ db, wcroot->abspath,
child_abspath,
iterpool, iterpool);
}
@@ -6518,7 +6438,7 @@ remove_node_txn(void *baton,
SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
}
- if (rnb->destroy_wc && *local_relpath != '\0')
+ if (destroy_wc && *local_relpath != '\0')
{
/* Create work item for destroying the root */
svn_wc__db_status_t status;
@@ -6541,9 +6461,9 @@ remove_node_txn(void *baton,
if (kind == svn_kind_dir)
{
SVN_ERR(svn_wc__wq_build_dir_remove(&work_item,
- rnb->db, wcroot->abspath,
+ db, wcroot->abspath,
local_abspath,
- rnb->destroy_changes
+ destroy_changes
/* recursive */,
scratch_pool, scratch_pool));
}
@@ -6551,23 +6471,25 @@ remove_node_txn(void *baton,
{
svn_boolean_t modified_p = FALSE;
- if (!rnb->destroy_changes)
+ if (!destroy_changes)
{
SVN_ERR(svn_wc__internal_file_modified_p(&modified_p,
- rnb->db,
- local_abspath,
+ db, local_abspath,
FALSE,
scratch_pool));
}
if (!modified_p)
SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- rnb->db, wcroot->abspath,
+ db, wcroot->abspath,
local_abspath,
scratch_pool,
scratch_pool));
else
- rnb->left_changes = TRUE;
+ {
+ if (left_changes)
+ *left_changes = TRUE;
+ }
}
SVN_ERR(add_work_items(wcroot->sdb, work_item, scratch_pool));
@@ -6598,29 +6520,29 @@ remove_node_txn(void *baton,
SVN_ERR(svn_sqlite__step_done(stmt));
/* Should we leave a not-present node? */
- if (SVN_IS_VALID_REVNUM(rnb->not_present_rev))
+ if (SVN_IS_VALID_REVNUM(not_present_rev))
{
insert_base_baton_t ibb;
blank_ibb(&ibb);
ibb.repos_id = repos_id;
- SVN_ERR_ASSERT(rnb->not_present_status == svn_wc__db_status_not_present
- || rnb->not_present_status == svn_wc__db_status_excluded);
+ SVN_ERR_ASSERT(not_present_status == svn_wc__db_status_not_present
+ || not_present_status == svn_wc__db_status_excluded);
- ibb.status = rnb->not_present_status;
- ibb.kind = rnb->not_present_kind;
+ ibb.status = not_present_status;
+ ibb.kind = not_present_kind;
ibb.repos_relpath = repos_relpath;
- ibb.revision = rnb->not_present_rev;
+ ibb.revision = not_present_rev;
SVN_ERR(insert_base_node(&ibb, wcroot, local_relpath, scratch_pool));
}
- SVN_ERR(add_work_items(wcroot->sdb, rnb->work_items, scratch_pool));
- if (rnb->conflict)
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
+ if (conflict)
SVN_ERR(svn_wc__db_mark_conflict_internal(wcroot, local_relpath,
- rnb->conflict, scratch_pool));
+ conflict, scratch_pool));
return SVN_NO_ERROR;
}
@@ -6641,7 +6563,6 @@ svn_wc__db_op_remove_node(svn_boolean_t
apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
- struct remove_node_baton rnb;
const char *local_relpath;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -6650,45 +6571,30 @@ svn_wc__db_op_remove_node(svn_boolean_t
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- rnb.db = db;
- rnb.left_changes = FALSE;
- rnb.destroy_wc = destroy_wc;
- rnb.destroy_changes = destroy_changes;
- rnb.not_present_rev = not_present_revision;
- rnb.not_present_status = not_present_status;
- rnb.not_present_kind = not_present_kind;
- rnb.conflict = conflict;
- rnb.work_items = work_items;
- rnb.cancel_func = cancel_func;
- rnb.cancel_baton = cancel_baton;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, remove_node_txn,
- &rnb, scratch_pool));
+ SVN_WC__DB_WITH_TXN(remove_node_txn(left_changes,
+ wcroot, local_relpath, db,
+ destroy_wc, destroy_changes,
+ not_present_revision, not_present_status,
+ not_present_kind, conflict, work_items,
+ cancel_func, cancel_baton, scratch_pool),
+ wcroot);
/* Flush everything below this node in all ways */
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_infinity,
scratch_pool));
- if (left_changes)
- *left_changes = rnb.left_changes;
-
return SVN_NO_ERROR;
}
-/* Baton for passing args to db_op_set_base_depth(). */
-struct set_base_depth_baton_t
-{
- svn_depth_t depth;
-};
-
+/* The body of svn_wc__db_op_set_base_depth().
+ */
static svn_error_t *
-db_op_set_base_depth(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+db_op_set_base_depth(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_depth_t depth,
apr_pool_t *scratch_pool)
{
- struct set_base_depth_baton_t *sbd = baton;
svn_sqlite__stmt_t *stmt;
int affected_rows;
@@ -6696,7 +6602,7 @@ db_op_set_base_depth(void *baton,
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_UPDATE_NODE_BASE_DEPTH));
SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
- svn_token__to_word(depth_map, sbd->depth)));
+ svn_token__to_word(depth_map, depth)));
SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
if (affected_rows == 0)
@@ -6717,7 +6623,6 @@ svn_wc__db_op_set_base_depth(svn_wc__db_
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct set_base_depth_baton_t sbd;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(depth >= svn_depth_empty && depth <= svn_depth_infinity);
@@ -6728,10 +6633,9 @@ svn_wc__db_op_set_base_depth(svn_wc__db_
/* ### We set depth on working and base to match entry behavior.
Maybe these should be separated later? */
- sbd.depth = depth;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_op_set_base_depth,
- &sbd, scratch_pool));
+ SVN_WC__DB_WITH_TXN(db_op_set_base_depth(wcroot, local_relpath, depth,
+ scratch_pool),
+ wcroot);
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
@@ -7941,19 +7845,11 @@ svn_wc__db_read_info(svn_wc__db_status_t
}
static svn_error_t *
-is_wclocked(void *baton,
+is_wclocked(svn_boolean_t *locked,
svn_wc__db_wcroot_t *wcroot,
const char *dir_relpath,
apr_pool_t *scratch_pool);
-/* baton for read_children_info() */
-struct read_children_info_baton_t
-{
- apr_hash_t *nodes;
- apr_hash_t *conflicts;
- apr_pool_t *result_pool;
-};
-
/* What we really want to store about a node. This relies on the
offset of svn_wc__db_info_t being zero. */
struct read_children_info_item_t
@@ -7964,20 +7860,18 @@ struct read_children_info_item_t
};
static svn_error_t *
-read_children_info(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+read_children_info(svn_wc__db_wcroot_t *wcroot,
const char *dir_relpath,
+ apr_hash_t *conflicts,
+ apr_hash_t *nodes,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct read_children_info_baton_t *rci = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
const char *repos_root_url = NULL;
const char *repos_uuid = NULL;
apr_int64_t last_repos_id = INVALID_REPOS_ID;
- apr_hash_t *nodes = rci->nodes;
- apr_hash_t *conflicts = rci->conflicts;
- apr_pool_t *result_pool = rci->result_pool;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_NODE_CHILDREN_INFO));
@@ -8218,7 +8112,6 @@ svn_wc__db_read_children_info(apr_hash_t
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct read_children_info_baton_t rci;
svn_wc__db_wcroot_t *wcroot;
const char *dir_relpath;
@@ -8231,12 +8124,10 @@ svn_wc__db_read_children_info(apr_hash_t
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- rci.result_pool = result_pool;
- rci.conflicts = *conflicts;
- rci.nodes = *nodes;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, dir_relpath, read_children_info, &rci,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ read_children_info(wcroot, dir_relpath, *conflicts, *nodes,
+ result_pool, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -8536,19 +8427,15 @@ svn_wc__db_read_node_install_info(const
-struct read_url_baton_t {
- const char **url;
- apr_pool_t *result_pool;
-};
-
-
+/* The body of svn_wc__db_read_url().
+ */
static svn_error_t *
-read_url_txn(void *baton,
+read_url_txn(const char **url,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct read_url_baton_t *rub = baton;
svn_wc__db_status_t status;
const char *repos_relpath;
const char *repos_root_url;
@@ -8630,8 +8517,7 @@ read_url_txn(void *baton,
{
const char *parent_relpath;
const char *name;
- struct read_url_baton_t new_rub;
- const char *url;
+ const char *url2;
/* Set 'url' to the *full URL* of the parent WC dir,
* and 'name' to the *single path component* that is the
@@ -8639,12 +8525,10 @@ read_url_txn(void *baton,
* in the correct full URL. */
svn_relpath_split(&parent_relpath, &name, local_relpath,
scratch_pool);
- new_rub.result_pool = scratch_pool;
- new_rub.url = &url;
- SVN_ERR(read_url_txn(&new_rub, wcroot, parent_relpath,
- scratch_pool));
+ SVN_ERR(read_url_txn(&url2, wcroot, parent_relpath,
+ scratch_pool, scratch_pool));
- *rub->url = svn_path_url_add_component2(url, name, rub->result_pool);
+ *url = svn_path_url_add_component2(url2, name, result_pool);
return SVN_NO_ERROR;
}
@@ -8660,26 +8544,8 @@ read_url_txn(void *baton,
scratch_pool));
SVN_ERR_ASSERT(repos_root_url != NULL && repos_relpath != NULL);
- *rub->url = svn_path_url_add_component2(repos_root_url, repos_relpath,
- rub->result_pool);
-
- return SVN_NO_ERROR;
-}
-
-
-static svn_error_t *
-read_url(const char **url,
- svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- struct read_url_baton_t rub;
-
- rub.url = url;
- rub.result_pool = result_pool;
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, read_url_txn, &rub,
- scratch_pool));
+ *url = svn_path_url_add_component2(repos_root_url, repos_relpath,
+ result_pool);
return SVN_NO_ERROR;
}
@@ -8702,8 +8568,11 @@ svn_wc__db_read_url(const char **url,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- return svn_error_trace(read_url(url, wcroot, local_relpath, result_pool,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(read_url_txn(url, wcroot, local_relpath,
+ result_pool, scratch_pool),
+ wcroot);
+
+ return SVN_NO_ERROR;
}
@@ -8843,24 +8712,15 @@ svn_wc__db_read_props_streamily(svn_wc__
}
-/* Baton for passing args to db_read_props(). */
-struct db_read_props_baton_t
-{
- apr_hash_t *props;
- apr_pool_t *result_pool;
-};
-
-
/* Helper for svn_wc__db_read_props().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-db_read_props(void *baton,
+db_read_props(apr_hash_t **props,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct db_read_props_baton_t *rpb = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
svn_error_t *err = NULL;
@@ -8872,8 +8732,8 @@ db_read_props(void *baton,
if (have_row && !svn_sqlite__column_is_null(stmt, 0))
{
- err = svn_sqlite__column_properties(&rpb->props, stmt, 0,
- rpb->result_pool, scratch_pool);
+ err = svn_sqlite__column_properties(props, stmt, 0,
+ result_pool, scratch_pool);
}
else
have_row = FALSE;
@@ -8884,16 +8744,16 @@ db_read_props(void *baton,
return SVN_NO_ERROR;
/* No local changes. Return the pristine props for this node. */
- SVN_ERR(db_read_pristine_props(&rpb->props, wcroot, local_relpath, FALSE,
- rpb->result_pool, scratch_pool));
- if (rpb->props == NULL)
+ SVN_ERR(db_read_pristine_props(props, wcroot, local_relpath, FALSE,
+ result_pool, scratch_pool));
+ if (*props == NULL)
{
/* Pristine properties are not defined for this node.
### we need to determine whether this node is in a state that
### allows for ACTUAL properties (ie. not deleted). for now,
### just say all nodes, no matter the state, have at least an
### empty set of props. */
- rpb->props = apr_hash_make(rpb->result_pool);
+ *props = apr_hash_make(result_pool);
}
return SVN_NO_ERROR;
@@ -8909,7 +8769,6 @@ svn_wc__db_read_props(apr_hash_t **props
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct db_read_props_baton_t rpb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -8917,12 +8776,9 @@ svn_wc__db_read_props(apr_hash_t **props
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- rpb.result_pool = result_pool;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_read_props, &rpb,
- scratch_pool));
-
- *props = rpb.props;
+ SVN_WC__DB_WITH_TXN(db_read_props(props, wcroot, local_relpath,
+ result_pool, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -9174,34 +9030,25 @@ filter_unwanted_props(apr_hash_t *prop_h
return;
}
-/* Baton for passing args to db_read_inherited_props(). */
-struct read_inherited_props_baton_t
-{
- apr_array_header_t *iprops;
- const char *propname;
- const char *repos_root_url;
- apr_pool_t *result_pool;
-};
-
/* The body of svn_wc__db_read_inherited_props().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-db_read_inherited_props(void *baton,
+db_read_inherited_props(apr_array_header_t **iprops,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ const char *propname,
+ const char *repos_root_url,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct read_inherited_props_baton_t *ripb = baton;
int i;
apr_array_header_t *cached_iprops = NULL;
const char *parent_relpath = local_relpath;
svn_boolean_t is_wc_root = FALSE;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- apr_pool_t *result_pool = ripb->result_pool;
- ripb->iprops = apr_array_make(ripb->result_pool, 1,
- sizeof(svn_prop_inherited_item_t *));
+ *iprops = apr_array_make(result_pool, 1,
+ sizeof(svn_prop_inherited_item_t *));
/* Walk up to the root of the WC looking for inherited properties. When we
reach the WC root also check for cached inherited properties. */
@@ -9209,20 +9056,17 @@ db_read_inherited_props(void *baton,
{
apr_hash_t *actual_props;
svn_boolean_t is_switched;
- struct db_is_switched_baton_t swb;
svn_pool_clear(iterpool);
- swb.is_switched = &is_switched;
- swb.kind = NULL;
-
if (*parent_relpath == '\0')
{
is_switched = FALSE;
is_wc_root = TRUE;
}
else
- SVN_ERR(db_is_switched(&swb, wcroot, parent_relpath, scratch_pool));
+ SVN_ERR(db_is_switched(&is_switched, NULL, wcroot, parent_relpath,
+ scratch_pool));
if (is_switched || is_wc_root)
{
@@ -9247,23 +9091,19 @@ db_read_inherited_props(void *baton,
LOCAL_ABSPATH can inherit properties from it. */
if (strcmp(local_relpath, parent_relpath) != 0)
{
- struct db_read_props_baton_t rpb;
- rpb.result_pool = result_pool;
-
- SVN_ERR(db_read_props(&rpb, wcroot, parent_relpath, iterpool));
-
- actual_props = rpb.props;
+ SVN_ERR(db_read_props(&actual_props, wcroot, parent_relpath,
+ result_pool, iterpool));
if (actual_props)
{
/* If we only want PROPNAME filter out any other properties. */
- if (ripb->propname)
- filter_unwanted_props(actual_props, ripb->propname, iterpool);
+ if (propname)
+ filter_unwanted_props(actual_props, propname, iterpool);
if (apr_hash_count(actual_props))
{
svn_prop_inherited_item_t *iprop_elt =
- apr_pcalloc(ripb->result_pool,
+ apr_pcalloc(result_pool,
sizeof(svn_prop_inherited_item_t));
iprop_elt->path_or_url = svn_dirent_join(wcroot->abspath,
parent_relpath,
@@ -9271,7 +9111,7 @@ db_read_inherited_props(void *baton,
iprop_elt->prop_hash = actual_props;
/* Build the output array in depth-first order. */
- svn_sort__array_insert(&iprop_elt, ripb->iprops, 0);
+ svn_sort__array_insert(&iprop_elt, *iprops, 0);
}
}
}
@@ -9296,8 +9136,8 @@ db_read_inherited_props(void *baton,
if (apr_hash_count(cached_iprop->prop_hash) == 0)
continue;
- if (ripb->propname)
- filter_unwanted_props(cached_iprop->prop_hash, ripb->propname,
+ if (propname)
+ filter_unwanted_props(cached_iprop->prop_hash, propname,
scratch_pool);
/* If we didn't filter everything then keep this iprop. */
@@ -9306,10 +9146,10 @@ db_read_inherited_props(void *baton,
/* Convert the repository relative path in the
cache to a full URL. */
cached_iprop->path_or_url =
- svn_path_url_add_component2(ripb->repos_root_url,
+ svn_path_url_add_component2(repos_root_url,
cached_iprop->path_or_url,
result_pool);
- svn_sort__array_insert(&cached_iprop, ripb->iprops, 0);
+ svn_sort__array_insert(&cached_iprop, *iprops, 0);
}
}
}
@@ -9328,7 +9168,6 @@ svn_wc__db_read_inherited_props(apr_arra
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct read_inherited_props_baton_t ripb;
const char *repos_root_url;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -9342,40 +9181,28 @@ svn_wc__db_read_inherited_props(apr_arra
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- ripb.iprops = NULL;
- ripb.propname = propname;
- ripb.repos_root_url = repos_root_url;
- ripb.result_pool = result_pool;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_read_inherited_props,
- &ripb, scratch_pool));
+ SVN_WC__DB_WITH_TXN(db_read_inherited_props(iprops,
+ wcroot, local_relpath, propname, repos_root_url,
+ result_pool, scratch_pool),
+ wcroot);
- *iprops = ripb.iprops;
return SVN_NO_ERROR;
}
-/* Baton for passing args to get_children_with_cached_iprops(). */
-struct get_children_with_cached_baton_t
-{
- svn_depth_t depth;
- apr_hash_t *iprop_paths;
- apr_pool_t *result_pool;
-};
-
/* The body of svn_wc__db_get_children_with_cached_iprops().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-get_children_with_cached_iprops(void *baton,
+get_children_with_cached_iprops(apr_hash_t **iprop_paths,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_depth_t depth,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct get_children_with_cached_baton_t *cwcb = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
- apr_hash_t *iprop_paths = cwcb->iprop_paths;
- apr_pool_t *result_pool = cwcb->result_pool;
+
+ *iprop_paths = apr_hash_make(result_pool);
/* First check if LOCAL_RELPATH itself has iprops */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -9390,17 +9217,17 @@ get_children_with_cached_iprops(void *ba
const char *abspath_with_cache = svn_dirent_join(wcroot->abspath,
relpath_with_cache,
result_pool);
- apr_hash_set(iprop_paths, abspath_with_cache, APR_HASH_KEY_STRING,
+ apr_hash_set(*iprop_paths, abspath_with_cache, APR_HASH_KEY_STRING,
svn_sqlite__column_text(stmt, 1, result_pool));
}
SVN_ERR(svn_sqlite__reset(stmt));
- if (cwcb->depth == svn_depth_empty)
+ if (depth == svn_depth_empty)
return SVN_NO_ERROR;
/* Now fetch information for children or all descendants */
- if (cwcb->depth == svn_depth_files
- || cwcb->depth == svn_depth_immediates)
+ if (depth == svn_depth_files
+ || depth == svn_depth_immediates)
{
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_IPROPS_CHILDREN));
@@ -9421,7 +9248,7 @@ get_children_with_cached_iprops(void *ba
const char *abspath_with_cache = svn_dirent_join(wcroot->abspath,
relpath_with_cache,
result_pool);
- apr_hash_set(iprop_paths, abspath_with_cache, APR_HASH_KEY_STRING,
+ apr_hash_set(*iprop_paths, abspath_with_cache, APR_HASH_KEY_STRING,
svn_sqlite__column_text(stmt, 1, result_pool));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
@@ -9429,12 +9256,12 @@ get_children_with_cached_iprops(void *ba
SVN_ERR(svn_sqlite__reset(stmt));
/* For depth files we should filter non files */
- if (cwcb->depth == svn_depth_files)
+ if (depth == svn_depth_files)
{
apr_hash_index_t *hi;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- for (hi = apr_hash_first(scratch_pool, iprop_paths);
+ for (hi = apr_hash_first(scratch_pool, *iprop_paths);
hi;
hi = apr_hash_next(hi))
{
@@ -9463,7 +9290,7 @@ get_children_with_cached_iprops(void *ba
/* Filter if not a file */
if (child_kind != svn_kind_file)
{
- apr_hash_set(iprop_paths, child_abspath, APR_HASH_KEY_STRING,
+ apr_hash_set(*iprop_paths, child_abspath, APR_HASH_KEY_STRING,
NULL);
}
}
@@ -9484,7 +9311,6 @@ svn_wc__db_get_children_with_cached_ipro
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct get_children_with_cached_baton_t cwcb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -9493,15 +9319,11 @@ svn_wc__db_get_children_with_cached_ipro
scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- cwcb.iprop_paths = apr_hash_make(result_pool);
- cwcb.depth = depth;
- cwcb.result_pool = result_pool;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath,
- get_children_with_cached_iprops, &cwcb,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ get_children_with_cached_iprops(iprop_paths, wcroot, local_relpath,
+ depth, result_pool, scratch_pool),
+ wcroot);
- *iprop_paths = cwcb.iprop_paths;
return SVN_NO_ERROR;
}
@@ -9526,31 +9348,23 @@ svn_wc__db_read_children_of_working_node
result_pool, scratch_pool);
}
-/* Baton for passing args to check_replace_txn(). */
-struct check_replace_baton
-{
- svn_boolean_t *is_replace_root_p;
- svn_boolean_t *base_replace_p;
- svn_boolean_t *is_replace_p;
-};
-
/* Helper for svn_wc__db_node_check_replace().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-check_replace_txn(void *baton,
+check_replace_txn(svn_boolean_t *is_replace_root_p,
+ svn_boolean_t *base_replace_p,
+ svn_boolean_t *is_replace_p,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
apr_pool_t *scratch_pool)
{
- struct check_replace_baton *crb = baton;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
svn_boolean_t is_replace = FALSE;
int replaced_op_depth;
svn_wc__db_status_t replaced_status;
- /* Our caller initialized the output values in crb to FALSE */
+ /* Our caller initialized the output values to FALSE */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_NODE_INFO));
@@ -9591,13 +9405,13 @@ check_replace_txn(void *baton,
&& replaced_status != svn_wc__db_status_base_deleted)
{
is_replace = TRUE;
- if (crb->is_replace_p)
- *crb->is_replace_p = TRUE;
+ if (is_replace_p)
+ *is_replace_p = TRUE;
}
replaced_op_depth = svn_sqlite__column_int(stmt, 0);
- if (crb->base_replace_p)
+ if (base_replace_p)
{
int op_depth = svn_sqlite__column_int(stmt, 0);
@@ -9615,13 +9429,13 @@ check_replace_txn(void *baton,
base_status = svn_sqlite__column_token(stmt, 3, presence_map);
- *crb->base_replace_p = (base_status != svn_wc__db_status_not_present);
+ *base_replace_p = (base_status != svn_wc__db_status_not_present);
}
}
SVN_ERR(svn_sqlite__reset(stmt));
- if (!crb->is_replace_root_p || !is_replace)
+ if (!is_replace_root_p || !is_replace)
return SVN_NO_ERROR;
if (replaced_status != svn_wc__db_status_base_deleted)
@@ -9642,7 +9456,7 @@ check_replace_txn(void *baton,
{
/* Did we replace inside our directory? */
- *crb->is_replace_root_p = (parent_op_depth == replaced_op_depth);
+ *is_replace_root_p = (parent_op_depth == replaced_op_depth);
SVN_ERR(svn_sqlite__reset(stmt));
return SVN_NO_ERROR;
}
@@ -9655,9 +9469,9 @@ check_replace_txn(void *baton,
SVN_ERR(svn_sqlite__reset(stmt));
if (!have_row)
- *crb->is_replace_root_p = TRUE; /* Parent is no replacement */
+ *is_replace_root_p = TRUE; /* Parent is no replacement */
else if (parent_op_depth < replaced_op_depth)
- *crb->is_replace_root_p = TRUE; /* Parent replaces a lower layer */
+ *is_replace_root_p = TRUE; /* Parent replaces a lower layer */
/*else // No replacement root */
}
@@ -9674,7 +9488,6 @@ svn_wc__db_node_check_replace(svn_boolea
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct check_replace_baton crb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -9693,12 +9506,10 @@ svn_wc__db_node_check_replace(svn_boolea
if (local_relpath[0] == '\0')
return SVN_NO_ERROR; /* Working copy root can't be replaced */
- crb.is_replace_root_p = is_replace_root;
- crb.base_replace_p = base_replace;
- crb.is_replace_p = is_replace;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, check_replace_txn, &crb,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ check_replace_txn(is_replace_root, base_replace, is_replace,
+ wcroot, local_relpath, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -9725,23 +9536,16 @@ svn_wc__db_read_children(const apr_array
}
-struct relocate_baton_t
-{
- const char *repos_root_url;
- const char *repos_uuid;
- svn_boolean_t have_base_node;
- apr_int64_t old_repos_id;
-};
-
-
/* */
static svn_error_t *
-relocate_txn(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+relocate_txn(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_boolean_t have_base_node,
+ apr_int64_t old_repos_id,
apr_pool_t *scratch_pool)
{
- struct relocate_baton_t *rb = baton;
svn_sqlite__stmt_t *stmt;
apr_int64_t new_repos_id;
@@ -9753,22 +9557,22 @@ relocate_txn(void *baton,
*/
/* Get the repos_id for the new repository. */
- SVN_ERR(create_repos_id(&new_repos_id, rb->repos_root_url, rb->repos_uuid,
+ SVN_ERR(create_repos_id(&new_repos_id, repos_root_url, repos_uuid,
wcroot->sdb, scratch_pool));
/* Set the (base and working) repos_ids and clear the dav_caches */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_RECURSIVE_UPDATE_NODE_REPO));
SVN_ERR(svn_sqlite__bindf(stmt, "isii", wcroot->wc_id, local_relpath,
- rb->old_repos_id, new_repos_id));
+ old_repos_id, new_repos_id));
SVN_ERR(svn_sqlite__step_done(stmt));
- if (rb->have_base_node)
+ if (have_base_node)
{
/* Update any locks for the root or its children. */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_UPDATE_LOCK_REPOS_ID));
- SVN_ERR(svn_sqlite__bindf(stmt, "ii", rb->old_repos_id, new_repos_id));
+ SVN_ERR(svn_sqlite__bindf(stmt, "ii", old_repos_id, new_repos_id));
SVN_ERR(svn_sqlite__step_done(stmt));
}
@@ -9786,7 +9590,9 @@ svn_wc__db_global_relocate(svn_wc__db_t
const char *local_relpath;
const char *local_dir_relpath;
svn_wc__db_status_t status;
- struct relocate_baton_t rb;
+ const char *repos_uuid;
+ svn_boolean_t have_base_node;
+ apr_int64_t old_repos_id;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_dir_abspath));
/* ### assert that we were passed a directory? */
@@ -9797,11 +9603,11 @@ svn_wc__db_global_relocate(svn_wc__db_t
local_relpath = local_dir_relpath;
SVN_ERR(read_info(&status,
- NULL, NULL, NULL, &rb.old_repos_id,
+ NULL, NULL, NULL, &old_repos_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
- &rb.have_base_node, NULL, NULL,
+ &have_base_node, NULL, NULL,
wcroot, local_relpath,
scratch_pool, scratch_pool));
@@ -9812,7 +9618,7 @@ svn_wc__db_global_relocate(svn_wc__db_t
const char *parent_relpath = svn_relpath_dirname(local_dir_relpath,
scratch_pool);
SVN_ERR(read_info(&status,
- NULL, NULL, NULL, &rb.old_repos_id,
+ NULL, NULL, NULL, &old_repos_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL,
@@ -9822,7 +9628,7 @@ svn_wc__db_global_relocate(svn_wc__db_t
local_dir_relpath = parent_relpath;
}
- if (rb.old_repos_id == INVALID_REPOS_ID)
+ if (old_repos_id == INVALID_REPOS_ID)
{
/* Do we need to support relocating something that is
added/deleted/excluded without relocating the parent? If not
@@ -9851,28 +9657,28 @@ svn_wc__db_global_relocate(svn_wc__db_t
if (status == svn_wc__db_status_added)
{
- SVN_ERR(scan_addition(NULL, NULL, NULL, &rb.old_repos_id,
+ SVN_ERR(scan_addition(NULL, NULL, NULL, &old_repos_id,
NULL, NULL, NULL, NULL, NULL, NULL,
wcroot, local_dir_relpath,
scratch_pool, scratch_pool));
}
else
SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL, NULL,
- &rb.old_repos_id,
+ &old_repos_id,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
wcroot, local_dir_relpath,
scratch_pool, scratch_pool));
}
- SVN_ERR(fetch_repos_info(NULL, &rb.repos_uuid,
- wcroot->sdb, rb.old_repos_id, scratch_pool));
- SVN_ERR_ASSERT(rb.repos_uuid);
-
- rb.repos_root_url = repos_root_url;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, relocate_txn, &rb,
- scratch_pool));
+ SVN_ERR(fetch_repos_info(NULL, &repos_uuid,
+ wcroot->sdb, old_repos_id, scratch_pool));
+ SVN_ERR_ASSERT(repos_uuid);
+
+ SVN_WC__DB_WITH_TXN(
+ relocate_txn(wcroot, local_relpath, repos_root_url, repos_uuid,
+ have_base_node, old_repos_id, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
@@ -9983,31 +9789,23 @@ descendant_commit(svn_wc__db_wcroot_t *w
return SVN_NO_ERROR;
}
-/* Baton for passing args to commit_node(). */
-struct commit_baton_t {
- svn_revnum_t new_revision;
- svn_revnum_t changed_rev;
- apr_time_t changed_date;
- const char *changed_author;
- const svn_checksum_t *new_checksum;
- const apr_array_header_t *new_children;
- apr_hash_t *new_dav_cache;
- svn_boolean_t keep_changelist;
- svn_boolean_t no_unlock;
-
- const svn_skel_t *work_items;
-};
-
/* The body of svn_wc__db_global_commit().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-commit_node(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+commit_node(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_revnum_t new_revision,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const svn_checksum_t *new_checksum,
+ const apr_array_header_t *new_children,
+ apr_hash_t *new_dav_cache,
+ svn_boolean_t keep_changelist,
+ svn_boolean_t no_unlock,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
- struct commit_baton_t *cb = baton;
svn_sqlite__stmt_t *stmt_info;
svn_sqlite__stmt_t *stmt_act;
svn_boolean_t have_act;
@@ -10086,7 +9884,7 @@ commit_node(void *baton,
&inherited_prop_blob.len,
scratch_pool);
- if (cb->keep_changelist && have_act)
+ if (keep_changelist && have_act)
changelist = svn_sqlite__column_text(stmt_act, 0, scratch_pool);
old_presence = svn_sqlite__column_token(stmt_info, 3, presence_map);
@@ -10135,7 +9933,7 @@ commit_node(void *baton,
}
SVN_ERR(descendant_commit(wcroot, local_relpath, op_depth,
- repos_id, repos_relpath, cb->new_revision,
+ repos_id, repos_relpath, new_revision,
scratch_pool));
}
@@ -10159,18 +9957,18 @@ commit_node(void *baton,
parent_relpath,
repos_id,
repos_relpath,
- cb->new_revision,
+ new_revision,
presence_map, new_presence,
new_depth_str,
kind_map, new_kind,
- cb->changed_rev,
- cb->changed_date,
- cb->changed_author,
+ changed_rev,
+ changed_date,
+ changed_author,
prop_blob.data, prop_blob.len));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 13, cb->new_checksum,
+ SVN_ERR(svn_sqlite__bind_checksum(stmt, 13, new_checksum,
scratch_pool));
- SVN_ERR(svn_sqlite__bind_properties(stmt, 15, cb->new_dav_cache,
+ SVN_ERR(svn_sqlite__bind_properties(stmt, 15, new_dav_cache,
scratch_pool));
if (inherited_prop_blob.data != NULL)
{
@@ -10182,7 +9980,7 @@ commit_node(void *baton,
if (have_act)
{
- if (cb->keep_changelist && changelist != NULL)
+ if (keep_changelist && changelist != NULL)
{
/* The user told us to keep the changelist. Replace the row in
ACTUAL_NODE with the basic keys and the changelist. */
@@ -10211,13 +10009,13 @@ commit_node(void *baton,
/* When committing a directory, we should have its new children. */
/* ### one day. just not today. */
#if 0
- SVN_ERR_ASSERT(cb->new_children != NULL);
+ SVN_ERR_ASSERT(new_children != NULL);
#endif
/* ### process the children */
}
- if (!cb->no_unlock)
+ if (!no_unlock)
{
svn_sqlite__stmt_t *lock_stmt;
@@ -10228,7 +10026,7 @@ commit_node(void *baton,
}
/* Install any work items into the queue, as part of this transaction. */
- SVN_ERR(add_work_items(wcroot->sdb, cb->work_items, scratch_pool));
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
return SVN_NO_ERROR;
}
@@ -10251,7 +10049,6 @@ svn_wc__db_global_commit(svn_wc__db_t *d
{
const char *local_relpath;
svn_wc__db_wcroot_t *wcroot;
- struct commit_baton_t cb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(new_revision));
@@ -10261,20 +10058,12 @@ svn_wc__db_global_commit(svn_wc__db_t *d
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- cb.new_revision = new_revision;
-
- cb.changed_rev = changed_revision;
- cb.changed_date = changed_date;
- cb.changed_author = changed_author;
- cb.new_checksum = new_checksum;
- cb.new_children = new_children;
- cb.new_dav_cache = new_dav_cache;
- cb.keep_changelist = keep_changelist;
- cb.no_unlock = no_unlock;
- cb.work_items = work_items;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, commit_node, &cb,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ commit_node(wcroot, local_relpath,
+ new_revision, changed_revision, changed_date, changed_author,
+ new_checksum, new_children, new_dav_cache, keep_changelist,
+ no_unlock, work_items, scratch_pool),
+ wcroot);
/* We *totally* monkeyed the entries. Toss 'em. */
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
@@ -10283,23 +10072,6 @@ svn_wc__db_global_commit(svn_wc__db_t *d
}
-#if 0
-struct update_baton_t {
- const char *new_repos_relpath;
- svn_revnum_t new_revision;
- const apr_hash_t *new_props;
- svn_revnum_t new_changed_rev;
- apr_time_t new_changed_date;
- const char *new_changed_author;
- const apr_array_header_t *new_children;
- const svn_checksum_t *new_checksum;
- const char *new_target;
- const svn_skel_t *conflict;
- const svn_skel_t *work_items;
-};
-#endif
-
-
svn_error_t *
svn_wc__db_global_update(svn_wc__db_t *db,
const char *local_abspath,
@@ -10323,7 +10095,6 @@ svn_wc__db_global_update(svn_wc__db_t *d
#if 0
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- struct update_baton_t ub;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
/* ### allow NULL for NEW_REPOS_RELPATH to indicate "no change"? */
@@ -10345,21 +10116,13 @@ svn_wc__db_global_update(svn_wc__db_t *d
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- ub.new_repos_relpath = new_repos_relpath;
- ub.new_revision = new_revision;
- ub.new_props = new_props;
- ub.new_changed_rev = new_changed_rev;
- ub.new_changed_date = new_changed_date;
- ub.new_changed_author = new_changed_author;
- ub.new_children = new_children;
- ub.new_checksum = new_checksum;
- ub.new_target = new_target;
-
- ub.conflict = conflict;
- ub.work_items = work_items;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, update_node, &ub,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ update_node(wcroot, local_relpath,
+ new_repos_relpath, new_revision, new_props,
+ new_changed_rev, new_changed_date, new_changed_author,
+ new_children, new_checksum, new_target,
+ conflict, work_items, scratch_pool),
+ wcroot);
/* We *totally* monkeyed the entries. Toss 'em. */
SVN_ERR(flush_entries(wcroot, local_abspath, scratch_pool));
@@ -10500,15 +10263,9 @@ bump_node_revision(svn_wc__db_wcroot_t *
|| (status == svn_wc__db_status_server_excluded &&
revision != new_rev)))
{
- struct base_remove_baton rb;
- rb.db = db;
- rb.keep_as_working = FALSE;
- rb.not_present_revision = SVN_INVALID_REVNUM;
- rb.conflict = NULL;
- rb.work_items = NULL;
-
- return svn_error_trace(db_base_remove(&rb, wcroot, local_relpath,
- scratch_pool));
+ return svn_error_trace(db_base_remove(wcroot, local_relpath,
+ db, FALSE, SVN_INVALID_REVNUM,
+ NULL, NULL, scratch_pool));
}
if (new_repos_relpath != NULL && strcmp(repos_relpath, new_repos_relpath))
@@ -10582,29 +10339,21 @@ bump_node_revision(svn_wc__db_wcroot_t *
return SVN_NO_ERROR;
}
-/* Baton for passing args to bump_revisions_post_update(). */
-struct bump_revisions_baton_t
-{
- svn_depth_t depth;
- const char *new_repos_relpath;
- const char *new_repos_root_url;
- const char *new_repos_uuid;
- svn_revnum_t new_revision;
- apr_hash_t *exclude_relpaths;
- apr_hash_t *wcroot_iprops;
- svn_wc__db_t *db;
-};
-
/* Helper for svn_wc__db_op_bump_revisions_post_update().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-bump_revisions_post_update(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+bump_revisions_post_update(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_wc__db_t *db,
+ svn_depth_t depth,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
+ svn_revnum_t new_revision,
+ apr_hash_t *exclude_relpaths,
+ apr_hash_t *wcroot_iprops,
apr_pool_t *scratch_pool)
{
- struct bump_revisions_baton_t *brb = baton;
svn_wc__db_status_t status;
svn_kind_t kind;
svn_error_t *err;
@@ -10635,16 +10384,16 @@ bump_revisions_post_update(void *baton,
break;
}
- if (brb->new_repos_root_url != NULL)
- SVN_ERR(create_repos_id(&new_repos_id, brb->new_repos_root_url,
- brb->new_repos_uuid,
+ if (new_repos_root_url != NULL)
+ SVN_ERR(create_repos_id(&new_repos_id, new_repos_root_url,
+ new_repos_uuid,
wcroot->sdb, scratch_pool));
SVN_ERR(bump_node_revision(wcroot, local_relpath, new_repos_id,
- brb->new_repos_relpath, brb->new_revision,
- brb->depth, brb->exclude_relpaths,
- brb->wcroot_iprops,
- TRUE /* is_root */, FALSE, brb->db,
+ new_repos_relpath, new_revision,
+ depth, exclude_relpaths,
+ wcroot_iprops,
+ TRUE /* is_root */, FALSE, db,
scratch_pool));
return SVN_NO_ERROR;
@@ -10664,7 +10413,6 @@ svn_wc__db_op_bump_revisions_post_update
{
const char *local_relpath;
svn_wc__db_wcroot_t *wcroot;
- struct bump_revisions_baton_t brb;
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
local_abspath, scratch_pool, scratch_pool));
@@ -10677,31 +10425,24 @@ svn_wc__db_op_bump_revisions_post_update
if (depth == svn_depth_unknown)
depth = svn_depth_infinity;
- brb.depth = depth;
- brb.new_repos_relpath = new_repos_relpath;
- brb.new_repos_root_url = new_repos_root_url;
- brb.new_repos_uuid = new_repos_uuid;
- brb.new_revision = new_revision;
- brb.exclude_relpaths = exclude_relpaths;
- brb.wcroot_iprops = wcroot_iprops;
- brb.db = db;
-
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath,
- bump_revisions_post_update, &brb, scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ bump_revisions_post_update(wcroot, local_relpath, db,
+ depth, new_repos_relpath, new_repos_root_url,
+ new_repos_uuid, new_revision,
+ exclude_relpaths, wcroot_iprops, scratch_pool),
+ wcroot);
return SVN_NO_ERROR;
}
-/* The body of svn_wc__db_lock_add(). BATON is the lock.
- *
- * Implements svn_wc__db_txn_callback_t. */
+/* The body of svn_wc__db_lock_add().
+ */
static svn_error_t *
-lock_add_txn(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+lock_add_txn(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ const svn_wc__db_lock_t *lock,
apr_pool_t *scratch_pool)
{
- const svn_wc__db_lock_t *lock = baton;
svn_sqlite__stmt_t *stmt;
const char *repos_relpath;
apr_int64_t repos_id;
@@ -10748,8 +10489,9 @@ svn_wc__db_lock_add(svn_wc__db_t *db,
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, lock_add_txn,
- (void *) lock, scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ lock_add_txn(wcroot, local_relpath, lock, scratch_pool),
+ wcroot);
/* There may be some entries, and the lock info is now out of date. */
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
@@ -10758,12 +10500,10 @@ svn_wc__db_lock_add(svn_wc__db_t *db,
}
-/* The body of svn_wc__db_lock_remove(). BATON is unused.
- *
- * Implements svn_wc__db_txn_callback_t. */
+/* The body of svn_wc__db_lock_remove().
+ */
static svn_error_t *
-lock_remove_txn(void *baton,
- svn_wc__db_wcroot_t *wcroot,
+lock_remove_txn(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
apr_pool_t *scratch_pool)
{
@@ -10802,8 +10542,9 @@ svn_wc__db_lock_remove(svn_wc__db_t *db,
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, lock_remove_txn, NULL,
- scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ lock_remove_txn(wcroot, local_relpath, scratch_pool),
+ wcroot);
/* There may be some entries, and the lock info is now out of date. */
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
@@ -10951,53 +10692,45 @@ get_moved_from_info(svn_wc__db_status_t
return SVN_NO_ERROR;
}
-/* Baton for passing args to scan_addition_txn(). */
-struct scan_addition_baton_t
-{
- svn_wc__db_status_t *status;
- const char **op_root_relpath;
- const char **repos_relpath;
- apr_int64_t *repos_id;
- const char **original_repos_relpath;
- apr_int64_t *original_repos_id;
- svn_revnum_t *original_revision;
- const char **moved_from_relpath;
- const char **moved_from_op_root_relpath;
- int *moved_from_op_depth;
- apr_pool_t *result_pool;
-};
-
/* The body of scan_addition().
- *
- * Implements svn_wc__db_txn_callback_t. */
+ */
static svn_error_t *
-scan_addition_txn(void *baton,
+scan_addition_txn(svn_wc__db_status_t *status,
+ const char **op_root_relpath_p,
+ const char **repos_relpath,
+ apr_int64_t *repos_id,
+ const char **original_repos_relpath,
+ apr_int64_t *original_repos_id,
+ svn_revnum_t *original_revision,
+ const char **moved_from_relpath,
+ const char **moved_from_op_root_relpath,
+ int *moved_from_op_depth,
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct scan_addition_baton_t *sab = baton;
- const char *op_root_relpath = local_relpath;
+ const char *op_root_relpath;
const char *build_relpath = "";
/* Initialize most of the OUT parameters. Generally, we'll only be filling
in a subset of these, so it is easier to init all up front. Note that
the STATUS parameter will be initialized once we read the status of
the specified node. */
- if (sab->op_root_relpath)
- *sab->op_root_relpath = NULL;
- if (sab->original_repos_relpath)
- *sab->original_repos_relpath = NULL;
- if (sab->original_repos_id)
- *sab->original_repos_id = INVALID_REPOS_ID;
- if (sab->original_revision)
- *sab->original_revision = SVN_INVALID_REVNUM;
- if (sab->moved_from_relpath)
- *sab->moved_from_relpath = NULL;
- if (sab->moved_from_op_root_relpath)
- *sab->moved_from_op_root_relpath = NULL;
- if (sab->moved_from_op_depth)
- *sab->moved_from_op_depth = 0;
+ if (op_root_relpath_p)
+ *op_root_relpath_p = NULL;
+ if (original_repos_relpath)
+ *original_repos_relpath = NULL;
+ if (original_repos_id)
+ *original_repos_id = INVALID_REPOS_ID;
+ if (original_revision)
+ *original_revision = SVN_INVALID_REVNUM;
+ if (moved_from_relpath)
+ *moved_from_relpath = NULL;
+ if (moved_from_op_root_relpath)
+ *moved_from_op_root_relpath = NULL;
+ if (moved_from_op_depth)
+ *moved_from_op_depth = 0;
{
svn_sqlite__stmt_t *stmt;
@@ -11040,16 +10773,16 @@ scan_addition_txn(void *baton,
local_relpath,
scratch_pool));
- if (sab->original_revision)
- *sab->original_revision = svn_sqlite__column_revnum(stmt, 12);
+ if (original_revision)
+ *original_revision = svn_sqlite__column_revnum(stmt, 12);
/* Provide the default status; we'll override as appropriate. */
- if (sab->status)
+ if (status)
{
if (presence == svn_wc__db_status_normal)
- *sab->status = svn_wc__db_status_added;
+ *status = svn_wc__db_status_added;
else
- *sab->status = svn_wc__db_status_incomplete;
+ *status = svn_wc__db_status_incomplete;
}
@@ -11066,19 +10799,19 @@ scan_addition_txn(void *baton,
op_root_relpath = svn_relpath_dirname(op_root_relpath, scratch_pool);
}
- if (sab->op_root_relpath)
- *sab->op_root_relpath = apr_pstrdup(sab->result_pool, op_root_relpath);
+ if (op_root_relpath_p)
+ *op_root_relpath_p = apr_pstrdup(result_pool, op_root_relpath);
/* ### This if-statement is quite redundant.
* ### We're checking all these values again within the body anyway.
* ### The body should be broken up appropriately and move into the
* ### outer scope. */
- if (sab->original_repos_relpath
- || sab->original_repos_id
- || (sab->original_revision
- && *sab->original_revision == SVN_INVALID_REVNUM)
- || sab->status
- || sab->moved_from_relpath || sab->moved_from_op_root_relpath)
+ if (original_repos_relpath
+ || original_repos_id
+ || (original_revision
+ && *original_revision == SVN_INVALID_REVNUM)
+ || status
+ || moved_from_relpath || moved_from_op_root_relpath)
{
if (local_relpath != op_root_relpath)
/* requery to get the add/copy root */
@@ -11102,39 +10835,39 @@ scan_addition_txn(void *baton,
scratch_pool));
}
- if (sab->original_revision
- && *sab->original_revision == SVN_INVALID_REVNUM)
- *sab->original_revision = svn_sqlite__column_revnum(stmt, 12);
+ if (original_revision
+ && *original_revision == SVN_INVALID_REVNUM)
+ *original_revision = svn_sqlite__column_revnum(stmt, 12);
}
- if (sab->original_repos_relpath)
- *sab->original_repos_relpath = svn_sqlite__column_text(stmt, 11,
- sab->result_pool);
+ if (original_repos_relpath)
+ *original_repos_relpath = svn_sqlite__column_text(stmt, 11,
+ result_pool);
if (!svn_sqlite__column_is_null(stmt, 10)
- && (sab->status
- || sab->original_repos_id
- || sab->moved_from_relpath || sab->moved_from_op_root_relpath))
+ && (status
+ || original_repos_id
+ || moved_from_relpath || moved_from_op_root_relpath))
/* If column 10 (original_repos_id) is NULL,
this is a plain add, not a copy or a move */
{
- if (sab->original_repos_id)
- *sab->original_repos_id = svn_sqlite__column_int64(stmt, 10);
+ if (original_repos_id)
+ *original_repos_id = svn_sqlite__column_int64(stmt, 10);
- if (sab->status ||
- sab->moved_from_relpath || sab->moved_from_op_root_relpath)
+ if (status ||
+ moved_from_relpath || moved_from_op_root_relpath)
{
if (svn_sqlite__column_boolean(stmt, 13 /* moved_here */))
- SVN_ERR(get_moved_from_info(sab->status,
- sab->moved_from_relpath,
- sab->moved_from_op_root_relpath,
+ SVN_ERR(get_moved_from_info(status,
+ moved_from_relpath,
+ moved_from_op_root_relpath,
op_root_relpath,
- sab->moved_from_op_depth,
+ moved_from_op_depth,
wcroot, local_relpath,
- sab->result_pool,
+ result_pool,
scratch_pool));
- else if (sab->status)
- *sab->status = svn_wc__db_status_copied;
+ else if (status)
+ *status = svn_wc__db_status_copied;
}
}
}
@@ -11187,50 +10920,50 @@ scan_addition_txn(void *baton,
CURRENT_ABSPATH now points to a BASE node. Figure out the repository
information for the current node, and use that to compute the start
node's repository information. */
- if (sab->repos_relpath || sab->repos_id)
+ if (repos_relpath || repos_id)
{
const char *base_relpath;
SVN_ERR(svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
- &base_relpath, sab->repos_id,
+ &base_relpath, repos_id,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
wcroot, op_root_relpath,
scratch_pool, scratch_pool));
- if (sab->repos_relpath)
- *sab->repos_relpath = svn_relpath_join(base_relpath, build_relpath,
- sab->result_pool);
+ if (repos_relpath)
+ *repos_relpath = svn_relpath_join(base_relpath, build_relpath,
+ result_pool);
}
/* Postconditions */
#ifdef SVN_DEBUG
- if (sab->status)
+ if (status)
{
- SVN_ERR_ASSERT(*sab->status == svn_wc__db_status_added
- || *sab->status == svn_wc__db_status_copied
- || *sab->status == svn_wc__db_status_incomplete
- || *sab->status == svn_wc__db_status_moved_here);
- if (*sab->status == svn_wc__db_status_added)
- {
- SVN_ERR_ASSERT(!sab->original_repos_relpath
- || *sab->original_repos_relpath == NULL);
- SVN_ERR_ASSERT(!sab->original_revision
- || *sab->original_revision == SVN_INVALID_REVNUM);
- SVN_ERR_ASSERT(!sab->original_repos_id
- || *sab->original_repos_id == INVALID_REPOS_ID);
+ SVN_ERR_ASSERT(*status == svn_wc__db_status_added
+ || *status == svn_wc__db_status_copied
+ || *status == svn_wc__db_status_incomplete
+ || *status == svn_wc__db_status_moved_here);
+ if (*status == svn_wc__db_status_added)
+ {
+ SVN_ERR_ASSERT(!original_repos_relpath
+ || *original_repos_relpath == NULL);
+ SVN_ERR_ASSERT(!original_revision
+ || *original_revision == SVN_INVALID_REVNUM);
+ SVN_ERR_ASSERT(!original_repos_id
+ || *original_repos_id == INVALID_REPOS_ID);
}
else
{
- SVN_ERR_ASSERT(!sab->original_repos_relpath
- || *sab->original_repos_relpath != NULL);
- SVN_ERR_ASSERT(!sab->original_revision
- || *sab->original_revision != SVN_INVALID_REVNUM);
- SVN_ERR_ASSERT(!sab->original_repos_id
- || *sab->original_repos_id != INVALID_REPOS_ID);
+ SVN_ERR_ASSERT(!original_repos_relpath
+ || *original_repos_relpath != NULL);
+ SVN_ERR_ASSERT(!original_revision
+ || *original_revision != SVN_INVALID_REVNUM);
+ SVN_ERR_ASSERT(!original_repos_id
+ || *original_repos_id != INVALID_REPOS_ID);
}
}
- SVN_ERR_ASSERT(!sab->op_root_relpath || *sab->op_root_relpath != NULL);
+ SVN_ERR_ASSERT(!op_root_relpath_p || *op_root_relpath_p != NULL);
#endif
return SVN_NO_ERROR;
@@ -11258,23 +10991,14 @@ scan_addition(svn_wc__db_status_t *statu
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- struct scan_addition_baton_t sab;
-
- sab.status = status;
- sab.op_root_relpath = op_root_relpath;
- sab.repos_relpath = repos_relpath;
- sab.repos_id = repos_id;
- sab.original_repos_relpath = original_repos_relpath;
- sab.original_repos_id = original_repos_id;
- sab.original_revision = original_revision;
- sab.moved_from_relpath = moved_from_relpath;
- sab.moved_from_op_root_relpath = moved_from_op_root_relpath;
- sab.moved_from_op_depth = moved_from_op_depth;
- sab.result_pool = result_pool;
-
- return svn_error_trace(svn_wc__db_with_txn(wcroot, local_relpath,
- scan_addition_txn,
- &sab, scratch_pool));
+ SVN_WC__DB_WITH_TXN(
+ scan_addition_txn(status, op_root_relpath, repos_relpath, repos_id,
+ original_repos_relpath, original_repos_id,
+ original_revision, moved_from_relpath,
+ moved_from_op_root_relpath, moved_from_op_depth,
+ wcroot, local_relpath, result_pool, scratch_pool),
+ wcroot);
+ return SVN_NO_ERROR;
}
@@ -11527,24 +11251,17 @@ svn_wc__db_follow_moved_to(apr_array_hea
return SVN_NO_ERROR;
}
-struct scan_deletion_baton_t
-{
- const char **base_del_relpath;
- const char **moved_to_relpath;
- const char **work_del_relpath;
- const char **moved_to_op_root_relpath;
- apr_pool_t *result_pool;
-};
-
[... 965 lines stripped ...]