subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1132413 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/deprecated.c libsvn_wc/node.c
Date Sun, 05 Jun 2011 14:13:01 GMT
Author: rhuijben
Date: Sun Jun  5 14:13:01 2011
New Revision: 1132413

URL: http://svn.apache.org/viewvc?rev=1132413&view=rev
Log:
Fill the checksum of the deprecated svn_info_t structure with the expected
md5 instead of leaving it NULL.

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_md5_from_sha1): New function.

* subversion/libsvn_client/deprecated.c
  (info_from_info2): Return svn_error_t and fetch md5 checksum.
  (info_to_relpath_baton): Add wc_ctx.
  (info_receiver_relpath_wrapper): Update caller.
  (svn_client_info2): Update caller.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_md5_from_sha1): New function.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1132413&r1=1132412&r2=1132413&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Sun Jun  5 14:13:01 2011
@@ -927,6 +927,20 @@ svn_wc__node_get_commit_status(svn_node_
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool);
 
+/* Gets the md5 checksum for the pristine file identified by a sha1_checksum in the
+   working copy identified by wri_abspath.
+
+   Wraps svn_wc__db_pristine_get_md5().
+ */
+svn_error_t *
+svn_wc__node_get_md5_from_sha1(const svn_checksum_t **md5_checksum,
+                               svn_wc_context_t *wc_ctx,
+                               const char *wri_abspath,
+                               const svn_checksum_t *sha1_checksum,
+                               apr_pool_t *result_pool,
+                               apr_pool_t *scratch_pool);
+
+
 /* Gets an array of const char *repos_relpaths of descendants of LOCAL_ABSPATH,
  * which must be the op root of an addition, copy or move. The descendants
  * returned are at the same op_depth, but are to be deleted by the commit
@@ -995,7 +1009,6 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
                  void *cancel_baton,
                  apr_pool_t *scratch_pool);
 
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1132413&r1=1132412&r2=1132413&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Sun Jun  5 14:13:01 2011
@@ -2085,8 +2085,10 @@ svn_client_checkout(svn_revnum_t *result
 /*** From info.c ***/
 
 /* Convert an svn_info2_t to an svn_info_t, doing shallow copies of objects. */
-static svn_info_t *
-info_from_info2(const svn_info2_t *info2,
+static svn_error_t *
+info_from_info2(svn_info_t **new_info,
+                svn_wc_context_t *wc_ctx,
+                const svn_info2_t *info2,
                 apr_pool_t *pool)
 {
   svn_info_t *info = apr_pcalloc(pool, sizeof(*info));
@@ -2176,7 +2178,21 @@ info_from_info2(const svn_info2_t *info2
         }
     }
 
-  return info;
+  if (info2->wc_info && info2->wc_info->checksum)
+    {
+      const svn_checksum_t *md5_checksum;
+
+      SVN_ERR(svn_wc__node_get_md5_from_sha1(&md5_checksum,
+                                             wc_ctx,
+                                             info2->wc_info->wcroot_abspath,
+                                             info2->wc_info->checksum,
+                                             pool, pool));
+
+      info->checksum = svn_checksum_to_cstring(md5_checksum, pool);
+    }
+
+  *new_info = info;
+  return SVN_NO_ERROR;
 }
 
 struct info_to_relpath_baton
@@ -2185,6 +2201,7 @@ struct info_to_relpath_baton
   const char *anchor_relpath;
   svn_info_receiver_t info_receiver;
   void *info_baton;
+  svn_wc_context_t *wc_ctx;
 };
 
 static svn_error_t *
@@ -2195,6 +2212,7 @@ info_receiver_relpath_wrapper(void *bato
 {
   struct info_to_relpath_baton *rb = baton;
   const char *path = abspath_or_url;
+  svn_info_t *info;
 
   if (rb->anchor_relpath &&
       svn_dirent_is_ancestor(rb->anchor_abspath, abspath_or_url))
@@ -2205,9 +2223,11 @@ info_receiver_relpath_wrapper(void *bato
                              scratch_pool);
     }
 
+  SVN_ERR(info_from_info2(&info, rb->wc_ctx, info2, scratch_pool));
+
   SVN_ERR(rb->info_receiver(rb->info_baton,
                             path,
-                            info_from_info2(info2, scratch_pool),
+                            info,
                             scratch_pool));
 
   return SVN_NO_ERROR;
@@ -2230,6 +2250,7 @@ svn_client_info2(const char *path_or_url
   rb.anchor_relpath = NULL;
   rb.info_receiver = receiver;
   rb.info_baton = receiver_baton;
+  rb.wc_ctx = ctx->wc_ctx;
 
   if (!svn_path_is_url(path_or_url))
     {

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1132413&r1=1132412&r2=1132413&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Sun Jun  5 14:13:01 2011
@@ -1558,6 +1558,22 @@ svn_wc__node_get_commit_status(svn_node_
 }
 
 svn_error_t *
+svn_wc__node_get_md5_from_sha1(const svn_checksum_t **md5_checksum,
+                               svn_wc_context_t *wc_ctx,
+                               const char *wri_abspath,
+                               const svn_checksum_t *sha1_checksum,
+                               apr_pool_t *result_pool,
+                               apr_pool_t *scratch_pool)
+{
+  return svn_error_return(svn_wc__db_pristine_get_md5(md5_checksum,
+                                                      wc_ctx->db,
+                                                      wri_abspath,
+                                                      sha1_checksum,
+                                                      result_pool,
+                                                      scratch_pool));
+}
+
+svn_error_t *
 svn_wc__get_not_present_descendants(const apr_array_header_t **descendants,
                                     svn_wc_context_t *wc_ctx,
                                     const char *local_abspath,



Mime
View raw message