You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/03/05 14:28:18 UTC

svn commit: r919403 - /subversion/trunk/subversion/libsvn_wc/update_editor.c

Author: julianfoad
Date: Fri Mar  5 13:28:18 2010
New Revision: 919403

URL: http://svn.apache.org/viewvc?rev=919403&view=rev
Log:
Unify two places where a new text base file is installed.

* subversion/libsvn_wc/update_editor.c
  (install_text_base): New function.
  (merge_file, svn_wc_add_repos_file4): Use install_text_base() instead of
    equivalent long-hand code.
  (close_file): Tweak the comment about where the text base is installed.

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

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=919403&r1=919402&r2=919403&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Mar  5 13:28:18 2010
@@ -4632,6 +4632,41 @@
 }
 
 
+/* Write loggy commands to install a text base file from the given temporary
+ * path TEMP_TEXT_BASE_ABSPATH (which must be in the adm temp area) to the
+ * given final text-base path FINAL_TEXT_BASE_ABSPATH (which must be the
+ * standard text-base path or revert-base path for the file).  Install the
+ * new file's checksum CHECKSUM into ENTRY.
+ *
+ * Write log instructions to do this into *LOG_ACCUM, and update ENTRY and
+ * ENTRY_MODIFY_FLAGS with the required changes.  Store all loggy paths as
+ * paths relative to ADM_ABSPATH.
+ *
+ * Allocate *LOG_ACCUM in RESULT_POOL if it is NULL.
+ */
+static svn_error_t *
+install_text_base(svn_stringbuf_t **log_accum,
+                  svn_wc_entry_t *entry,
+                  apr_uint64_t *entry_modify_flags,
+                  const char *adm_abspath,
+                  const char *temp_text_base_abspath,
+                  const char *final_text_base_abspath,
+                  const svn_checksum_t *checksum,
+                  apr_pool_t *result_pool,
+                  apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_wc__loggy_move(log_accum, adm_abspath,
+                             temp_text_base_abspath, final_text_base_abspath,
+                             result_pool, scratch_pool));
+  SVN_ERR(svn_wc__loggy_set_readonly(log_accum, adm_abspath,
+                                     final_text_base_abspath,
+                                     result_pool, scratch_pool));
+  entry->checksum = svn_checksum_to_cstring(checksum, result_pool);
+  *entry_modify_flags |= SVN_WC__ENTRY_MODIFY_CHECKSUM;
+  return SVN_NO_ERROR;
+}
+
+
 /* This is the small planet.  It has the complex responsibility of
  * "integrating" a new revision of a file into a working copy.
  *
@@ -4981,14 +5016,9 @@
   /* Deal with installation of the new textbase, if appropriate. */
   if (new_text_base_abspath)
     {
-      SVN_ERR(svn_wc__loggy_move(&log_accum,
-                                 pb->local_abspath,
-                                 new_text_base_abspath,
-                                 fb->text_base_path, pool, pool));
-      SVN_ERR(svn_wc__loggy_set_readonly(&log_accum, pb->local_abspath,
-                                         fb->text_base_path, pool, pool));
-      tmp_entry.checksum = svn_checksum_to_cstring(actual_checksum, pool);
-      flags |= SVN_WC__ENTRY_MODIFY_CHECKSUM;
+      SVN_ERR(install_text_base(&log_accum, &tmp_entry, &flags, pb->local_abspath,
+                                new_text_base_abspath, fb->text_base_path,
+                                actual_checksum, pool, pool));
     }
 
   /* If FB->PATH is locally deleted, but not as part of a replacement
@@ -5138,7 +5168,7 @@
 
 #ifdef SVN_EXPERIMENTAL
   /* If we had a text change, drop the pristine into it's proper place. */
-  /* ### Where's the WC-1 equivalent code? Shouldn't they be together?
+  /* The WC-1 equivalent code is in merge_file(). Shouldn't they be together?
      Bert said: In 1.0 the install of the .svn-base has to be done in loggy/wq
      (or it can break your wc), while with the new pristine the file can and
      should be created directly and then later in a single transaction we can
@@ -6116,21 +6146,22 @@
 
   /* Install new text base. */
   {
+    const char *tmp_text_base_abspath;
     svn_wc_entry_t tmp_entry;
+    apr_uint64_t flags = 0;
+
+    SVN_ERR(svn_dirent_get_absolute(&tmp_text_base_abspath, tmp_text_base_path,
+                                    pool));
 
-    /* Write out log commands to set up the new text base and its
-       checksum. */
-    SVN_ERR(svn_wc__loggy_move(&post_props_accum, dir_abspath,
-                               tmp_text_base_path, text_base_path,
-                               pool, pool));
-    SVN_ERR(svn_wc__loggy_set_readonly(&post_props_accum, dir_abspath,
-                                       text_base_path, pool, pool));
+    /* Write out log commands to set up the new text base and its checksum. */
+    SVN_ERR(install_text_base(&post_props_accum, &tmp_entry, &flags,
+                              dir_abspath,
+                              tmp_text_base_abspath, text_base_path,
+                              base_checksum, pool, pool));
 
-    tmp_entry.checksum = svn_checksum_to_cstring(base_checksum, pool);
     SVN_ERR(svn_wc__loggy_entry_modify(&post_props_accum, dir_abspath,
                                        local_abspath, &tmp_entry,
-                                       SVN_WC__ENTRY_MODIFY_CHECKSUM,
-                                       pool, pool));
+                                       flags, pool, pool));
   }
 
   /* Write our accumulation of log entries into a log file */