subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r958925 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h update_editor.c
Date Tue, 29 Jun 2010 11:14:36 GMT
Author: julianfoad
Date: Tue Jun 29 11:14:36 2010
New Revision: 958925

URL: http://svn.apache.org/viewvc?rev=958925&view=rev
Log:
Extend a pristine store function to be able to get *both* checksums.

* subversion/libsvn_wc/adm_files.h,
  subversion/libsvn_wc/adm_files.c
  (svn_wc__get_ultimate_base_checksums): Renamed from
    svn_wc__get_ultimate_base_md5_checksum().  Add a second checksum output
    parameter, and make both of the outputs optional.

* subversion/libsvn_wc/update_editor.c
  (apply_textdelta): Adjust the only caller.

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

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=958925&r1=958924&r2=958925&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue Jun 29 11:14:36 2010
@@ -589,29 +589,50 @@ svn_wc__get_pristine_contents(svn_stream
 
 
 svn_error_t *
-svn_wc__get_ultimate_base_md5_checksum(const svn_checksum_t **md5_checksum,
-                                       svn_wc__db_t *db,
-                                       const char *local_abspath,
-                                       apr_pool_t *result_pool,
-                                       apr_pool_t *scratch_pool)
+svn_wc__get_ultimate_base_checksums(const svn_checksum_t **sha1_checksum,
+                                    const svn_checksum_t **md5_checksum,
+                                    svn_wc__db_t *db,
+                                    const char *local_abspath,
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
+  const svn_checksum_t *checksum;
 
   err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
-                                 NULL, NULL, NULL, NULL, NULL, md5_checksum,
+                                 NULL, NULL, NULL, NULL, NULL, &checksum,
                                  NULL, NULL, NULL,
                                  db, local_abspath,
                                  scratch_pool, scratch_pool);
-  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+  if ((err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+      || checksum == NULL)
     {
       svn_error_clear(err);
-      *md5_checksum = NULL;
+      if (sha1_checksum)
+        *sha1_checksum = NULL;
+      if (md5_checksum)
+        *md5_checksum = NULL;
       return SVN_NO_ERROR;
     }
-  if (*md5_checksum && (*md5_checksum)->kind != svn_checksum_md5)
-    SVN_ERR(svn_wc__db_pristine_get_md5(md5_checksum, db, local_abspath,
-                                        *md5_checksum,
-                                        scratch_pool, scratch_pool));
+
+  if (checksum->kind == svn_checksum_sha1)
+    {
+      if (sha1_checksum)
+        *sha1_checksum = checksum;
+      if (md5_checksum)
+        SVN_ERR(svn_wc__db_pristine_get_md5(md5_checksum, db, local_abspath,
+                                            checksum,
+                                            scratch_pool, scratch_pool));
+    }
+  else
+    {
+      if (sha1_checksum)
+        SVN_ERR(svn_wc__db_pristine_get_sha1(sha1_checksum, db, local_abspath,
+                                             checksum,
+                                             scratch_pool, scratch_pool));
+      if (md5_checksum)
+        *md5_checksum = checksum;
+    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=958925&r1=958924&r2=958925&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Tue Jun 29 11:14:36 2010
@@ -221,15 +221,17 @@ svn_wc__ultimate_base_text_path_to_read(
                                         apr_pool_t *result_pool,
                                         apr_pool_t *scratch_pool);
 
-/* Set *MD5_CHECKSUM to the MD-5 checksum of the BASE_NODE pristine text
- * of LOCAL_ABSPATH in DB, or to NULL if it has no BASE_NODE.
- * Allocate *MD5_CHECKSUM in RESULT_POOL. */
+/* Set *SHA1_CHECKSUM and *MD5_CHECKSUM to the SHA-1 and MD-5 checksums of
+ * the BASE_NODE pristine text of LOCAL_ABSPATH in DB, or to NULL if it has
+ * no BASE_NODE.  SHA1_CHECKSUM or MD5_CHECKSUM may be NULL if not required.
+ * Allocate the checksums in RESULT_POOL. */
 svn_error_t *
-svn_wc__get_ultimate_base_md5_checksum(const svn_checksum_t **md5_checksum,
-                                       svn_wc__db_t *db,
-                                       const char *local_abspath,
-                                       apr_pool_t *result_pool,
-                                       apr_pool_t *scratch_pool);
+svn_wc__get_ultimate_base_checksums(const svn_checksum_t **sha1_checksum,
+                                    const svn_checksum_t **md5_checksum,
+                                    svn_wc__db_t *db,
+                                    const char *local_abspath,
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool);
 
 
 

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=958925&r1=958924&r2=958925&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Jun 29 11:14:36 2010
@@ -4037,10 +4037,10 @@ apply_textdelta(void *file_baton,
   {
     const svn_checksum_t *checksum;
 
-    SVN_ERR(svn_wc__get_ultimate_base_md5_checksum(&checksum,
-                                                   fb->edit_baton->db,
-                                                   fb->local_abspath,
-                                                   pool, pool));
+    SVN_ERR(svn_wc__get_ultimate_base_checksums(NULL, &checksum,
+                                                fb->edit_baton->db,
+                                                fb->local_abspath,
+                                                pool, pool));
     recorded_base_checksum
       = checksum ? svn_checksum_to_cstring(checksum, pool) : NULL;
     if (recorded_base_checksum && expected_base_checksum



Mime
View raw message