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/04/09 13:39:22 UTC

svn commit: r932361 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc-queries.sql wc_db.c wc_db.h

Author: julianfoad
Date: Fri Apr  9 11:39:22 2010
New Revision: 932361

URL: http://svn.apache.org/viewvc?rev=932361&view=rev
Log:
When performing an update, insert the SHA-1 of the new text base into the
database.  (Nothing retrieves the pristine text through this field yet; it
is installed in parallel with the old WC-1 text base which is still in use.)

* subversion/libsvn_wc/update_editor.c
  (merge_file): Take the SHA-1 checksum as well as the MD-5 checksum and
    use it, within #ifdef SVN_EXPERIMENTAL, to install the new text base.
  (close_file): Pass the SHA-1 checksum to merge_file().

* subversion/libsvn_wc/wc_db.c,
  subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_set_base_checksum): New function.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_UPDATE_BASE_PRISTINE_CHECKSUM): New statement.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=932361&r1=932360&r2=932361&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Apr  9 11:39:22 2010
@@ -4236,14 +4236,15 @@ install_text_base(svn_stringbuf_t **log_
  * this file, and removed after a successful run of the generated log
  * commands.
  *
+ * NEW_TEXT_BASE_MD5_CHECKSUM and NEW_TEXT_BASE_SHA1_CHECKSUM are the
+ * checksums that were computed as we constructed the (new) text base.
+ * (That was performed during a txdelta apply, or during a copy of an
+ * add-with-history.)
+ *
  * Set *CONTENT_STATE to the state of the contents after the
  * installation.  If an error is returned, the value of these three
  * variables is undefined.
  *
- * NEW_TEXT_BASE_MD5_CHECKSUM is the checksum that was computed as we
- * constructed the (new) text base. That was performed during a txdelta
- * apply, or during a copy of an add-with-history.
- *
  * POOL is used for all bookkeeping work during the installation.
  */
 static svn_error_t *
@@ -4255,6 +4256,7 @@ merge_file(svn_stringbuf_t **log_accum,
            struct file_baton *fb,
            const char *new_text_base_tmp_abspath,
            const svn_checksum_t *new_text_base_md5_checksum,
+           const svn_checksum_t *new_text_base_sha1_checksum,
            apr_pool_t *pool)
 {
   struct edit_baton *eb = fb->edit_baton;
@@ -4598,6 +4600,10 @@ merge_file(svn_stringbuf_t **log_accum,
   /* Deal with installation of the new textbase, if appropriate. */
   if (new_text_base_tmp_abspath)
     {
+      /* Move the temp text-base file to its final destination and install
+       * its checksum in the entry.  FB->text_base_path is the appropriate
+       * path: the "revert-base" path if the node is replaced, else the
+       * usual text-base path. */
       SVN_ERR(install_text_base(log_accum, pb->local_abspath,
                                 new_text_base_tmp_abspath,
                                 fb->text_base_abspath,
@@ -4605,6 +4611,16 @@ merge_file(svn_stringbuf_t **log_accum,
       tmp_entry.checksum = svn_checksum_to_cstring(new_text_base_md5_checksum,
                                                    pool);
       flags |= SVN_WC__ENTRY_MODIFY_CHECKSUM;
+
+#ifdef SVN_EXPERIMENTAL
+      /* Set the 'checksum' column of the file's BASE_NODE row to
+       * NEW_TEXT_BASE_SHA1_CHECKSUM.  The pristine text identified by that
+       * checksum is already in the pristine store. */
+      /* ### This should be done as part of a single "global_update"
+       * operation. */
+      svn_wc__db_temp_set_base_checksum(eb->db, fb->local_abspath,
+                                        new_text_base_sha1_checksum, pool);
+#endif
     }
 
   /* If FB->PATH is locally deleted, but not as part of a replacement
@@ -4944,7 +4960,7 @@ close_file(void *file_baton,
   SVN_ERR(merge_file(&delayed_log_accum, &install_pristine, &install_from,
                      &content_state, entry,
                      fb, new_text_base_abspath, new_text_base_md5_checksum,
-                     pool));
+                     new_text_base_sha1_checksum, pool));
 
   /* Queue all operations.  */
   SVN_WC__FLUSH_LOG_ACCUM(eb->db, fb->dir_baton->local_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=932361&r1=932360&r2=932361&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Apr  9 11:39:22 2010
@@ -372,6 +372,10 @@ SELECT 0 FROM BASE_NODE WHERE wc_id = ?1
 UNION
 SELECT 1 FROM WORKING_NODE WHERE wc_id = ?1 AND local_relpath = ?2;
 
+-- STMT_UPDATE_BASE_PRISTINE_CHECKSUM
+update base_node set checksum = ?3
+where wc_id = ?1 and local_relpath = ?2;
+
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=932361&r1=932360&r2=932361&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Apr  9 11:39:22 2010
@@ -7172,3 +7172,28 @@ svn_wc__db_temp_get_file_external(const 
 
   return svn_error_return(svn_sqlite__reset(stmt));
 }
+
+
+svn_error_t *
+svn_wc__db_temp_set_base_checksum(svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  const svn_checksum_t *new_sha1_checksum,
+                                  apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  const char *new_sha1_digest;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+  SVN_ERR_ASSERT(new_sha1_checksum->kind == svn_checksum_sha1);
+
+  new_sha1_digest = svn_checksum_serialize(new_sha1_checksum,
+                                           scratch_pool, scratch_pool);
+
+  SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
+                                 STMT_UPDATE_BASE_PRISTINE_CHECKSUM,
+                                 scratch_pool));
+  SVN_ERR(svn_sqlite__bind_text(stmt, 3, new_sha1_digest));
+  SVN_ERR(svn_sqlite__step_done(stmt));
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=932361&r1=932360&r2=932361&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Apr  9 11:39:22 2010
@@ -2132,6 +2132,16 @@ svn_wc__db_temp_get_file_external(const 
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);
 
+
+/* Set the pristine text SHA-1 checksum for the BASE_NODE of LOCAL_ABSPATH
+   to NEW_SHA1_CHECKSUM.  The pristine text identified by NEW_SHA1_CHECKSUM
+   must already be in the pristine store. */
+svn_error_t *
+svn_wc__db_temp_set_base_checksum(svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  const svn_checksum_t *new_sha1_checksum,
+                                  apr_pool_t *scratch_pool);
+
 /* @} */
 
 



Re: svn commit: r932361 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc-queries.sql wc_db.c wc_db.h

Posted by Greg Stein <gs...@gmail.com>.
On Fri, Apr 9, 2010 at 07:39,  <ju...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Apr  9 11:39:22 2010
> @@ -7172,3 +7172,28 @@ svn_wc__db_temp_get_file_external(const
>
>   return svn_error_return(svn_sqlite__reset(stmt));
>  }
> +
> +
> +svn_error_t *
> +svn_wc__db_temp_set_base_checksum(svn_wc__db_t *db,
> +                                  const char *local_abspath,
> +                                  const svn_checksum_t *new_sha1_checksum,
> +                                  apr_pool_t *scratch_pool)
> +{
> +  svn_sqlite__stmt_t *stmt;
> +  const char *new_sha1_digest;
> +
> +  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> +  SVN_ERR_ASSERT(new_sha1_checksum->kind == svn_checksum_sha1);
> +
> +  new_sha1_digest = svn_checksum_serialize(new_sha1_checksum,
> +                                           scratch_pool, scratch_pool);
> +
> +  SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
> +                                 STMT_UPDATE_BASE_PRISTINE_CHECKSUM,
> +                                 scratch_pool));
> +  SVN_ERR(svn_sqlite__bind_text(stmt, 3, new_sha1_digest));
> +  SVN_ERR(svn_sqlite__step_done(stmt));
> +
> +  return SVN_NO_ERROR;

Maybe use svn_sqlite__update() and ensure that 1 row was affected? And
if not, return SVN_ERR_WC_PATH_NOT_FOUND.

>...

Cheers,
-g