You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/15 11:31:44 UTC

svn commit: r1092639 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/commit.c libsvn_wc/adm_ops.c libsvn_wc/deprecated.c libsvn_wc/wc.h

Author: rhuijben
Date: Fri Apr 15 09:31:44 2011
New Revision: 1092639

URL: http://svn.apache.org/viewvc?rev=1092639&view=rev
Log:
Remove an unused md5_checksum from the commit processing. Also make a
few deprecated functions retrieve the sha1 for their md5, where they
used to pass NULL. This connects them to existing pristines wh

This commit has no functional changes on the non-deprecated functions,
and should fix some usages of the deprecated ones.

* subversion/include/svn_wc.h
  (svn_wc_queue_committed3): Remove md5 checksum argument.

* subversion/libsvn_client/commit.c
  (post_process_commit_item): Remove md5_checksum argument. Update caller.
  (svn_client_commit5): Don't store md5 checksums. Update caller.

* subversion/libsvn_wc/adm_ops.c

* subversion/libsvn_wc/adm_ops.c
  (committed_queue_item_t): Remove md5_checksum.
  (svn_wc__process_committed_internal): Remove md5_checksum argument and
    recursion.
  (svn_wc_queue_committed3): Don't set md5 checksum in baton
  (svn_wc_process_committed_queue2): Update caller.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_queue_committed2): Get sha1 checksum if an MD5 checksum was provided.

* subversion/libsvn_wc/wc.h
  (svn_wc__process_committed_internal): Remove md5_checksum argument and update
    documentation.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1092639&r1=1092638&r2=1092639&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Fri Apr 15 09:31:44 2011
@@ -4761,15 +4761,9 @@ svn_wc_committed_queue_create(apr_pool_t
  * If @a remove_changelist is @c TRUE, any association with a
  * changelist will be removed.
  *
- * If @a local_abspath is a file and @a md5_checksum is non-NULL, use @a md5_checksum
- * as the checksum for the new text base. Otherwise, calculate the checksum
- * if needed.
- *   ### [JAF]  No, it doesn't calculate the checksum, it stores null in wc.db:
- *   ### see svn_wc__process_committed_internal().
- *
- * If @a sha1_checksum is non-NULL, use it instead of @a md5_checksum to
- * identify the node's pristine text.
- * ### NOT YET IMPLEMENTED.
+ *
+ * If @a sha1_checksum is non-NULL, use it to identify the node's pristine
+ * text.
  *
  * If @a recurse is TRUE and @a local_abspath is a directory, then bump every
  * versioned object at or under @a local_abspath.  This is usually done for
@@ -4781,13 +4775,11 @@ svn_wc_committed_queue_create(apr_pool_t
  *       'wcprop_changes' = NULL;
  *       'remove_lock' = FALSE;
  *       'remove_changelist' from the recursive parent item;
- *       'md5_checksum' from the child item in the queue;
  *     and any children (at any depth) of that directory that are NOT in
  *     the queue as separate items will get:
  *       'wcprop_changes' = NULL;
  *       'remove_lock' = FALSE;
  *       'remove_changelist' from the recursive parent item;
- *       'md5_checksum' = NULL  ### means what?
  *
  * @note the @a recurse parameter should be used with extreme care since
  * it will bump ALL nodes under the directory, regardless of their
@@ -4810,7 +4802,6 @@ svn_wc_queue_committed3(svn_wc_committed
                         const apr_array_header_t *wcprop_changes,
                         svn_boolean_t remove_lock,
                         svn_boolean_t remove_changelist,
-                        const svn_checksum_t *md5_checksum,
                         const svn_checksum_t *sha1_checksum,
                         apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1092639&r1=1092638&r2=1092639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Fri Apr 15 09:31:44 2011
@@ -918,7 +918,6 @@ post_process_commit_item(svn_wc_committe
                          svn_wc_context_t *wc_ctx,
                          svn_boolean_t keep_changelists,
                          svn_boolean_t keep_locks,
-                         const svn_checksum_t *md5_checksum,
                          const svn_checksum_t *sha1_checksum,
                          apr_pool_t *scratch_pool)
 {
@@ -936,7 +935,7 @@ post_process_commit_item(svn_wc_committe
   return svn_wc_queue_committed3(queue, wc_ctx, item->path,
                                  loop_recurse, item->incoming_prop_changes,
                                  remove_lock, !keep_changelists,
-                                 md5_checksum, sha1_checksum, scratch_pool);
+                                 sha1_checksum, scratch_pool);
 }
 
 
@@ -1139,7 +1138,6 @@ svn_client_commit5(const apr_array_heade
   apr_array_header_t *locks_obtained;
   apr_hash_t *committables;
   apr_hash_t *lock_tokens;
-  apr_hash_t *md5_checksums;
   apr_hash_t *sha1_checksums;
   apr_array_header_t *commit_items;
   svn_error_t *cmt_err = SVN_NO_ERROR;
@@ -1341,7 +1339,7 @@ svn_client_commit5(const apr_array_heade
   /* Perform the commit. */
   cmt_err = svn_error_return(
             svn_client__do_commit(base_url, commit_items, editor, edit_baton,
-                                  notify_prefix, &md5_checksums,
+                                  notify_prefix, NULL,
                                   &sha1_checksums, ctx, pool));
 
   /* Handle a successful commit. */
@@ -1361,9 +1359,6 @@ svn_client_commit5(const apr_array_heade
           svn_pool_clear(iterpool);
           bump_err = post_process_commit_item(queue, item, ctx->wc_ctx,
                                               keep_changelists, keep_locks,
-                                              apr_hash_get(md5_checksums,
-                                                           item->path,
-                                                           APR_HASH_KEY_STRING),
                                               apr_hash_get(sha1_checksums,
                                                            item->path,
                                                            APR_HASH_KEY_STRING),

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1092639&r1=1092638&r2=1092639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Apr 15 09:31:44 2011
@@ -81,8 +81,7 @@ typedef struct committed_queue_item_t
   svn_boolean_t no_unlock;
   svn_boolean_t keep_changelist;
 
-  /* The pristine text checksum(s). Either or both may be present. */
-  const svn_checksum_t *md5_checksum;
+  /* The pristine text checksum. */
   const svn_checksum_t *sha1_checksum;
 
   apr_hash_t *new_dav_cache;
@@ -233,7 +232,6 @@ svn_wc__process_committed_internal(svn_w
                                    apr_hash_t *new_dav_cache,
                                    svn_boolean_t no_unlock,
                                    svn_boolean_t keep_changelist,
-                                   const svn_checksum_t *md5_checksum,
                                    const svn_checksum_t *sha1_checksum,
                                    const svn_wc_committed_queue_t *queue,
                                    apr_pool_t *scratch_pool)
@@ -293,7 +291,6 @@ svn_wc__process_committed_internal(svn_w
           if (status == svn_wc__db_status_excluded)
             continue;
 
-          md5_checksum = NULL;
           sha1_checksum = NULL;
           if (kind != svn_wc__db_kind_dir)
             {
@@ -305,7 +302,6 @@ svn_wc__process_committed_internal(svn_w
 
                   if (cqi != NULL)
                     {
-                      md5_checksum = cqi->md5_checksum;
                       sha1_checksum = cqi->sha1_checksum;
                     }
                 }
@@ -322,7 +318,6 @@ svn_wc__process_committed_internal(svn_w
                                                      NULL,
                                                      TRUE /* no_unlock */,
                                                      keep_changelist,
-                                                     md5_checksum,
                                                      sha1_checksum,
                                                      queue, iterpool));
 
@@ -381,7 +376,6 @@ svn_wc_queue_committed3(svn_wc_committed
                         const apr_array_header_t *wcprop_changes,
                         svn_boolean_t remove_lock,
                         svn_boolean_t remove_changelist,
-                        const svn_checksum_t *md5_checksum,
                         const svn_checksum_t *sha1_checksum,
                         apr_pool_t *scratch_pool)
 {
@@ -401,7 +395,6 @@ svn_wc_queue_committed3(svn_wc_committed
   cqi->recurse = recurse;
   cqi->no_unlock = !remove_lock;
   cqi->keep_changelist = !remove_changelist;
-  cqi->md5_checksum = md5_checksum;
   cqi->sha1_checksum = sha1_checksum;
   cqi->new_dav_cache = svn_wc__prop_array_to_hash(wcprop_changes, queue->pool);
 
@@ -482,7 +475,6 @@ svn_wc_process_committed_queue2(svn_wc_c
                                                  cqi->new_dav_cache,
                                                  cqi->no_unlock,
                                                  cqi->keep_changelist,
-                                                 cqi->md5_checksum,
                                                  cqi->sha1_checksum, queue,
                                                  iterpool));
 

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1092639&r1=1092638&r2=1092639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Fri Apr 15 09:31:44 2011
@@ -575,14 +575,33 @@ svn_wc_queue_committed2(svn_wc_committed
 {
   svn_wc_context_t *wc_ctx;
   const char *local_abspath;
+  svn_checksum_t *sha1_checksum = NULL;
 
   SVN_ERR(svn_wc_context_create(&wc_ctx, NULL, scratch_pool, scratch_pool));
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
 
+  if (md5_checksum != NULL)
+    {
+      svn_error_t *err;
+      err = svn_wc__db_pristine_get_sha1(&sha1_checksum, wc_ctx->db,
+                                         local_abspath, md5_checksum,
+                                         svn_wc__get_committed_queue_pool(queue),
+                                         scratch_pool);
+
+      /* Don't fail on SHA1 not found */
+      if (err && err->apr_err == SVN_ERR_WC_DB_ERROR)
+        {
+          svn_error_clear(err);
+          sha1_checksum = NULL;
+        }
+      else
+        SVN_ERR(err);
+    }
+
   SVN_ERR(svn_wc_queue_committed3(queue, wc_ctx, local_abspath, recurse,
                                   wcprop_changes,
-                                  remove_lock, remove_changelist, md5_checksum,
-                                  NULL /* sha1_checksum */, scratch_pool));
+                                  remove_lock, remove_changelist,
+                                  sha1_checksum, scratch_pool));
 
   return svn_error_return(svn_wc_context_destroy(wc_ctx));
 }
@@ -647,28 +666,45 @@ svn_wc_process_committed4(const char *pa
 {
   svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
   const char *local_abspath;
-  const svn_checksum_t *checksum;
+  const svn_checksum_t *md5_checksum;
+  const svn_checksum_t *sha1_checksum = NULL;
   apr_time_t new_date;
   apr_hash_t *wcprop_changes_hash;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+
   if (rev_date)
     SVN_ERR(svn_time_from_cstring(&new_date, rev_date, pool));
   else
     new_date = 0;
 
   if (digest)
-    checksum = svn_checksum__from_digest(digest, svn_checksum_md5, pool);
+    md5_checksum = svn_checksum__from_digest(digest, svn_checksum_md5, pool);
   else
-    checksum = NULL;
+    md5_checksum = NULL;
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+  if (md5_checksum != NULL)
+    {
+      svn_error_t *err;
+      err = svn_wc__db_pristine_get_sha1(&sha1_checksum, db,
+                                         local_abspath, md5_checksum,
+                                         pool, pool);
+
+      if (err && err->apr_err == SVN_ERR_WC_DB_ERROR)
+        {
+          svn_error_clear(err);
+          sha1_checksum = NULL;
+        }
+      else
+        SVN_ERR(err);
+    }
 
   wcprop_changes_hash = svn_wc__prop_array_to_hash(wcprop_changes, pool);
   SVN_ERR(svn_wc__process_committed_internal(db, local_abspath, recurse, TRUE,
                                              new_revnum, new_date, rev_author,
                                              wcprop_changes_hash,
                                              !remove_lock, !remove_changelist,
-                                             checksum, NULL, NULL, pool));
+                                             sha1_checksum, NULL, pool));
 
   /* Run the log file(s) we just created. */
   return svn_error_return(svn_wc__wq_run(db, local_abspath, NULL, NULL, pool));

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1092639&r1=1092638&r2=1092639&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Fri Apr 15 09:31:44 2011
@@ -258,14 +258,8 @@ svn_wc__get_committed_queue_pool(const s
  * If @a keep_changelist is set, don't remove any changeset assignments
  * from @a local_abspath; otherwise, clear it of such assignments.
  *
- * If @a local_abspath is a file and @a md5_checksum is non-NULL, use
- * @a md5_checksum as the checksum for the new text base. Otherwise,
- * calculate the checksum if needed.
- *   ### [JAF]  No, it doesn't calculate the checksum, it stores null in wc.db.
- *
- * If @a sha1_checksum is non-NULL, use it instead of @a md5_checksum to
- * identify the node's pristine text.
- * ### NOT YET IMPLEMENTED.
+ * If @a sha1_checksum is non-NULL, use it to identify the node's pristine
+ * text.
  *
  * Set TOP_OF_RECURSE to TRUE to show that this the top of a possibly
  * recursive commit operation.
@@ -281,7 +275,6 @@ svn_wc__process_committed_internal(svn_w
                                    apr_hash_t *new_dav_cache,
                                    svn_boolean_t no_unlock,
                                    svn_boolean_t keep_changelist,
-                                   const svn_checksum_t *md5_checksum,
                                    const svn_checksum_t *sha1_checksum,
                                    const svn_wc_committed_queue_t *queue,
                                    apr_pool_t *scratch_pool);