You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/06/11 11:11:15 UTC
svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc: merge.c
props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Author: rhuijben
Date: Fri Jun 11 09:11:14 2010
New Revision: 953617
URL: http://svn.apache.org/viewvc?rev=953617&view=rev
Log:
Update the installing of the location of conflict markers to use a
temporary working queue operation and wc-db operations instead of
loggy entry modify.
This removes the last entry modify operations and the last entry
write operations on text/property conflict data. This support will
be removed in a few follow up commits.
* subversion/libsvn_wc/merge.c
(preserve_pre_merge_files,
merge_binary_file): Use new wq operation instead of loggy entry modify.
* subversion/libsvn_wc/props.c
(svn_wc__merge_props): Use new wq operation instead of loggy entry modify.
* subversion/libsvn_wc/wc-queries.sql
(STMT_UPDATE_ACTUAL_TEXT_CONFLICTS, STMT_INSERT_ACTUAL_TEXT_CONFLICTS,
STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS,
STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS): New statements.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_temp_op_set_text_conflict_marker_files,
svn_wc__db_temp_op_set_property_conflict_marker_file): New functions.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_temp_op_set_text_conflict_marker_files,
svn_wc__db_temp_op_set_property_conflict_marker_file): New functions.
* subversion/libsvn_wc/workqueue.c
(OP_TMP_SET_TEXT_CONFLICT_MARKERS, OP_TMP_SET_PROPERTY_CONFLICT_MARKER):
New defines.
(run_set_text_conflict_markers,
svn_wc__wq_tmp_build_set_text_conflict_markers,
run_set_property_conflict_marker,
svn_wc__wq_tmp_build_set_property_conflict_marker): New functions.
(dispatch_table): Add new wq operations.
* subversion/libsvn_wc/workqueue.h
(svn_wc__wq_tmp_build_set_text_conflict_markers,
svn_wc__wq_tmp_build_set_property_conflict_marker): New functions.
Modified:
subversion/trunk/subversion/libsvn_wc/merge.c
subversion/trunk/subversion/libsvn_wc/props.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/libsvn_wc/workqueue.c
subversion/trunk/subversion/libsvn_wc/workqueue.h
Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Fri Jun 11 09:11:14 2010
@@ -621,7 +621,6 @@ preserve_pre_merge_files(svn_skel_t **wo
const char *tmp_left, *tmp_right, *detranslated_target_copy;
const char *dir_abspath, *target_name;
const char *temp_dir;
- svn_wc_entry_t tmp_entry;
svn_skel_t *work_item;
*work_items = NULL;
@@ -727,18 +726,16 @@ preserve_pre_merge_files(svn_skel_t **wo
target_abspath, result_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
- tmp_entry.conflict_old = svn_dirent_is_child(dir_abspath, left_copy, pool);
- tmp_entry.conflict_new = svn_dirent_is_child(dir_abspath, right_copy, pool);
- tmp_entry.conflict_wrk = svn_dirent_basename(target_copy, pool);
-
/* Mark TARGET_ABSPATH's entry as "Conflicted", and start tracking
the backup files in the entry as well. */
- SVN_ERR(svn_wc__loggy_entry_modify(&work_item, db, dir_abspath,
- target_abspath, &tmp_entry,
- SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
- | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
- | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
- result_pool));
+ SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(
+ &work_item,
+ db, target_abspath,
+ svn_dirent_is_child(dir_abspath, left_copy, pool),
+ svn_dirent_is_child(dir_abspath, right_copy, pool),
+ svn_dirent_basename(target_copy, pool),
+ pool, pool));
+
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
return SVN_NO_ERROR;
@@ -1062,7 +1059,7 @@ merge_binary_file(svn_skel_t **work_item
const char *left_copy, *right_copy;
const char *left_base, *right_base;
const char *merge_dirpath, *merge_filename;
- svn_wc_entry_t tmp_entry;
+ const char *conflict_wrk;
svn_skel_t *work_item;
SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
@@ -1198,11 +1195,11 @@ merge_binary_file(svn_skel_t **work_item
mine_copy = svn_dirent_is_child(merge_dirpath,
mine_copy, pool);
- tmp_entry.conflict_wrk = mine_copy;
+ conflict_wrk = mine_copy;
}
else
{
- tmp_entry.conflict_wrk = NULL;
+ conflict_wrk = NULL;
}
/* Derive the basenames of the backup files. */
@@ -1211,16 +1208,14 @@ merge_binary_file(svn_skel_t **work_item
/* Mark target_abspath's entry as "Conflicted", and start tracking
the backup files in the entry as well. */
- tmp_entry.conflict_old = left_base;
- tmp_entry.conflict_new = right_base;
- SVN_ERR(svn_wc__loggy_entry_modify(
- &work_item,
- db, merge_dirpath, target_abspath,
- &tmp_entry,
- SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
- | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
- | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
- result_pool));
+ SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(&work_item,
+ db, target_abspath,
+ left_base,
+ right_base,
+ conflict_wrk,
+ result_pool,
+ scratch_pool));
+
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
*merge_outcome = svn_wc_merge_conflict; /* a conflict happened */
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Jun 11 09:11:14 2010
@@ -1985,14 +1985,14 @@ svn_wc__merge_props(svn_wc_notify_state_
/* Mark entry as "conflicted" with a particular .prej file. */
{
- svn_wc_entry_t entry;
svn_skel_t *work_item;
- entry.prejfile = svn_dirent_is_child(adm_abspath, reject_path, NULL);
- SVN_ERR(svn_wc__loggy_entry_modify(&work_item, db, adm_abspath,
- local_abspath, &entry,
- SVN_WC__ENTRY_MODIFY_PREJFILE,
- scratch_pool));
+ SVN_ERR(svn_wc__wq_tmp_build_set_property_conflict_marker(
+ &work_item,
+ db, local_abspath,
+ svn_dirent_basename(reject_path, NULL),
+ scratch_pool, scratch_pool));
+
SVN_ERR(svn_wc__db_wq_add(db, local_abspath, work_item, scratch_pool));
}
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Jun 11 09:11:14 2010
@@ -215,6 +215,29 @@ insert into actual_node (
wc_id, local_relpath, tree_conflict_data)
values (?1, ?2, ?3);
+-- STMT_UPDATE_ACTUAL_TEXT_CONFLICTS
+update actual_node set conflict_old = ?3, conflict_new = ?4,
+conflict_working = ?5
+where wc_id = ?1 and local_relpath = ?2;
+
+-- STMT_INSERT_ACTUAL_TEXT_CONFLICTS
+/* tree conflicts are always recorded on the wcroot node, so the
+ parent_relpath will be null. */
+insert into actual_node (
+ wc_id, local_relpath, conflict_old, conflict_new, conflict_working)
+values (?1, ?2, ?3, ?4, ?5);
+
+-- STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS
+update actual_node set prop_reject = ?3
+where wc_id = ?1 and local_relpath = ?2;
+
+-- STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS
+/* tree conflicts are always recorded on the wcroot node, so the
+ parent_relpath will be null. */
+insert into actual_node (
+ wc_id, local_relpath, prop_reject)
+values (?1, ?2, ?3);
+
-- STMT_UPDATE_ACTUAL_CHANGELIST
update actual_node set changelist = ?3
where wc_id = ?1 and local_relpath = ?2;
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jun 11 09:11:14 2010
@@ -8169,3 +8169,99 @@ svn_wc__db_temp_op_remove_working_stub(s
return svn_error_return(svn_sqlite__step_done(stmt));
}
+
+svn_error_t *
+svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *old_basename,
+ const char *new_basename,
+ const char *wrk_basename,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t got_row;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+ local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_SELECT_ACTUAL_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+
+ SVN_ERR(svn_sqlite__step(&got_row, stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ if (got_row)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
+ }
+ else
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
+ }
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "issss", pdh->wcroot->wc_id,
+ local_relpath,
+ old_basename,
+ new_basename,
+ wrk_basename));
+
+ return svn_error_return(svn_sqlite__step_done(stmt));
+}
+
+/* Set the conflict marker information on LOCAL_ABSPATH to the specified
+ values */
+svn_error_t *
+svn_wc__db_temp_op_set_property_conflict_marker_file(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *prej_basename,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t got_row;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+ local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_SELECT_ACTUAL_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+
+ SVN_ERR(svn_sqlite__step(&got_row, stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ if (got_row)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS));
+ }
+ else
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS));
+ }
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", pdh->wcroot->wc_id,
+ local_relpath,
+ prej_basename));
+
+ return svn_error_return(svn_sqlite__step_done(stmt));
+}
+
+
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Jun 11 09:11:14 2010
@@ -2405,6 +2405,24 @@ svn_wc__db_temp_op_remove_working_stub(s
const char *local_abspath,
apr_pool_t *scratch_pool);
+/* Set the conflict marker information on LOCAL_ABSPATH to the specified
+ values */
+svn_error_t *
+svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *old_basename,
+ const char *new_basename,
+ const char *wrk_basename,
+ apr_pool_t *scratch_pool);
+
+/* Set the conflict marker information on LOCAL_ABSPATH to the specified
+ values */
+svn_error_t *
+svn_wc__db_temp_op_set_property_conflict_marker_file(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *prej_basename,
+ 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=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri Jun 11 09:11:14 2010
@@ -65,7 +65,8 @@
#define OP_PREJ_INSTALL "prej-install"
#define OP_WRITE_OLD_PROPS "write-old-props"
#define OP_RECORD_FILEINFO "record-fileinfo"
-
+#define OP_TMP_SET_TEXT_CONFLICT_MARKERS "tmp-set-text-conflict-markers"
+#define OP_TMP_SET_PROPERTY_CONFLICT_MARKER "tmp-set-property-conflict-marker"
/* For work queue debugging. Generates output about its operation. */
/* #define DEBUG_WORK_QUEUE */
@@ -2297,6 +2298,129 @@ svn_wc__wq_build_record_fileinfo(svn_ske
return SVN_NO_ERROR;
}
+/* ------------------------------------------------------------------------ */
+
+/* OP_TMP_SET_TEXT_CONFLICT_MARKERS */
+
+
+static svn_error_t *
+run_set_text_conflict_markers(svn_wc__db_t *db,
+ const svn_skel_t *work_item,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ const svn_skel_t *arg = work_item->children->next;
+ const char *local_abspath;
+ const char *old_basename;
+ const char *new_basename;
+ const char *wrk_basename;
+
+ local_abspath = apr_pstrmemdup(scratch_pool, arg->data, arg->len);
+
+ arg = arg->next;
+ old_basename = arg->len ? apr_pstrmemdup(scratch_pool, arg->data, arg->len)
+ : NULL;
+
+ arg = arg->next;
+ new_basename = arg->len ? apr_pstrmemdup(scratch_pool, arg->data, arg->len)
+ : NULL;
+
+ arg = arg->next;
+ wrk_basename = arg->len ? apr_pstrmemdup(scratch_pool, arg->data, arg->len)
+ : NULL;
+
+ return svn_error_return(
+ svn_wc__db_temp_op_set_text_conflict_marker_files(db,
+ local_abspath,
+ old_basename,
+ new_basename,
+ wrk_basename,
+ scratch_pool));
+}
+
+
+svn_error_t *
+svn_wc__wq_tmp_build_set_text_conflict_markers(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *old_basename,
+ const char *new_basename,
+ const char *wrk_basename,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *work_item = svn_skel__make_empty_list(result_pool);
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ svn_skel__prepend_str(wrk_basename ? apr_pstrdup(result_pool, wrk_basename)
+ : "", *work_item, result_pool);
+
+ svn_skel__prepend_str(new_basename ? apr_pstrdup(result_pool, new_basename)
+ : "", *work_item, result_pool);
+
+ svn_skel__prepend_str(old_basename ? apr_pstrdup(result_pool, old_basename)
+ : "", *work_item, result_pool);
+
+ svn_skel__prepend_str(apr_pstrdup(result_pool, local_abspath),
+ *work_item, result_pool);
+ svn_skel__prepend_str(OP_TMP_SET_TEXT_CONFLICT_MARKERS, *work_item,
+ result_pool);
+
+ return SVN_NO_ERROR;
+}
+
+/* ------------------------------------------------------------------------ */
+
+/* OP_TMP_SET_PROPERTY_CONFLICT_MARKER */
+
+static svn_error_t *
+run_set_property_conflict_marker(svn_wc__db_t *db,
+ const svn_skel_t *work_item,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ const svn_skel_t *arg = work_item->children->next;
+ const char *local_abspath;
+ const char *prej_basename;
+
+ local_abspath = apr_pstrmemdup(scratch_pool, arg->data, arg->len);
+
+ arg = arg->next;
+ prej_basename = arg->len ? apr_pstrmemdup(scratch_pool, arg->data, arg->len)
+ : NULL;
+
+ return svn_error_return(
+ svn_wc__db_temp_op_set_property_conflict_marker_file(db,
+ local_abspath,
+ prej_basename,
+ scratch_pool));
+}
+
+svn_error_t *
+svn_wc__wq_tmp_build_set_property_conflict_marker(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *prej_basename,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *work_item = svn_skel__make_empty_list(result_pool);
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ svn_skel__prepend_str(prej_basename ? apr_pstrdup(result_pool, prej_basename)
+ : "", *work_item, result_pool);
+
+ svn_skel__prepend_str(apr_pstrdup(result_pool, local_abspath),
+ *work_item, result_pool);
+ svn_skel__prepend_str(OP_TMP_SET_PROPERTY_CONFLICT_MARKER, *work_item,
+ result_pool);
+
+ return SVN_NO_ERROR;
+}
/* ------------------------------------------------------------------------ */
@@ -2314,6 +2438,8 @@ static const struct work_item_dispatch d
{ OP_PREJ_INSTALL, run_prej_install },
{ OP_WRITE_OLD_PROPS, run_write_old_props },
{ OP_RECORD_FILEINFO, run_record_fileinfo },
+ { OP_TMP_SET_TEXT_CONFLICT_MARKERS, run_set_text_conflict_markers },
+ { OP_TMP_SET_PROPERTY_CONFLICT_MARKER, run_set_property_conflict_marker },
/* See props.h */
#ifdef SVN__SUPPORT_BASE_MERGE
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.h?rev=953617&r1=953616&r2=953617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.h Fri Jun 11 09:11:14 2010
@@ -214,6 +214,46 @@ svn_wc__wq_build_loggy(svn_skel_t **work
apr_pool_t *result_pool);
+/* ### Temporary helper to store text conflict marker locations as a wq
+ ### operation. Eventually the data must be stored in the pristine store+db
+ ### before the wq runs (within the operation transaction) and then a wq
+ ### operation will create the markers.
+
+ Set *WORK_ITEM to a new work item that sets the conflict marker values
+ on ACTUAL_NODE to the passed values or to NULL if NULL is passed.
+
+ Allocate the result in RESULT_POOL and perform temporary allocations
+ in SCRATCH_POOL
+*/
+svn_error_t *
+svn_wc__wq_tmp_build_set_text_conflict_markers(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *old_basename,
+ const char *new_basename,
+ const char *wrk_basename,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/* ### Temporary helper to store the property conflict marker location as a wq
+ ### operation. Eventually the data must be stored in the pristine store+db
+ ### before the wq runs (within the operation transaction) and then a wq
+ ### operation will create the marker.
+
+ Set *WORK_ITEM to a new work item that sets the conflict marker values
+ on ACTUAL_NODE to the passed values or to NULL if NULL is passed.
+
+ Allocate the result in RESULT_POOL and perform temporary allocations
+ in SCRATCH_POOL
+*/
+svn_error_t *
+svn_wc__wq_tmp_build_set_property_conflict_marker(svn_skel_t **work_item,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *prej_basename,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
svn_error_t *
svn_wc__wq_add_deletion_postcommit(svn_wc__db_t *db,
const char *local_abspath,
Re: svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc:
merge.c props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Posted by Greg Stein <gs...@gmail.com>.
On Fri, Jun 11, 2010 at 05:11, <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/merge.c Fri Jun 11 09:11:14 2010
>...
> @@ -727,18 +726,16 @@ preserve_pre_merge_files(svn_skel_t **wo
> target_abspath, result_pool));
> *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
>
> - tmp_entry.conflict_old = svn_dirent_is_child(dir_abspath, left_copy, pool);
> - tmp_entry.conflict_new = svn_dirent_is_child(dir_abspath, right_copy, pool);
> - tmp_entry.conflict_wrk = svn_dirent_basename(target_copy, pool);
> -
> /* Mark TARGET_ABSPATH's entry as "Conflicted", and start tracking
> the backup files in the entry as well. */
> - SVN_ERR(svn_wc__loggy_entry_modify(&work_item, db, dir_abspath,
> - target_abspath, &tmp_entry,
> - SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
> - | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
> - | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
> - result_pool));
> + SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(
> + &work_item,
> + db, target_abspath,
> + svn_dirent_is_child(dir_abspath, left_copy, pool),
> + svn_dirent_is_child(dir_abspath, right_copy, pool),
> + svn_dirent_basename(target_copy, pool),
> + pool, pool));
result_pool, scratch_pool
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Jun 11 09:11:14 2010
> @@ -215,6 +215,29 @@ insert into actual_node (
> wc_id, local_relpath, tree_conflict_data)
> values (?1, ?2, ?3);
>
> +-- STMT_UPDATE_ACTUAL_TEXT_CONFLICTS
> +update actual_node set conflict_old = ?3, conflict_new = ?4,
> +conflict_working = ?5
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_INSERT_ACTUAL_TEXT_CONFLICTS
> +/* tree conflicts are always recorded on the wcroot node, so the
> + parent_relpath will be null. */
> +insert into actual_node (
> + wc_id, local_relpath, conflict_old, conflict_new, conflict_working)
> +values (?1, ?2, ?3, ?4, ?5);
tree conflicts, yes. but these are NOT tree conflicts. the
parent_relpath may need to be "" instead of null.
> +
> +-- STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS
> +update actual_node set prop_reject = ?3
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS
> +/* tree conflicts are always recorded on the wcroot node, so the
> + parent_relpath will be null. */
> +insert into actual_node (
> + wc_id, local_relpath, prop_reject)
> +values (?1, ?2, ?3);
same
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jun 11 09:11:14 2010
> @@ -8169,3 +8169,99 @@ svn_wc__db_temp_op_remove_working_stub(s
>
> return svn_error_return(svn_sqlite__step_done(stmt));
> }
> +
> +svn_error_t *
> +svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t *db,
> + const char *local_abspath,
> + const char *old_basename,
> + const char *new_basename,
> + const char *wrk_basename,
> + apr_pool_t *scratch_pool)
> +{
> + svn_wc__db_pdh_t *pdh;
> + const char *local_relpath;
> + svn_sqlite__stmt_t *stmt;
> + svn_boolean_t got_row;
> +
> + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> +
> + SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
> + local_abspath,
> + svn_sqlite__mode_readwrite,
> + scratch_pool, scratch_pool));
> + VERIFY_USABLE_PDH(pdh);
> +
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_SELECT_ACTUAL_NODE));
> + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
> +
> + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> + SVN_ERR(svn_sqlite__reset(stmt));
> +
> + if (got_row)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
> + }
> + else
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
> + }
there should be a comment in here somewhere that these two statements
"should" be in a transaction, but we're keeping it simple since they
are temporary operations.
>...
> + svn_sqlite__mode_readwrite,
> + scratch_pool, scratch_pool));
> + VERIFY_USABLE_PDH(pdh);
> +
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_SELECT_ACTUAL_NODE));
> + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
> +
> + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> + SVN_ERR(svn_sqlite__reset(stmt));
> +
> + if (got_row)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS));
> + }
> + else
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS));
> + }
Same, re: transaction.
>...
Cheers,
-g
Re: svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc:
merge.c props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Posted by Greg Stein <gs...@gmail.com>.
On Fri, Jun 11, 2010 at 05:11, <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/merge.c Fri Jun 11 09:11:14 2010
>...
> @@ -727,18 +726,16 @@ preserve_pre_merge_files(svn_skel_t **wo
> target_abspath, result_pool));
> *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
>
> - tmp_entry.conflict_old = svn_dirent_is_child(dir_abspath, left_copy, pool);
> - tmp_entry.conflict_new = svn_dirent_is_child(dir_abspath, right_copy, pool);
> - tmp_entry.conflict_wrk = svn_dirent_basename(target_copy, pool);
> -
> /* Mark TARGET_ABSPATH's entry as "Conflicted", and start tracking
> the backup files in the entry as well. */
> - SVN_ERR(svn_wc__loggy_entry_modify(&work_item, db, dir_abspath,
> - target_abspath, &tmp_entry,
> - SVN_WC__ENTRY_MODIFY_CONFLICT_OLD
> - | SVN_WC__ENTRY_MODIFY_CONFLICT_NEW
> - | SVN_WC__ENTRY_MODIFY_CONFLICT_WRK,
> - result_pool));
> + SVN_ERR(svn_wc__wq_tmp_build_set_text_conflict_markers(
> + &work_item,
> + db, target_abspath,
> + svn_dirent_is_child(dir_abspath, left_copy, pool),
> + svn_dirent_is_child(dir_abspath, right_copy, pool),
> + svn_dirent_basename(target_copy, pool),
> + pool, pool));
result_pool, scratch_pool
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Jun 11 09:11:14 2010
> @@ -215,6 +215,29 @@ insert into actual_node (
> wc_id, local_relpath, tree_conflict_data)
> values (?1, ?2, ?3);
>
> +-- STMT_UPDATE_ACTUAL_TEXT_CONFLICTS
> +update actual_node set conflict_old = ?3, conflict_new = ?4,
> +conflict_working = ?5
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_INSERT_ACTUAL_TEXT_CONFLICTS
> +/* tree conflicts are always recorded on the wcroot node, so the
> + parent_relpath will be null. */
> +insert into actual_node (
> + wc_id, local_relpath, conflict_old, conflict_new, conflict_working)
> +values (?1, ?2, ?3, ?4, ?5);
tree conflicts, yes. but these are NOT tree conflicts. the
parent_relpath may need to be "" instead of null.
> +
> +-- STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS
> +update actual_node set prop_reject = ?3
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS
> +/* tree conflicts are always recorded on the wcroot node, so the
> + parent_relpath will be null. */
> +insert into actual_node (
> + wc_id, local_relpath, prop_reject)
> +values (?1, ?2, ?3);
same
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jun 11 09:11:14 2010
> @@ -8169,3 +8169,99 @@ svn_wc__db_temp_op_remove_working_stub(s
>
> return svn_error_return(svn_sqlite__step_done(stmt));
> }
> +
> +svn_error_t *
> +svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t *db,
> + const char *local_abspath,
> + const char *old_basename,
> + const char *new_basename,
> + const char *wrk_basename,
> + apr_pool_t *scratch_pool)
> +{
> + svn_wc__db_pdh_t *pdh;
> + const char *local_relpath;
> + svn_sqlite__stmt_t *stmt;
> + svn_boolean_t got_row;
> +
> + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> +
> + SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
> + local_abspath,
> + svn_sqlite__mode_readwrite,
> + scratch_pool, scratch_pool));
> + VERIFY_USABLE_PDH(pdh);
> +
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_SELECT_ACTUAL_NODE));
> + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
> +
> + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> + SVN_ERR(svn_sqlite__reset(stmt));
> +
> + if (got_row)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
> + }
> + else
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
> + }
there should be a comment in here somewhere that these two statements
"should" be in a transaction, but we're keeping it simple since they
are temporary operations.
>...
> + svn_sqlite__mode_readwrite,
> + scratch_pool, scratch_pool));
> + VERIFY_USABLE_PDH(pdh);
> +
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_SELECT_ACTUAL_NODE));
> + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
> +
> + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> + SVN_ERR(svn_sqlite__reset(stmt));
> +
> + if (got_row)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS));
> + }
> + else
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS));
> + }
Same, re: transaction.
>...
Cheers,
-g
Re: svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc:
merge.c props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Posted by Greg Stein <gs...@gmail.com>.
On Fri, Jun 11, 2010 at 05:35, Philip Martin <ph...@wandisco.com> wrote:
>...
> This SQL stuff is all a bit new to me. Why do you choose to have
> distinct insert and update queries rather than an insert or replace
> query? Should there be a transaction to combine the SELECT query with
There could be an ACTUAL_NODE row already. You don't want to *replace*
it. You could lose (say) edited properties.
Cheers,
-g
RE: svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc: merge.c props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Posted by Bert Huijben <be...@vmoo.com>.
> -----Original Message-----
> From: Philip Martin [mailto:philip.martin@wandisco.com]
> Sent: vrijdag 11 juni 2010 11:36
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r953617 - in
> /subversion/trunk/subversion/libsvn_wc: merge.c props.c wc-queries.sql
> wc_db.c wc_db.h workqueue.c workqueue.h
>
> rhuijben@apache.org writes:
>
> > Author: rhuijben
> > Date: Fri Jun 11 09:11:14 2010
> > New Revision: 953617
>
> > +svn_error_t *
> > +svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t
> *db,
> > + const char
*local_abspath,
> > + const char
*old_basename,
> > + const char
*new_basename,
> > + const char
*wrk_basename,
> > + apr_pool_t
> > +*scratch_pool) {
> > + svn_wc__db_pdh_t *pdh;
> > + const char *local_relpath;
> > + svn_sqlite__stmt_t *stmt;
> > + svn_boolean_t got_row;
> > +
> > + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> > +
> > + SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath,
> db,
> > + local_abspath,
> > +
svn_sqlite__mode_readwrite,
> > + scratch_pool,
> > + scratch_pool)); VERIFY_USABLE_PDH(pdh);
> > +
> > + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > + STMT_SELECT_ACTUAL_NODE));
> > + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id,
> > + local_relpath));
> > +
> > + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> > + SVN_ERR(svn_sqlite__reset(stmt));
> > +
> > + if (got_row)
> > + {
> > + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > +
STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
> > + }
> > + else
> > + {
> > + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> > +
STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
> > + }
>
> This SQL stuff is all a bit new to me. Why do you choose to have distinct
> insert and update queries rather than an insert or replace query? Should
> there be a transaction to combine the SELECT query with the UPDATE/INSERT
> query? Or are you relying on the working copy lock?
> I realise this is a _temp_ function.
There are more fields in ACTUAL_NODE then there are touched by this
function. If I would use an INSERT OR REPLACE, I would remove changelists,
properties and other data stored in actual node. (Sqlite documents that it
removes the old record, before it inserts the new one if it has a collision
on the insert).
(See also Greg's reply that I should have added a note on using a
transaction for this)
Bert
Re: svn commit: r953617 - in /subversion/trunk/subversion/libsvn_wc: merge.c props.c wc-queries.sql wc_db.c wc_db.h workqueue.c workqueue.h
Posted by Philip Martin <ph...@wandisco.com>.
rhuijben@apache.org writes:
> Author: rhuijben
> Date: Fri Jun 11 09:11:14 2010
> New Revision: 953617
> +svn_error_t *
> +svn_wc__db_temp_op_set_text_conflict_marker_files(svn_wc__db_t *db,
> + const char *local_abspath,
> + const char *old_basename,
> + const char *new_basename,
> + const char *wrk_basename,
> + apr_pool_t *scratch_pool)
> +{
> + svn_wc__db_pdh_t *pdh;
> + const char *local_relpath;
> + svn_sqlite__stmt_t *stmt;
> + svn_boolean_t got_row;
> +
> + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> +
> + SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
> + local_abspath,
> + svn_sqlite__mode_readwrite,
> + scratch_pool, scratch_pool));
> + VERIFY_USABLE_PDH(pdh);
> +
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_SELECT_ACTUAL_NODE));
> + SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
> +
> + SVN_ERR(svn_sqlite__step(&got_row, stmt));
> + SVN_ERR(svn_sqlite__reset(stmt));
> +
> + if (got_row)
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_UPDATE_ACTUAL_TEXT_CONFLICTS));
> + }
> + else
> + {
> + SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
> + STMT_INSERT_ACTUAL_TEXT_CONFLICTS));
> + }
This SQL stuff is all a bit new to me. Why do you choose to have
distinct insert and update queries rather than an insert or replace
query? Should there be a transaction to combine the SELECT query with
the UPDATE/INSERT query? Or are you relying on the working copy lock?
I realise this is a _temp_ function.
> +
> + SVN_ERR(svn_sqlite__bindf(stmt, "issss", pdh->wcroot->wc_id,
> + local_relpath,
> + old_basename,
> + new_basename,
> + wrk_basename));
> +
> + return svn_error_return(svn_sqlite__step_done(stmt));
--
Philip