subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1433486 - /subversion/trunk/subversion/libsvn_wc/conflicts.c
Date Tue, 15 Jan 2013 16:16:32 GMT
Author: rhuijben
Date: Tue Jan 15 16:16:32 2013
New Revision: 1433486

URL: http://svn.apache.org/viewvc?rev=1433486&view=rev
Log:
Use a boolean to determine when a conflict is resolved, instead of a few
values in an enum, which are eventually just compared to a single value.

* subversion/libsvn_wc/conflicts.c
  (eval_text_conflict_func_result): Simplify output argument.
  (resolve_text_conflicts): Don't call eval_text_conflict_func_result for
    postponing and return result as boolean.
  (svn_wc__conflict_invoke_resolver): Simplify code by not checking a faked
    merge result.

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=1433486&r1=1433485&r2=1433486&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Tue Jan 15 16:16:32 2013
@@ -1471,7 +1471,7 @@ generate_propconflict(svn_boolean_t *con
  * CHOICE.
  *
  * Set *WORK_ITEMS to new work items that will ...
- * Set *MERGE_OUTCOME to the result of the 3-way merge.
+ * Set *IS_RESOLVED to true if the conflicts are resolved, otherwise 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
@@ -1482,7 +1482,7 @@ generate_propconflict(svn_boolean_t *con
  * 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,
-                               enum svn_wc_merge_outcome_t *merge_outcome,
+                               svn_boolean_t *is_resolved,
                                svn_wc__db_t *db,
                                const char *local_abspath,
                                svn_wc_conflict_choice_t choice,
@@ -1506,19 +1506,19 @@ eval_text_conflict_func_result(svn_skel_
       case svn_wc_conflict_choose_base:
         {
           install_from = left_abspath;
-          *merge_outcome = svn_wc_merge_merged;
+          *is_resolved = TRUE;
           break;
         }
       case svn_wc_conflict_choose_theirs_full:
         {
           install_from = right_abspath;
-          *merge_outcome = svn_wc_merge_merged;
+          *is_resolved = TRUE;
           break;
         }
       case svn_wc_conflict_choose_mine_full:
         {
           /* Do nothing to merge_target, let it live untouched! */
-          *merge_outcome = svn_wc_merge_merged;
+          *is_resolved = TRUE;
           return SVN_NO_ERROR;
         }
       case svn_wc_conflict_choose_theirs_conflict:
@@ -1566,7 +1566,7 @@ eval_text_conflict_func_result(svn_skel_
 
           install_from = chosen_path;
           remove_source = TRUE;
-          *merge_outcome = svn_wc_merge_merged;
+          *is_resolved = TRUE;
           break;
         }
 
@@ -1579,19 +1579,14 @@ eval_text_conflict_func_result(svn_skel_
       case svn_wc_conflict_choose_merged:
         {
           install_from = merged_file;
-          *merge_outcome = svn_wc_merge_merged;
+          *is_resolved = TRUE;
           break;
         }
       case svn_wc_conflict_choose_postpone:
       default:
         {
-#if 0
-          /* ### what should this value be? no caller appears to initialize
-             ### it, so we really SHOULD be setting a value here.  */
-          *merge_outcome = svn_wc_merge_merged;
-#endif
-
           /* Assume conflict remains. */
+          *is_resolved = FALSE;
           return SVN_NO_ERROR;
         }
     }
@@ -1672,7 +1667,7 @@ save_merge_result(svn_skel_t **work_item
    external 3-way merge. */
 static svn_error_t*
 resolve_text_conflicts(svn_skel_t **work_items,
-                       svn_wc_merge_outcome_t *merge_outcome,
+                       svn_boolean_t *was_resolved,
                        svn_wc__db_t *db,
                        const char *local_abspath,
                        const apr_array_header_t *merge_options,
@@ -1694,6 +1689,7 @@ resolve_text_conflicts(svn_skel_t **work
   apr_hash_t *props;
 
   *work_items = NULL;
+  *was_resolved = FALSE;
 
   /* Give the conflict resolution callback a chance to clean
      up the conflicts before we mark the file 'conflicted' */
@@ -1732,27 +1728,24 @@ resolve_text_conflicts(svn_skel_t **work
                                 result_pool, scratch_pool));
     }
 
-  SVN_ERR(eval_text_conflict_func_result(&work_item,
-                                         merge_outcome,
-                                         db, local_abspath,
-                                         result->choice,
-                                         merge_options,
-                                         left_abspath,
-                                         right_abspath,
-                                         result->merged_file
-                                           ? result->merged_file
-                                           : result_target,
-                                         detranslated_target,
-                                         result_pool, scratch_pool));
-  *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
-
   if (result->choice != svn_wc_conflict_choose_postpone)
-    /* The conflicts have been dealt with, nothing else
-     * to do for us here. */
-    return SVN_NO_ERROR;
-
-  /* The conflicts have not been dealt with. */
-  *merge_outcome = svn_wc_merge_conflict;
+    {
+      SVN_ERR(eval_text_conflict_func_result(&work_item,
+                                             was_resolved,
+                                             db, local_abspath,
+                                             result->choice,
+                                             merge_options,
+                                             left_abspath,
+                                             right_abspath,
+                                             result->merged_file
+                                               ? result->merged_file
+                                               : result_target,
+                                             detranslated_target,
+                                             result_pool, scratch_pool));
+      *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
+    }
+  else
+    *was_resolved = FALSE;
 
   return SVN_NO_ERROR;
 }
@@ -1908,7 +1901,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
       const char *their_original_abspath;
       const char *their_abspath;
       svn_skel_t *work_items;
-      svn_wc_merge_outcome_t merge_outcome = svn_wc_merge_conflict;
+      svn_boolean_t was_resolved;
 
       SVN_ERR(svn_wc__conflict_read_text_conflict(&their_original_abspath,
                                                   &mine_abspath,
@@ -1917,7 +1910,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                                   conflict_skel,
                                                   scratch_pool, scratch_pool));
 
-      SVN_ERR(resolve_text_conflicts(&work_items, &merge_outcome,
+      SVN_ERR(resolve_text_conflicts(&work_items, &was_resolved,
                                      db, local_abspath,
                                      merge_options,
                                      operation,
@@ -1929,7 +1922,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                      resolver_func, resolver_baton,
                                      scratch_pool, scratch_pool));
 
-      if (merge_outcome == svn_wc_merge_merged)
+      if (was_resolved)
         {
           SVN_ERR(svn_wc__db_op_mark_resolved(db, local_abspath, TRUE, FALSE,
                                               FALSE, work_items, scratch_pool));



Mime
View raw message