Author: rhuijben
Date: Sat Jan 12 15:33:09 2013
New Revision: 1432454

URL: http://svn.apache.org/viewvc?rev=1432454&view=rev
Log:
Fill in several optional components of the conflict description structure for
conflict types that didn't have these details in 1.7.

* subversion/libsvn_wc/conflicts.c
  (generate_propconflict): Add operation argument and set in description.
  (eval_text_conflict_func_result): Organize db, local_abspath as first
    non-output argument.
  (resolve_text_conflicts): Remove unused arguments. Move output arguments to
    the start. Add operation. Update caller.
  (setup_tree_conflict_desc): Remove skel argument and add specific arguments.
  (svn_wc__conflict_invoke_resolver): Add cancel handling. Collect locations
    and pass to helpers.
  (svn_wc__read_conflicts): Read locations and pass to helpers.

* subversion/libsvn_wc/conflicts.h
  (svn_wc__conflict_invoke_resolver): Add cancel support.

* subversion/libsvn_wc/merge.c
  (svn_wc_merge5): Update caller.

* subversion/libsvn_wc/props.c
  (svn_wc_merge_props3): Update caller.

* subversion/libsvn_wc/update_editor.c
  (close_directory,
   close_file): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/conflicts.h
    subversion/trunk/subversion/libsvn_wc/merge.c
    subversion/trunk/subversion/libsvn_wc/props.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1432454&r1=1432453&r2=1432454&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Sat Jan 12 15:33:09 2013
@@ -1223,6 +1223,7 @@ static svn_error_t *
 generate_propconflict(svn_boolean_t *conflict_remains,
                       svn_wc__db_t *db,
                       const char *local_abspath,
+                      svn_wc_operation_t operation,
                       const svn_wc_conflict_version_t *left_version,
                       const svn_wc_conflict_version_t *right_version,
                       const char *propname,
@@ -1248,6 +1249,7 @@ generate_propconflict(svn_boolean_t *con
                 (kind == svn_kind_dir) ? svn_node_dir : svn_node_file,
                 propname, scratch_pool);
 
+  cdesc->operation = operation;
   cdesc->src_left_version = left_version;
   cdesc->src_right_version = right_version;
 
@@ -1481,10 +1483,10 @@ generate_propconflict(svn_boolean_t *con
 static svn_error_t*
 eval_text_conflict_func_result(svn_skel_t **work_items,
                                enum svn_wc_merge_outcome_t *merge_outcome,
-                               svn_wc_conflict_choice_t choice,
-                               const apr_array_header_t *merge_options,
                                svn_wc__db_t *db,
                                const char *local_abspath,
+                               svn_wc_conflict_choice_t choice,
+                               const apr_array_header_t *merge_options,
                                const char *left_abspath,
                                const char *right_abspath,
                                const char *merged_file,
@@ -1670,20 +1672,19 @@ 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_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,
-                       enum svn_wc_merge_outcome_t *merge_outcome,
                        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,
-                       svn_cancel_func_t cancel_func,
-                       void *cancel_baton,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
@@ -1708,6 +1709,7 @@ resolve_text_conflicts(svn_skel_t **work
   cdesc->their_abspath = right_abspath;
   cdesc->my_abspath = detranslated_target;
   cdesc->merged_file = result_target;
+  cdesc->operation = operation;
   cdesc->src_left_version = left_version;
   cdesc->src_right_version = right_version;
 
@@ -1732,9 +1734,9 @@ resolve_text_conflicts(svn_skel_t **work
 
   SVN_ERR(eval_text_conflict_func_result(&work_item,
                                          merge_outcome,
+                                         db, local_abspath,
                                          result->choice,
                                          merge_options,
-                                         db, local_abspath,
                                          left_abspath,
                                          right_abspath,
                                          result->merged_file
@@ -1758,43 +1760,28 @@ resolve_text_conflicts(svn_skel_t **work
 
 static svn_error_t *
 setup_tree_conflict_desc(svn_wc_conflict_description2_t **desc,
-                         svn_wc_operation_t operation,
-                         const apr_array_header_t *locations,
-                         const svn_skel_t *conflict_skel,
-                         const char *local_abspath,
                          svn_wc__db_t *db,
+                         const char *local_abspath,
+                         svn_wc_operation_t operation,
+                         const svn_wc_conflict_version_t *left_version,
+                         const svn_wc_conflict_version_t *right_version,
+                         svn_wc_conflict_reason_t local_change,
+                         svn_wc_conflict_action_t incoming_change,
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
-  svn_wc_conflict_version_t *v1;
-  svn_wc_conflict_version_t *v2;
   svn_node_kind_t tc_kind;
-  svn_wc_conflict_reason_t local_change;
-  svn_wc_conflict_action_t incoming_change;
-
-  SVN_ERR(svn_wc__conflict_read_tree_conflict(&local_change,
-                                              &incoming_change,
-                                              db, local_abspath,
-                                              conflict_skel,
-                                              result_pool, scratch_pool));
 
-  v1 = (locations && locations->nelts > 0)
-                ? APR_ARRAY_IDX(locations, 0, svn_wc_conflict_version_t *)
-                : NULL;
-
-  v2 = (locations && locations->nelts > 1)
-                ? APR_ARRAY_IDX(locations, 1, svn_wc_conflict_version_t *)
-                : NULL;
-
-  if (v1)
-    tc_kind = v1->node_kind;
-  else if (v2)
-    tc_kind = v2->node_kind;
+  if (left_version)
+    tc_kind = left_version->node_kind;
+  else if (right_version)
+    tc_kind = right_version->node_kind;
   else
     tc_kind = svn_node_file; /* Avoid assertion */
 
   *desc = svn_wc_conflict_description_create_tree2(local_abspath, tc_kind,
-                                                   operation, v1, v2,
+                                                   operation,
+                                                   left_version, right_version,
                                                    result_pool);
   (*desc)->reason = local_change;
   (*desc)->action = incoming_change;
@@ -1810,6 +1797,8 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                  const apr_array_header_t *merge_options,
                                  svn_wc_conflict_resolver_func2_t 
resolver_func,
                                  void *resolver_baton,
+                                 svn_cancel_func_t cancel_func,
+                                 void *cancel_baton,
                                  apr_pool_t *scratch_pool)
 {
   svn_boolean_t text_conflicted;
@@ -1817,6 +1806,8 @@ svn_wc__conflict_invoke_resolver(svn_wc_
   svn_boolean_t tree_conflicted;
   svn_wc_operation_t operation;
   const apr_array_header_t *locations;
+  const svn_wc_conflict_version_t *left_version = NULL;
+  const svn_wc_conflict_version_t *right_version = NULL;
 
   SVN_ERR(svn_wc__conflict_read_info(&operation, &locations,
                                      &text_conflicted, &prop_conflicted,
@@ -1824,6 +1815,12 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                      db, local_abspath, conflict_skel,
                                      scratch_pool, scratch_pool));
 
+  if (locations && locations->nelts > 0)
+    left_version = APR_ARRAY_IDX(locations, 0, const svn_wc_conflict_version_t 
*);
+
+  if (locations && locations->nelts > 1)
+    right_version = APR_ARRAY_IDX(locations, 1, const 
svn_wc_conflict_version_t *);
+
   /* Quick and dirty compatibility wrapper. My guess would be that most 
resolvers
      would want to look at all properties at the same time.
 
@@ -1868,9 +1865,15 @@ svn_wc__conflict_invoke_resolver(svn_wc_
 
           svn_pool_clear(iterpool);
 
+          if (cancel_func)
+            SVN_ERR(cancel_func(cancel_baton));
+
           SVN_ERR(generate_propconflict(&conflict_remains,
                                         db, local_abspath,
-                                        NULL, NULL, propname,
+                                        operation,
+                                        left_version,
+                                        right_version,
+                                        propname,
                                         old_props
                                           ? apr_hash_get(old_props, propname,
                                                          APR_HASH_KEY_STRING)
@@ -1904,7 +1907,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
       const char *mine_abspath;
       const char *their_original_abspath;
       const char *their_abspath;
-      svn_skel_t *work_item = NULL;
+      svn_skel_t *work_items;
       svn_wc_merge_outcome_t merge_outcome = svn_wc_merge_conflict;
 
       SVN_ERR(svn_wc__conflict_read_text_conflict(&their_original_abspath,
@@ -1914,23 +1917,28 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                                   conflict_skel,
                                                   scratch_pool, scratch_pool));
 
-      SVN_ERR(resolve_text_conflicts(&work_item, db, local_abspath,
+      SVN_ERR(resolve_text_conflicts(&work_items, &merge_outcome,
+                                     db, local_abspath,
                                      merge_options,
+                                     operation,
                                      their_original_abspath, their_abspath,
-                                     &merge_outcome,
-                                     NULL /* left_version */,
-                                     NULL /* right_version */,
+                                     left_version,
+                                     right_version,
                                      local_abspath,
                                      mine_abspath,
                                      resolver_func, resolver_baton,
-                                     NULL, NULL,
                                      scratch_pool, scratch_pool));
 
       if (merge_outcome == svn_wc_merge_merged)
         {
           SVN_ERR(svn_wc__db_op_mark_resolved(db, local_abspath, TRUE, FALSE,
-                                              FALSE, work_item, scratch_pool));
-          SVN_ERR(svn_wc__wq_run(db, local_abspath, NULL, NULL, scratch_pool));
+                                              FALSE, work_items, 
scratch_pool));
+          if (work_items)
+            {
+              SVN_ERR(svn_wc__wq_run(db, local_abspath,
+                                     cancel_func, cancel_baton,
+                                     scratch_pool));
+            }
         }
     }
 
@@ -1946,9 +1954,13 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                                   db, local_abspath,
                                                   conflict_skel,
                                                   scratch_pool, scratch_pool));
-      SVN_ERR(setup_tree_conflict_desc(&desc, operation, locations,
-                                       conflict_skel, local_abspath, db,
+
+      SVN_ERR(setup_tree_conflict_desc(&desc,
+                                       db, local_abspath,
+                                       operation, left_version, right_version,
+                                       local_change, incoming_change,
                                        scratch_pool, scratch_pool));
+
       /* Tell the resolver func about this conflict. */
       SVN_ERR(resolver_func(&result, desc, resolver_baton, scratch_pool,
                             scratch_pool));
@@ -1976,6 +1988,9 @@ read_prop_conflicts(apr_array_header_t *
                     const char *local_abspath,
                     svn_skel_t *conflict_skel,
                     svn_boolean_t create_tempfiles,
+                    svn_wc_operation_t operation,
+                    const svn_wc_conflict_version_t *left_version,
+                    const svn_wc_conflict_version_t *right_version,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
 {
@@ -2010,6 +2025,10 @@ read_prop_conflicts(apr_array_header_t *
        * ### conflict description struct for this. */
       desc->their_abspath = apr_pstrdup(result_pool, prop_reject_file);
 
+      desc->operation = operation;
+      desc->src_left_version = left_version;
+      desc->src_right_version = right_version;
+
       APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description2_t*) = desc;
 
       return SVN_NO_ERROR;
@@ -2033,6 +2052,10 @@ read_prop_conflicts(apr_array_header_t *
                                                        propname,
                                                        result_pool);
 
+      desc->operation = operation;
+      desc->src_left_version = left_version;
+      desc->src_right_version = right_version;
+
       desc->property_name = apr_pstrdup(result_pool, propname);
 
       my_value = apr_hash_get(my_props, propname, APR_HASH_KEY_STRING);
@@ -2129,6 +2152,8 @@ svn_wc__read_conflicts(const apr_array_h
   svn_boolean_t tree_conflicted;
   svn_wc_operation_t operation;
   const apr_array_header_t *locations;
+  const svn_wc_conflict_version_t *left_version = NULL;
+  const svn_wc_conflict_version_t *right_version = NULL;
 
   SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, db, local_abspath,
                                    scratch_pool, scratch_pool));
@@ -2149,9 +2174,15 @@ svn_wc__read_conflicts(const apr_array_h
   cflcts = apr_array_make(result_pool, 4,
                           sizeof(svn_wc_conflict_description2_t*));
 
+  if (locations && locations->nelts > 0)
+    left_version = APR_ARRAY_IDX(locations, 0, const svn_wc_conflict_version_t 
*);
+  if (locations && locations->nelts > 1)
+    right_version = APR_ARRAY_IDX(locations, 1, const 
svn_wc_conflict_version_t *);
+
   if (prop_conflicted)
     SVN_ERR(read_prop_conflicts(cflcts, db, local_abspath, conflict_skel,
                                 create_tempfiles,
+                                operation, left_version, right_version,
                                 result_pool, scratch_pool));
 
   if (text_conflicted)
@@ -2160,6 +2191,10 @@ svn_wc__read_conflicts(const apr_array_h
       desc  = svn_wc_conflict_description_create_text2(local_abspath,
                                                        result_pool);
 
+      desc->operation = operation;
+      desc->src_left_version = left_version;
+      desc->src_right_version = right_version;
+
       SVN_ERR(svn_wc__conflict_read_text_conflict(&desc->my_abspath,
                                                   &desc->base_abspath,
                                                   &desc->their_abspath,
@@ -2174,11 +2209,22 @@ svn_wc__read_conflicts(const apr_array_h
 
   if (tree_conflicted)
     {
+      svn_wc_conflict_reason_t local_change;
+      svn_wc_conflict_action_t incoming_change;
       svn_wc_conflict_description2_t *desc;
 
-      SVN_ERR(setup_tree_conflict_desc(&desc, operation, locations,
-                                       conflict_skel, local_abspath, db,
-                                       result_pool, scratch_pool));
+      SVN_ERR(svn_wc__conflict_read_tree_conflict(&local_change,
+                                                  &incoming_change,
+                                                  db, local_abspath,
+                                                  conflict_skel,
+                                                  scratch_pool, scratch_pool));
+
+      SVN_ERR(setup_tree_conflict_desc(&desc,
+                                       db, local_abspath,
+                                       operation, left_version, right_version,
+                                       local_change, incoming_change,
+                                       scratch_pool, scratch_pool));
+
       APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description2_t *) = desc;
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.h?rev=1432454&r1=1432453&r2=1432454&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.h Sat Jan 12 15:33:09 2013
@@ -392,6 +392,8 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                  const apr_array_header_t *merge_options,
                                  svn_wc_conflict_resolver_func2_t 
resolver_func,
                                  void *resolver_baton,
+                                 svn_cancel_func_t cancel_func,
+                                 void *cancel_baton,
                                  apr_pool_t *scratch_pool);
 
 

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=1432454&r1=1432453&r2=1432454&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Sat Jan 12 15:33:09 2013
@@ -1392,6 +1392,7 @@ svn_wc_merge5(enum svn_wc_merge_outcome_
         SVN_ERR(svn_wc__conflict_invoke_resolver(wc_ctx->db, target_abspath,
                                                  conflict_skel, merge_options,
                                                  conflict_func, conflict_baton,
+                                                 cancel_func, cancel_baton,
                                                  scratch_pool));
     }
   

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1432454&r1=1432453&r2=1432454&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Sat Jan 12 15:33:09 2013
@@ -353,6 +353,7 @@ svn_wc_merge_props3(svn_wc_notify_state_
     SVN_ERR(svn_wc__conflict_invoke_resolver(db, local_abspath, conflict_skel,
                                              NULL /* merge_options */,
                                              conflict_func, conflict_baton,
+                                             cancel_func, cancel_baton,
                                              scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1432454&r1=1432453&r2=1432454&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Sat Jan 12 15:33:09 
2013
@@ -2777,6 +2777,8 @@ close_directory(void *dir_baton,
                                              NULL /* merge_options */,
                                              eb->conflict_func,
                                              eb->conflict_baton,
+                                             eb->cancel_func,
+                                             eb->conflict_baton,
                                              scratch_pool));
 
   /* Notify of any prop changes on this directory -- but do nothing if
@@ -4368,6 +4370,8 @@ close_file(void *file_baton,
                                              NULL /* merge_options */,
                                              eb->conflict_func,
                                              eb->conflict_baton,
+                                             eb->cancel_func,
+                                             eb->cancel_baton,
                                              scratch_pool));
 
   /* Deal with the WORKING tree, based on updates to the BASE tree.  */


Reply via email to