subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r932277 - /subversion/trunk/subversion/libsvn_wc/merge.c
Date Fri, 09 Apr 2010 07:42:07 GMT
Author: gstein
Date: Fri Apr  9 07:42:07 2010
New Revision: 932277

URL: http://svn.apache.org/viewvc?rev=932277&view=rev
Log:
Convert some uses of loggy_copy over to OP_FILE_INSTALL.

* subversion/libsvn_wc/merge.c:
  (eval_conflict_func_result): rather than calling loggy_copy(), set a
    source path, and break out of the switch. in one case, we generate a
    temp file which needs to be removed after the installation. add logic,
    based on REMOVE_SOURCE, to manage this. and lastly, outside the
    switch, make use of the INSTALL_FROM to do the working file install.

Modified:
    subversion/trunk/subversion/libsvn_wc/merge.c

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=932277&r1=932276&r2=932277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Fri Apr  9 07:42:07 2010
@@ -445,25 +445,24 @@ eval_conflict_func_result(enum svn_wc_me
                           svn_diff_file_options_t *options,
                           apr_pool_t *pool)
 {
+  const char *install_from = NULL;
+  svn_boolean_t remove_source = FALSE;
+
   switch (result->choice)
     {
       /* If the callback wants to use one of the fulltexts
          to resolve the conflict, so be it.*/
       case svn_wc_conflict_choose_base:
         {
-          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
-                                     left_abspath, target_abspath,
-                                     pool));
+          install_from = left_abspath;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
       case svn_wc_conflict_choose_theirs_full:
         {
-          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
-                                     right_abspath, target_abspath,
-                                     pool));
+          install_from = right_abspath;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
       case svn_wc_conflict_choose_mine_full:
         {
@@ -504,18 +503,11 @@ eval_conflict_func_result(enum svn_wc_me
                                               style,
                                               pool));
           SVN_ERR(svn_stream_close(chosen_stream));
-          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
-                                     chosen_path, target_abspath, pool));
-          {
-            const svn_skel_t *work_item;
 
-            SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
-                                                 db, chosen_path,
-                                                 pool, pool));
-            SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, pool));
-          }
+          install_from = chosen_path;
+          remove_source = TRUE;
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          break;
         }
 
         /* For the case of 3-way file merging, we don't
@@ -526,40 +518,59 @@ eval_conflict_func_result(enum svn_wc_me
            good to use". */
       case svn_wc_conflict_choose_merged:
         {
-          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
-                                     /* Look for callback's own
-                                        merged-file first: */
-                                     result->merged_file
-                                       ? result->merged_file
-                                       : result_target,
-                                     target_abspath,
-                                     pool));
+          /* Look for callback's own merged-file first:  */
+          install_from = (result->merged_file
+                            ? result->merged_file
+                            : result_target);
           *merge_outcome = svn_wc_merge_merged;
-          return SVN_NO_ERROR;
+          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
+
           /* Issue #3354: We need to install the copyfrom_text,
            * which now carries conflicts, into ACTUAL, by copying
            * it to the merge target. */
           if (copyfrom_text)
             {
-              SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
-                                         copyfrom_text, target_abspath,
-                                         pool));
+              install_from = copyfrom_text;
+              break;
             }
 
-#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. */
           return SVN_NO_ERROR;
         }
     }
+
+  SVN_ERR_ASSERT(install_from != NULL);
+
+  {
+    const svn_skel_t *work_item;
+
+    SVN_ERR(svn_wc__wq_build_file_install(&work_item,
+                                          db, target_abspath,
+                                          install_from,
+                                          FALSE /* use_commit_times */,
+                                          FALSE /* record_fileinfo */,
+                                          pool, pool));
+    SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, pool));
+
+    if (remove_source)
+      {
+        SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
+                                             db, install_from,
+                                             pool, pool));
+        SVN_ERR(svn_wc__db_wq_add(db, adm_abspath, work_item, pool));
+      }
+  }
+
+  return SVN_NO_ERROR;
 }
 
 /* Preserve the three pre-merge files, and modify the



Mime
View raw message