subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r919037 - /subversion/trunk/subversion/libsvn_wc/update_editor.c
Date Thu, 04 Mar 2010 15:56:00 GMT
Author: julianfoad
Date: Thu Mar  4 15:56:00 2010
New Revision: 919037

URL: http://svn.apache.org/viewvc?rev=919037&view=rev
Log:
Tidy the new pristine-text writing code (still guarded by SVN_EXPERIMENTAL).

* subversion/libsvn_wc/update_editor.c
  (handler_baton, file_baton): Move the new pristine-path members to be
    just after the corresponding WC-1 members.
  (window_handler, add_file_with_history): Move the new pristine-path code
    to be just after the corresponding WC-1 code.
  (get_pristine_tee_stream): Add a doc string.
  (apply_textdelta, close_file): Tweak comments.

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=919037&r1=919036&r2=919037&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Mar  4 15:56:00 2010
@@ -378,6 +378,10 @@
 
   /* Where we are assembling the new file. */
   const char *work_path;
+#ifdef SVN_EXPERIMENTAL
+  /* Where the pristine is before we can copy it into the correct location. */
+  const char *temp_pristine_abspath;
+#endif
 
     /* The expected checksum of the text source or NULL if no base
      checksum is available */
@@ -401,11 +405,6 @@
   /* The stream used to calculate the source checksums */
   svn_stream_t *source_checksum_stream;
 
-#ifdef SVN_EXPERIMENTAL
-  /* Where the pristine is before we can copy it into the correct location. */
-  const char *temp_pristine_abspath;
-#endif
-
   /* This is initialized to all zeroes when the baton is created, then
      populated with the MD5 digest of the resultant fulltext after the
      last window is handled by the handler returned from
@@ -930,6 +929,10 @@
      in-progress in the tmp area).  This gets set if there are file
      content changes. */
   const char *new_text_base_path;
+#ifdef SVN_EXPERIMENTAL
+  /* Where the pristine is before we can copy it into the correct location. */
+  const char *temp_pristine_abspath;
+#endif
 
   /* The checksum for the file located at NEW_TEXT_BASE_PATH. */
   svn_checksum_t *md5_actual_checksum;
@@ -978,11 +981,6 @@
   /* Bump information for the directory this file lives in */
   struct bump_dir_info *bump_info;
 
-#ifdef SVN_EXPERIMENTAL
-  /* Where the pristine is before we can copy it into the correct location. */
-  const char *temp_pristine_abspath;
-#endif
-
   /* log accumulator; will be flushed and run in close_file(). */
   svn_stringbuf_t *log_accum;
 };
@@ -1111,15 +1109,14 @@
     {
       /* Tell the file baton about the new text base. */
       fb->new_text_base_path = apr_pstrdup(fb->pool, hb->work_path);
-
-      /* ... and its checksum. */
-      fb->md5_actual_checksum =
-        svn_checksum__from_digest(hb->digest, svn_checksum_md5, fb->pool);
-
 #ifdef SVN_EXPERIMENTAL
       fb->temp_pristine_abspath = apr_pstrdup(fb->pool,
                                               hb->temp_pristine_abspath);
 #endif
+
+      /* ... and its checksums. */
+      fb->md5_actual_checksum =
+        svn_checksum__from_digest(hb->digest, svn_checksum_md5, fb->pool);
       fb->sha1_actual_checksum =
         svn_checksum_dup(hb->sha1_actual_checksum, fb->pool);
     }
@@ -3462,6 +3459,12 @@
 
 
 #ifdef SVN_EXPERIMENTAL
+/* Set *TEE_OUTPUT_STREAM to a writable stream that copies its data to both
+   OUTPUT_STREAM and a new WC-NG pristine temp file corresponding to (DB,
+   LOCAL_ABSPATH). Set *TEMP_PRISTINE_ABSPATH to the path of that file.
+   Arrange that, on stream closure, *ACTUAL_CHECKSUM will be set to the SHA-1
+   checksum of that file.
+ */
 static svn_error_t *
 get_pristine_tee_stream(svn_stream_t **tee_output_stream,
                         const char **temp_pristine_abspath,
@@ -3751,6 +3754,13 @@
                                  temp_dir_path,
                                  svn_io_file_del_none,
                                  pool, pool));
+#ifdef SVN_EXPERIMENTAL
+  /* Copy the 'copied_stream' into a WC-NG pristine temp file as well. */
+  SVN_ERR(get_pristine_tee_stream(&copied_stream, &tfb->temp_pristine_abspath,
+                                  &tfb->sha1_copied_base_checksum, db,
+                                  tfb->local_abspath, copied_stream,
+                                  pool, subpool));
+#endif
 
   /* Compute a checksum for the stream as we write stuff into it.
      ### this is temporary. in many cases, we already *know* the checksum
@@ -3759,12 +3769,6 @@
                                 copied_stream,
                                 NULL, &tfb->md5_copied_base_checksum,
                                 svn_checksum_md5, FALSE, pool);
-#ifdef SVN_EXPERIMENTAL
-  SVN_ERR(get_pristine_tee_stream(&copied_stream, &tfb->temp_pristine_abspath,
-                                  &tfb->sha1_copied_base_checksum, db,
-                                  tfb->local_abspath, copied_stream,
-                                  pool, subpool));
-#endif
 
   if (src_local_abspath != NULL) /* Found a file to copy */
     {
@@ -4427,7 +4431,7 @@
     }
 
 #ifdef SVN_EXPERIMENTAL
-  /* Get a stream for writing our pristine temp.
+  /* Copy the 'target' stream into a WC-NG pristine temp file as well.
      ###: This is currently tee'd for compat. */
   SVN_ERR(get_pristine_tee_stream(&target, &hb->temp_pristine_abspath,
                                   &hb->sha1_actual_checksum,
@@ -5138,6 +5142,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? They should be together. */
   if (fb->temp_pristine_abspath)
     SVN_ERR(svn_wc__db_pristine_install(eb->db, fb->temp_pristine_abspath,
                                         sha1_actual_checksum,



Mime
View raw message