Author: julianfoad
Date: Fri Jan 25 22:03:49 2013
New Revision: 1438737
URL: http://svn.apache.org/viewvc?rev=1438737&view=rev
Log:
* subversion/libsvn_wc/conflicts.c
(eval_text_conflict_func_result,
save_merge_result,
resolve_text_conflict): Write full doc strings. Rename some path
variables to indicate they are abspaths.
Modified:
subversion/trunk/subversion/libsvn_wc/conflicts.c
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1438737&r1=1438736&r2=1438737&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Fri Jan 25 22:03:49 2013
@@ -441,6 +441,8 @@ svn_wc__conflict_skel_add_prop_conflict(
mine-props
their-props)
NULL lists are recorded as "" */
+ /* ### Seems that this may not match what we read out. Read-out of
+ * 'theirs-old' comes as NULL. */
prop_conflict = svn_skel__make_empty_list(result_pool);
@@ -1467,20 +1469,25 @@ generate_propconflict(svn_boolean_t *con
return SVN_NO_ERROR;
}
-/* Deal with the result of the conflict resolution callback, as indicated by
- * CHOICE.
+/* Resolve the text conflict on DB/LOCAL_ABSPATH in the manner specified
+ * by CHOICE.
*
- * Set *WORK_ITEMS to new work items that will ...
- * Set *IS_RESOLVED to true if the conflicts are resolved, otherwise to false.
+ * Set *WORK_ITEMS to new work items that will make the on-disk changes
+ * needed to complete the resolution (but not to mark it as resolved).
+ * Set *IS_RESOLVED to true if the conflicts are resolved; otherwise
+ * (which is only if CHOICE is 'postpone') to false.
*
- * LEFT_ABSPATH, RIGHT_ABSPATH, and TARGET_ABSPATH are the input files to
- * the 3-way merge, and MERGED_FILE is the merged result as generated by the
- * internal or external merge or by the conflict resolution callback.
+ * LEFT_ABSPATH, RIGHT_ABSPATH, and DETRANSLATED_TARGET are the
+ * input files to the 3-way merge that will be performed if CHOICE is
+ * 'theirs-conflict' or 'mine-conflict'. LEFT_ABSPATH is also the file
+ * that will be used if CHOICE is 'base', and RIGHT_ABSPATH if CHOICE is
+ * 'theirs-full'. MERGED_ABSPATH will be used if CHOICE is 'merged'.
*
- * DETRANSLATED_TARGET is the detranslated version of TARGET_ABSPATH
- * (see detranslate_wc_file() above). DIFF3_OPTIONS are passed to the
- * diff3 implementation in case a 3-way merge has to be carried out. */
-static svn_error_t*
+ * DETRANSLATED_TARGET is the detranslated version of 'mine' (see
+ * detranslate_wc_file() above). MERGE_OPTIONS are passed to the
+ * diff3 implementation in case a 3-way merge has to be carried out.
+ */
+static svn_error_t *
eval_text_conflict_func_result(svn_skel_t **work_items,
svn_boolean_t *is_resolved,
svn_wc__db_t *db,
@@ -1489,12 +1496,12 @@ eval_text_conflict_func_result(svn_skel_
const apr_array_header_t *merge_options,
const char *left_abspath,
const char *right_abspath,
- const char *merged_file,
+ const char *merged_abspath,
const char *detranslated_target,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- const char *install_from = NULL;
+ const char *install_from_abspath = NULL;
svn_boolean_t remove_source = FALSE;
*work_items = NULL;
@@ -1505,13 +1512,13 @@ eval_text_conflict_func_result(svn_skel_
to resolve the conflict, so be it.*/
case svn_wc_conflict_choose_base:
{
- install_from = left_abspath;
+ install_from_abspath = left_abspath;
*is_resolved = TRUE;
break;
}
case svn_wc_conflict_choose_theirs_full:
{
- install_from = right_abspath;
+ install_from_abspath = right_abspath;
*is_resolved = TRUE;
break;
}
@@ -1524,7 +1531,7 @@ eval_text_conflict_func_result(svn_skel_
case svn_wc_conflict_choose_theirs_conflict:
case svn_wc_conflict_choose_mine_conflict:
{
- const char *chosen_path;
+ const char *chosen_abspath;
const char *temp_dir;
svn_stream_t *chosen_stream;
svn_diff_t *diff;
@@ -1545,7 +1552,7 @@ eval_text_conflict_func_result(svn_skel_
SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir, db,
local_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(svn_stream_open_unique(&chosen_stream, &chosen_path,
+ SVN_ERR(svn_stream_open_unique(&chosen_stream, &chosen_abspath,
temp_dir, svn_io_file_del_none,
scratch_pool, scratch_pool));
@@ -1564,7 +1571,7 @@ eval_text_conflict_func_result(svn_skel_
scratch_pool));
SVN_ERR(svn_stream_close(chosen_stream));
- install_from = chosen_path;
+ install_from_abspath = chosen_abspath;
remove_source = TRUE;
*is_resolved = TRUE;
break;
@@ -1578,7 +1585,7 @@ eval_text_conflict_func_result(svn_skel_
good to use". */
case svn_wc_conflict_choose_merged:
{
- install_from = merged_file;
+ install_from_abspath = merged_abspath;
*is_resolved = TRUE;
break;
}
@@ -1591,14 +1598,14 @@ eval_text_conflict_func_result(svn_skel_
}
}
- SVN_ERR_ASSERT(install_from != NULL);
+ SVN_ERR_ASSERT(install_from_abspath != NULL);
{
svn_skel_t *work_item;
SVN_ERR(svn_wc__wq_build_file_install(&work_item,
db, local_abspath,
- install_from,
+ install_from_abspath,
FALSE /* use_commit_times */,
FALSE /* record_fileinfo */,
result_pool, scratch_pool));
@@ -1611,7 +1618,8 @@ eval_text_conflict_func_result(svn_skel_
if (remove_source)
{
SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
- db, local_abspath, install_from,
+ db, local_abspath,
+ install_from_abspath,
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
}
@@ -1621,21 +1629,21 @@ eval_text_conflict_func_result(svn_skel_
}
-/* Create a new file in the same directory as VERSIONED_ABSPATH, with the
- same basename as VERSIONED_ABSPATH, with a ".edited" extension, and set
+/* Create a new file in the same directory as LOCAL_ABSPATH, with the
+ same basename as LOCAL_ABSPATH, with a ".edited" extension, and set
*WORK_ITEM to a new work item that will copy and translate from the file
- SOURCE to that new file. It will be translated from repository-normal
- form to working-copy form according to the versioned properties of
- VERSIONED_ABSPATH that are current when the work item is executed.
+ SOURCE_ABSPATH to that new file. It will be translated from repository-
+ normal form to working-copy form according to the versioned properties
+ of LOCAL_ABSPATH that are current when the work item is executed.
DB should have a write lock for the directory containing SOURCE.
Allocate *WORK_ITEM in RESULT_POOL. */
-static svn_error_t*
+static svn_error_t *
save_merge_result(svn_skel_t **work_item,
svn_wc__db_t *db,
const char *local_abspath,
- const char *source,
+ const char *source_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1656,32 +1664,54 @@ save_merge_result(svn_skel_t **work_item
scratch_pool, scratch_pool));
SVN_ERR(svn_wc__wq_build_file_copy_translated(work_item,
db, local_abspath,
- source, edited_copy_abspath,
+ source_abspath,
+ edited_copy_abspath,
result_pool, scratch_pool));
return SVN_NO_ERROR;
}
-/* XXX Insane amount of parameters... */
-/* RESULT_TARGET is the path to the merged file produced by the internal or
- external 3-way merge. */
-static svn_error_t*
-resolve_text_conflicts(svn_skel_t **work_items,
- svn_boolean_t *was_resolved,
- svn_wc__db_t *db,
- const char *local_abspath,
- const apr_array_header_t *merge_options,
- svn_wc_operation_t operation,
- const char *left_abspath,
- const char *right_abspath,
- const svn_wc_conflict_version_t *left_version,
- const svn_wc_conflict_version_t *right_version,
- const char *result_target,
- const char *detranslated_target,
- svn_wc_conflict_resolver_func2_t conflict_func,
- void *conflict_baton,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+/* Call the conflict resolver callback for a text conflict, and resolve
+ * the conflict if it tells us to do so.
+ *
+ * Assume that there is a text conflict on the path DB/LOCAL_ABSPATH.
+ *
+ * Call CONFLICT_FUNC with CONFLICT_BATON to find out whether and how
+ * it wants to resolve the conflict. Pass it a conflict description
+ * containing OPERATION, LEFT/RIGHT_ABSPATH, LEFT/RIGHT_VERSION,
+ * RESULT_TARGET and DETRANSLATED_TARGET.
+ *
+ * If the callback returns a resolution other than 'postpone', then
+ * perform that requested resolution and prepare to mark the conflict
+ * as resolved.
+ *
+ * Don't mark the conflict as resolved, but do return *WORK_ITEMS that
+ * will do the on-disk work required to mark it as resolved, and set
+ * *WAS_RESOLVED to true, if it was resolved. Set *WORK_ITEMS to NULL
+ * and *WAS_RESOLVED to FALSE otherwise.
+ *
+ * RESULT_TARGET is the path to the merged file produced by the internal
+ * or external 3-way merge, which may contain conflict markers, in
+ * repository normal form. DETRANSLATED_TARGET is the 'mine' version of
+ * the file, also in RNF.
+ */
+static svn_error_t *
+resolve_text_conflict(svn_skel_t **work_items,
+ svn_boolean_t *was_resolved,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ const apr_array_header_t *merge_options,
+ svn_wc_operation_t operation,
+ const char *left_abspath,
+ const char *right_abspath,
+ const svn_wc_conflict_version_t *left_version,
+ const svn_wc_conflict_version_t *right_version,
+ const char *result_target,
+ const char *detranslated_target,
+ svn_wc_conflict_resolver_func2_t conflict_func,
+ void *conflict_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_wc_conflict_result_t *result;
svn_skel_t *work_item;
@@ -1737,6 +1767,7 @@ resolve_text_conflicts(svn_skel_t **work
merge_options,
left_abspath,
right_abspath,
+ /* ### Sure this is an abspath? */
result->merged_file
? result->merged_file
: result_target,
@@ -1910,17 +1941,15 @@ svn_wc__conflict_invoke_resolver(svn_wc_
conflict_skel,
scratch_pool, scratch_pool));
- SVN_ERR(resolve_text_conflicts(&work_items, &was_resolved,
- db, local_abspath,
- merge_options,
- operation,
- their_original_abspath, their_abspath,
- left_version,
- right_version,
- local_abspath,
- mine_abspath,
- resolver_func, resolver_baton,
- scratch_pool, scratch_pool));
+ SVN_ERR(resolve_text_conflict(&work_items, &was_resolved,
+ db, local_abspath,
+ merge_options,
+ operation,
+ their_original_abspath, their_abspath,
+ left_version, right_version,
+ local_abspath, mine_abspath,
+ resolver_func, resolver_baton,
+ scratch_pool, scratch_pool));
if (was_resolved)
{