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/07/03 18:41:16 UTC

svn commit: r1356821 - /subversion/trunk/subversion/libsvn_wc/conflicts.c

Author: rhuijben
Date: Tue Jul  3 16:41:15 2012
New Revision: 1356821

URL: http://svn.apache.org/viewvc?rev=1356821&view=rev
Log:
Simplify some of the 'svn resolve --accept=' code to avoid looping
over conflictdescriptors where the skel has a direct answer.

* subversion/libsvn_wc/conflicts.c
  (svn_wc__read_conflicts): Remove unused variable.
  (resolve_conflict_on_node): Determine what to resolve from the skel.

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=1356821&r1=1356820&r2=1356821&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Tue Jul  3 16:41:15 2012
@@ -1805,7 +1805,6 @@ svn_wc__read_conflicts(const apr_array_h
   svn_boolean_t tree_conflicted;
   svn_wc_operation_t operation;
   const apr_array_header_t *locations;
-  svn_error_t *err;
 
   SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, db, local_abspath,
                                    scratch_pool, scratch_pool));
@@ -1986,42 +1985,42 @@ resolve_conflict_on_node(svn_boolean_t *
                          svn_wc_conflict_choice_t conflict_choice,
                          svn_cancel_func_t cancel_func_t,
                          void *cancel_baton,
-                         apr_pool_t *pool)
+                         apr_pool_t *scratch_pool)
 {
-  const char *conflict_old = NULL;
-  const char *conflict_new = NULL;
-  const char *conflict_working = NULL;
-  const char *prop_reject_file = NULL;
-  int i;
-  const apr_array_header_t *conflicts;
+  svn_skel_t *conflicts;
+  svn_boolean_t text_conflicted;
+  svn_boolean_t prop_conflicted;
+  svn_boolean_t tree_conflicted;
   svn_skel_t *work_items = NULL;
   svn_skel_t *work_item;
+  apr_pool_t *pool = scratch_pool;
 
   *did_resolve = FALSE;
 
-  SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath,
-                                 pool, pool));
-
-  for (i = 0; i < conflicts->nelts; i++)
-    {
-      const svn_wc_conflict_description2_t *desc;
+  SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
+                                   scratch_pool, scratch_pool));
 
-      desc = APR_ARRAY_IDX(conflicts, i,
-                           const svn_wc_conflict_description2_t*);
+  if (!conflicts)
+    return SVN_NO_ERROR;
 
-      if (desc->kind == svn_wc_conflict_kind_text)
-        {
-          conflict_old = desc->base_abspath;
-          conflict_new = desc->their_abspath;
-          conflict_working = desc->my_abspath;
-        }
-      else if (desc->kind == svn_wc_conflict_kind_property)
-        prop_reject_file = desc->their_abspath;
-    }
+  SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, &text_conflicted,
+                                     &prop_conflicted, &tree_conflicted,
+                                     db, local_abspath, conflicts,
+                                     scratch_pool, scratch_pool));
 
-  if (resolve_text)
+  if (resolve_text && text_conflicted)
     {
+      const char *conflict_old = NULL;
+      const char *conflict_new = NULL;
+      const char *conflict_working = NULL;
       const char *auto_resolve_src;
+      svn_node_kind_t node_kind;
+
+      SVN_ERR(svn_wc__conflict_read_text_conflict(&conflict_working,
+                                                  &conflict_old,
+                                                  &conflict_new,
+                                                  db, local_abspath, conflicts,
+                                                  scratch_pool, scratch_pool));
 
       /* Handle automatic conflict resolution before the temporary files are
        * deleted, if necessary. */
@@ -2093,11 +2092,6 @@ resolve_conflict_on_node(svn_boolean_t *
                     auto_resolve_src, local_abspath, pool, pool));
           work_items = svn_wc__wq_merge(work_items, work_item, pool);
         }
-    }
-
-  if (resolve_text)
-    {
-      svn_node_kind_t node_kind;
 
       /* Legacy behavior: Only report text conflicts as resolved when at least
          one conflict marker file exists.
@@ -2144,9 +2138,16 @@ resolve_conflict_on_node(svn_boolean_t *
             }
         }
     }
-  if (resolve_props)
+
+  if (resolve_props && prop_conflicted)
     {
       svn_node_kind_t node_kind;
+      const char *prop_reject_file;
+
+      SVN_ERR(svn_wc__conflict_read_prop_conflict(&prop_reject_file,
+                                                  NULL, NULL, NULL, NULL,
+                                                  db, local_abspath, conflicts,
+                                                  scratch_pool, scratch_pool));
 
       /* Legacy behavior: Only report property conflicts as resolved when the
          property reject file exists