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 2012/05/12 23:29:32 UTC
svn commit: r1337692 - in /subversion/trunk/subversion/libsvn_wc:
conflicts.c wc_db.c wc_db.h
Author: rhuijben
Date: Sat May 12 21:29:32 2012
New Revision: 1337692
URL: http://svn.apache.org/viewvc?rev=1337692&view=rev
Log:
Extend svn_wc__db_op_mark_resolved() to work as an atomic operation. Enable
resolving tree conflicts and allow adding work items. Remove unneeded records.
* subversion/libsvn_wc/conflicts.c
(resolve_conflict_on_node): Update caller.
* subversion/libsvn_wc/wc_db.c
(op_mark_resolved_baton): New struct.
(db_op_mark_resolved): New function, extracted from...
(svn_wc__db_op_mark_resolved): ... this function, which now uses a wc
transaction and removes no longer needed ACTUAL records.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_op_mark_resolved): Update prototype.
Modified:
subversion/trunk/subversion/libsvn_wc/conflicts.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1337692&r1=1337691&r2=1337692&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Sat May 12 21:29:32 2012
@@ -295,10 +295,9 @@ resolve_conflict_on_node(svn_wc__db_t *d
if (resolve_text || resolve_props)
{
- SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_items, pool));
SVN_ERR(svn_wc__db_op_mark_resolved(db, local_abspath,
resolve_text, resolve_props,
- FALSE, pool));
+ FALSE, work_items, pool));
SVN_ERR(svn_wc__wq_run(db, local_abspath,
NULL, NULL, /* cancellation */
pool));
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1337692&r1=1337691&r2=1337692&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat May 12 21:29:32 2012
@@ -5176,6 +5176,66 @@ svn_wc__db_op_mark_conflict(svn_wc__db_t
NOT_IMPLEMENTED();
}
+/* Baton for 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;
+};
+
+/* Helper for svn_wc__db_op_mark_resolved */
+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)
+{
+ struct op_mark_resolved_baton *rb = baton;
+ svn_sqlite__stmt_t *stmt;
+ int affected_rows;
+ int total_affected_rows = 0;
+
+ if (rb->resolved_text)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_CLEAR_TEXT_CONFLICT));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+ total_affected_rows += affected_rows;
+ }
+ if (rb->resolved_props)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_CLEAR_PROPS_CONFLICT));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+ total_affected_rows += affected_rows;
+ }
+ if (rb->resolved_tree)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_UPDATE_ACTUAL_TREE_CONFLICTS));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+ total_affected_rows += affected_rows;
+ }
+
+ /* Now, remove the actual node if it doesn't have any more useful
+ information. We only need to do this if we've remove data ourselves. */
+ if (total_affected_rows > 0)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_ACTUAL_EMPTY));
+ 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));
+ }
+
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_wc__db_op_mark_resolved(svn_wc__db_t *db,
@@ -5183,11 +5243,12 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
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)
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
- svn_sqlite__stmt_t *stmt;
+ struct op_mark_resolved_baton rb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -5198,33 +5259,18 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
local_abspath, scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- /* ### these two statements are not transacted together. is this a
- ### problem? I suspect a failure simply leaves the other in a
- ### continued, unresolved state. However, that still retains
- ### "integrity", so another re-run by the user will fix it. */
+ rb.resolved_props = resolved_props;
+ rb.resolved_text = resolved_text;
+ rb.resolved_tree = resolved_tree;
+ rb.work_items = work_items;
- if (resolved_text)
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_CLEAR_TEXT_CONFLICT));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
- if (resolved_props)
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_CLEAR_PROPS_CONFLICT));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
+ SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_op_mark_resolved,
+ &rb, scratch_pool));
- /* Some entries have cached the above values. Kapow!! */
SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
-
return SVN_NO_ERROR;
}
-
/* */
static svn_error_t *
set_tc_txn(void *baton,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1337692&r1=1337691&r2=1337692&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat May 12 21:29:32 2012
@@ -1507,6 +1507,7 @@ svn_wc__db_op_mark_resolved(svn_wc__db_t
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);
Re: svn commit: r1337692 - in /subversion/trunk/subversion/libsvn_wc:
conflicts.c wc_db.c wc_db.h
Posted by Greg Stein <gs...@gmail.com>.
On May 12, 2012 11:29 AM, <rh...@apache.org> wrote:
>...
> + if (total_affected_rows > 0)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
> + STMT_DELETE_ACTUAL_EMPTY));
> + 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));
> + }
Shouldn't adding work be unconditional?