subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r932267 - in /subversion/trunk/subversion/libsvn_wc: log.c log.h merge.c
Date Fri, 09 Apr 2010 06:41:38 GMT
Author: gstein
Date: Fri Apr  9 06:41:38 2010
New Revision: 932267

URL: http://svn.apache.org/viewvc?rev=932267&view=rev
Log:
Convert svn_wc__loggy_copy() over to immediate queueing, rather than an
accumulator.

* subversion/libsvn_wc/log.h:
  (svn_wc__loggy_copy): adjust params for immediately queueing, rather
    than filling items into a LOG_ACCUM. note that path parameters should
    be absolute paths.

* subversion/libsvn_wc/log.c:
  (loggy_move_copy_internal): removed. the move/copy functions queue
    differently, so this helper doesn't apply any more.
  (svn_wc__loggy_copy): adjust params, and assert their abspath-ness. fold
    loggy_move_copy_internal into this function, for the copy branch.
    assert against the "source doesn't exist" stupidity. directly queue
    the resulting loggy item.
  (svn_wc__loggy_move): fold loggy_move_copy_internal into this function,
    for the move branch. again, assert against the non-existent source.

* subversion/libsvn_wc/merge.c:
  (save_merge_result, eval_conflict_func_result): forget LOG_ACCUM
    localvar, as loggy_copy will now queue the work item directly.
  (merge_text_file, merge_binary_file): adjust params to loggy_copy

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

Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=932267&r1=932266&r2=932267&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Fri Apr  9 06:41:38 2010
@@ -710,48 +710,6 @@ svn_wc__run_xml_log(svn_wc__db_t *db,
 }
 
 
-/*** Log file generation helpers ***/
-
-/* Extend LOG_ACCUM with log operations to do MOVE_COPY_OP to SRC_PATH and
- * DST_PATH.
- *
- * SRC_PATH and DST_PATH are relative to ADM_ABSPATH.
- */
-static svn_error_t *
-loggy_move_copy_internal(svn_stringbuf_t **log_accum,
-                         svn_boolean_t is_move,
-                         const char *adm_abspath,
-                         const char *src_path, const char *dst_path,
-                         apr_pool_t *result_pool,
-                         apr_pool_t *scratch_pool)
-{
-  svn_node_kind_t kind;
-  const char *src_abspath = svn_dirent_join(adm_abspath, src_path,
-                                            scratch_pool);
-
-  SVN_ERR(svn_io_check_path(src_abspath, &kind, scratch_pool));
-
-  /* Does this file exist? */
-  if (kind != svn_node_none)
-    {
-      svn_xml_make_open_tag(log_accum, result_pool,
-                            svn_xml_self_closing,
-                            is_move
-                              ? SVN_WC__LOG_MV
-                              : SVN_WC__LOG_CP_AND_TRANSLATE,
-                            SVN_WC__LOG_ATTR_NAME,
-                            src_path,
-                            SVN_WC__LOG_ATTR_DEST,
-                            dst_path,
-                            NULL);
-    }
-
-  return SVN_NO_ERROR;
-}
-
-
-
-
 /* Return the portion of PATH that is relative to the working copy directory
  * ADM_ABSPATH, or SVN_WC_ENTRY_THIS_DIR if PATH is that directory. PATH must
  * not be outside that directory. */
@@ -807,22 +765,46 @@ svn_wc__loggy_append(svn_wc__db_t *db,
 
 
 svn_error_t *
-svn_wc__loggy_copy(svn_stringbuf_t **log_accum,
+svn_wc__loggy_copy(svn_wc__db_t *db,
                    const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
+                   const char *src_abspath,
+                   const char *dst_abspath,
                    apr_pool_t *scratch_pool)
 {
   const char *loggy_path1;
   const char *loggy_path2;
+  svn_node_kind_t kind;
 
-  SVN_ERR(loggy_path(&loggy_path1, src_path, adm_abspath, scratch_pool));
-  SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_abspath, scratch_pool));
-  return loggy_move_copy_internal(log_accum, FALSE, adm_abspath,
-                                  loggy_path1, loggy_path2,
-                                  result_pool, scratch_pool);
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
+
+  SVN_ERR(loggy_path(&loggy_path1, src_abspath, adm_abspath, scratch_pool));
+  SVN_ERR(loggy_path(&loggy_path2, dst_abspath, adm_abspath, scratch_pool));
+
+  SVN_ERR(svn_io_check_path(src_abspath, &kind, scratch_pool));
+
+  /* ### idiocy of the old world. the file better exist, if we're asking
+     ### to do some work with it.  */
+  SVN_ERR_ASSERT(kind != svn_node_none);
+
+  {
+    svn_stringbuf_t *log_accum = NULL;
+
+    svn_xml_make_open_tag(&log_accum, scratch_pool,
+                          svn_xml_self_closing,
+                          SVN_WC__LOG_CP_AND_TRANSLATE,
+                          SVN_WC__LOG_ATTR_NAME,
+                          loggy_path1,
+                          SVN_WC__LOG_ATTR_DEST,
+                          loggy_path2,
+                          NULL);
+    SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, scratch_pool));
+  }
+
+  return SVN_NO_ERROR;
 }
 
+
 svn_error_t *
 svn_wc__loggy_translated_file(svn_wc__db_t *db,
                               const char *adm_abspath,
@@ -1025,12 +1007,29 @@ svn_wc__loggy_move(svn_stringbuf_t **log
 {
   const char *loggy_path1;
   const char *loggy_path2;
+  svn_node_kind_t kind;
+  const char *src_abspath = svn_dirent_join(adm_abspath, src_path,
+                                            scratch_pool);
 
   SVN_ERR(loggy_path(&loggy_path1, src_path, adm_abspath, scratch_pool));
   SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_abspath, scratch_pool));
-  return loggy_move_copy_internal(log_accum, TRUE, adm_abspath,
-                                  loggy_path1, loggy_path2,
-                                  result_pool, scratch_pool);
+
+  SVN_ERR(svn_io_check_path(src_abspath, &kind, scratch_pool));
+
+  /* ### idiocy of the old world. the file better exist, if we're asking
+     ### to do some work with it.  */
+  SVN_ERR_ASSERT(kind != svn_node_none);
+
+  svn_xml_make_open_tag(log_accum, result_pool,
+                        svn_xml_self_closing,
+                        SVN_WC__LOG_MV,
+                        SVN_WC__LOG_ATTR_NAME,
+                        loggy_path1,
+                        SVN_WC__LOG_ATTR_DEST,
+                        loggy_path2,
+                        NULL);
+
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/log.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.h?rev=932267&r1=932266&r2=932267&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.h (original)
+++ subversion/trunk/subversion/libsvn_wc/log.h Fri Apr  9 06:41:38 2010
@@ -83,23 +83,12 @@ svn_wc__loggy_append(svn_wc__db_t *db,
                      apr_pool_t *scratch_pool);
 
 
-/* Extend **LOG_ACCUM with log instructions to copy (and translate!) the
-   file SRC_PATH to DST_PATH, if it exists. If it doesn't and
-   REMOVE_DST_IF_NO_SRC is TRUE the file at DST_PATH will be deleted if any.
-
-   The test for existence is made during this call, not at log running time.
-
-   ADM_ABSPATH is the absolute path for the admin directory for PATH.
-   SRC_PATH and DST_PATH are relative to ADM_ABSPATH.
-
-   Allocate *LOG_ACCUM in RESULT_POOL if it is NULL. Use SCRATCH_POOL for
-   temporary allocations.
-*/
+/* Queue instructions to copy/translate SRC_ABSPATH to DST_ABSPATH.  */
 svn_error_t *
-svn_wc__loggy_copy(svn_stringbuf_t **log_accum,
+svn_wc__loggy_copy(svn_wc__db_t *db,
                    const char *adm_abspath,
-                   const char *src_path, const char *dst_path,
-                   apr_pool_t *result_pool,
+                   const char *src_abspath,
+                   const char *dst_abspath,
                    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=932267&r1=932266&r2=932267&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Fri Apr  9 06:41:38 2010
@@ -405,7 +405,6 @@ save_merge_result(svn_wc__db_t *db,
   const char *edited_copy;
   const char *merge_dirpath;
   const char *merge_filename;
-  svn_stringbuf_t *log_accum = NULL;
 
   svn_dirent_split(target_abspath, &merge_dirpath, &merge_filename, pool);
 
@@ -417,9 +416,8 @@ save_merge_result(svn_wc__db_t *db,
                                      ".edited",
                                      svn_io_file_del_none,
                                      pool, pool));
-  SVN_ERR(svn_wc__loggy_copy(&log_accum, merge_dirpath,
-                             result_target, edited_copy, pool, pool));
-  SVN_ERR(svn_wc__wq_add_loggy(db, merge_dirpath, log_accum, pool));
+  SVN_ERR(svn_wc__loggy_copy(db, merge_dirpath,
+                             result_target, edited_copy, pool));
 
   return SVN_NO_ERROR;
 }
@@ -447,27 +445,23 @@ eval_conflict_func_result(enum svn_wc_me
                           svn_diff_file_options_t *options,
                           apr_pool_t *pool)
 {
-  svn_stringbuf_t *log_accum = NULL;
-
   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(&log_accum, adm_abspath,
+          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
                                      left_abspath, target_abspath,
-                                     pool, pool));
-          SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, pool));
+                                     pool));
           *merge_outcome = svn_wc_merge_merged;
           return SVN_NO_ERROR;
         }
       case svn_wc_conflict_choose_theirs_full:
         {
-          SVN_ERR(svn_wc__loggy_copy(&log_accum, adm_abspath,
+          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
                                      right_abspath, target_abspath,
-                                     pool, pool));
-          SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, pool));
+                                     pool));
           *merge_outcome = svn_wc_merge_merged;
           return SVN_NO_ERROR;
         }
@@ -510,9 +504,8 @@ eval_conflict_func_result(enum svn_wc_me
                                               style,
                                               pool));
           SVN_ERR(svn_stream_close(chosen_stream));
-          SVN_ERR(svn_wc__loggy_copy(&log_accum, adm_abspath,
-                                     chosen_path, target_abspath, pool, pool));
-          SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, pool));
+          SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
+                                     chosen_path, target_abspath, pool));
           *merge_outcome = svn_wc_merge_merged;
           return SVN_NO_ERROR;
         }
@@ -525,15 +518,14 @@ eval_conflict_func_result(enum svn_wc_me
            good to use". */
       case svn_wc_conflict_choose_merged:
         {
-          SVN_ERR(svn_wc__loggy_copy(&log_accum, adm_abspath,
+          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, pool));
-          SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, pool));
+                                     pool));
           *merge_outcome = svn_wc_merge_merged;
           return SVN_NO_ERROR;
         }
@@ -545,10 +537,9 @@ eval_conflict_func_result(enum svn_wc_me
            * it to the merge target. */
           if (copyfrom_text)
             {
-              SVN_ERR(svn_wc__loggy_copy(&log_accum, adm_abspath,
+              SVN_ERR(svn_wc__loggy_copy(db, adm_abspath,
                                          copyfrom_text, target_abspath,
-                                         pool, pool));
-              SVN_ERR(svn_wc__wq_add_loggy(db, adm_abspath, log_accum, pool));
+                                         pool));
             }
 
           /* Assume conflict remains. */
@@ -963,9 +954,8 @@ merge_text_file(svn_stringbuf_t **log_ac
   if (*merge_outcome != svn_wc_merge_unchanged && ! dry_run)
     {
       /* replace TARGET_ABSPATH with the new merged file, expanding. */
-      SVN_ERR(svn_wc__loggy_copy(log_accum, dir_abspath,
-                                 result_target, target_abspath, pool, pool));
-      SVN_WC__FLUSH_LOG_ACCUM(db, dir_abspath, *log_accum, pool);
+      SVN_ERR(svn_wc__loggy_copy(db, dir_abspath,
+                                 result_target, target_abspath, pool));
     }
 
   return SVN_NO_ERROR;
@@ -1035,21 +1025,17 @@ merge_binary_file(svn_stringbuf_t **log_
              unless the conflict-callback did the merging itself. */
           case svn_wc_conflict_choose_base:
             {
-              SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                         merge_dirpath,
+              SVN_ERR(svn_wc__loggy_copy(db, merge_dirpath,
                                          left_abspath, target_abspath,
-                                         pool, pool));
-              SVN_WC__FLUSH_LOG_ACCUM(db, merge_dirpath, *log_accum, pool);
+                                         pool));
               *merge_outcome = svn_wc_merge_merged;
               return SVN_NO_ERROR;
             }
           case svn_wc_conflict_choose_theirs_full:
             {
-              SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                         merge_dirpath,
+              SVN_ERR(svn_wc__loggy_copy(db, merge_dirpath,
                                          right_abspath, target_abspath,
-                                         pool, pool));
-              SVN_WC__FLUSH_LOG_ACCUM(db, merge_dirpath, *log_accum, pool);
+                                         pool));
               *merge_outcome = svn_wc_merge_merged;
               return SVN_NO_ERROR;
             }
@@ -1075,12 +1061,10 @@ merge_binary_file(svn_stringbuf_t **log_
                 }
               else
                 {
-                  SVN_ERR(svn_wc__loggy_copy(log_accum,
-                                             merge_dirpath,
+                  SVN_ERR(svn_wc__loggy_copy(db, merge_dirpath,
                                              result->merged_file,
                                              target_abspath,
-                                             pool, pool));
-                  SVN_WC__FLUSH_LOG_ACCUM(db, merge_dirpath, *log_accum, pool);
+                                             pool));
                   *merge_outcome = svn_wc_merge_merged;
                   return SVN_NO_ERROR;
                 }



Mime
View raw message