You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/05/02 19:58:05 UTC

svn commit: r1098694 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/deprecated.c libsvn_wc/info.c svn/info-cmd.c

Author: hwright
Date: Mon May  2 17:58:05 2011
New Revision: 1098694

URL: http://svn.apache.org/viewvc?rev=1098694&view=rev
Log:
Update svn_wc_info_t to use the actual checksum type, rather than just a
hex string.

* subversion/svn/info-cmd.c
  (print_info_xml, print_into): Output the checksum.

* subversion/include/svn_wc.h
  (svn_wc_info_t): Update checksum type.
 
* subversion/libsvn_wc/info.c
  (build_info_for_entry): Don't bother converting the checksum to a string.

* subversion/libsvn_client/deprecated.c
  (info_from_info2): Update compat wrapper.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_wc/info.c
    subversion/trunk/subversion/svn/info-cmd.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1098694&r1=1098693&r2=1098694&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon May  2 17:58:05 2011
@@ -3011,7 +3011,7 @@ typedef struct svn_wc_info_t
   const char *copyfrom_url;
   svn_revnum_t copyfrom_rev;
   apr_time_t text_time;
-  const char *checksum;
+  svn_checksum_t *checksum;
   const char *changelist;
   svn_depth_t depth;
 

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1098694&r1=1098693&r2=1098694&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Mon May  2 17:58:05 2011
@@ -2034,7 +2034,12 @@ info_from_info2(const svn_info2_t *info2
       info->copyfrom_rev        = info2->wc_info->copyfrom_rev;
       info->text_time           = info2->wc_info->text_time;
       info->prop_time           = 0;
-      info->checksum            = info2->wc_info->checksum;
+      if (info2->wc_info->checksum
+            && info2->wc_info->checksum->kind == svn_checksum_md5)
+        info->checksum          = svn_checksum_to_cstring(
+                                        info2->wc_info->checksum, pool);
+      else
+        info->checksum          = NULL;
       info->changelist          = info2->wc_info->changelist;
       info->depth               = info2->wc_info->depth;
 

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1098694&r1=1098693&r2=1098694&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Mon May  2 17:58:05 2011
@@ -154,18 +154,14 @@ build_info_for_entry(svn_info2_t **info,
 
   if (tmpinfo->kind == svn_node_file)
     {
-      const svn_checksum_t *checksum;
-
       SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, &checksum, NULL,
+                                   NULL, NULL, NULL, NULL,
+                                   &tmpinfo->wc_info->checksum, NULL,
                                    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                    &tmpinfo->wc_info->changelist,
                                    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                    wc_ctx->db, local_abspath, result_pool,
                                    scratch_pool));
-
-      tmpinfo->wc_info->checksum = svn_checksum_to_cstring(checksum,
-                                                           result_pool);
     }
 
   if (tmpinfo->kind == svn_node_dir)

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1098694&r1=1098693&r2=1098694&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Mon May  2 17:58:05 2011
@@ -156,7 +156,9 @@ print_info_xml(void *baton,
                                                      pool));
 
       /* "<checksum> xx </checksum>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "checksum", info->wc_info->checksum);
+      svn_cl__xml_tagged_cdata(&sb, pool, "checksum",
+                               svn_checksum_to_cstring(info->wc_info->checksum,
+                                                       pool)); 
 
       if (info->wc_info->changelist)
         /* "<changelist> xx </changelist>" */
@@ -416,7 +418,8 @@ print_info(void *baton,
 
       if (info->wc_info->checksum)
         SVN_ERR(svn_cmdline_printf(pool, _("Checksum: %s\n"),
-                                   info->wc_info->checksum));
+                                   svn_checksum_to_cstring(
+                                              info->wc_info->checksum, pool)));
 
       if (info->wc_info->conflicts)
         {



Re: svn commit: r1098694 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/deprecated.c libsvn_wc/info.c svn/info-cmd.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Mon, May 2, 2011 at 2:30 PM, Greg Stein <gs...@gmail.com> wrote:
> On Mon, May 2, 2011 at 13:58,  <hw...@apache.org> wrote:
>>...
>> +      if (info2->wc_info->checksum
>> +            && info2->wc_info->checksum->kind == svn_checksum_md5)
>> +        info->checksum          = svn_checksum_to_cstring(
>> +                                        info2->wc_info->checksum, pool);
>> +      else
>> +        info->checksum          = NULL;
>
> I would note this means the checksum will be NULL for users of the old
> API (since the new API returns SHA-1 checksums). This could be viewed
> as a regression.

The docs for the old struct indicate that the field may be NULL, so
callers need to be aware of that possibility aforehand.

Also, the regression isn't caused by the above change, but rather our
decision to change which checksum we return.  We've been returning
sha1's for weeks; at least now we let people know that fact. :)

-Hyrum

Re: svn commit: r1098694 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/deprecated.c libsvn_wc/info.c svn/info-cmd.c

Posted by Greg Stein <gs...@gmail.com>.
On Mon, May 2, 2011 at 13:58,  <hw...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/include/svn_wc.h Mon May  2 17:58:05 2011
> @@ -3011,7 +3011,7 @@ typedef struct svn_wc_info_t
>   const char *copyfrom_url;
>   svn_revnum_t copyfrom_rev;
>   apr_time_t text_time;
> -  const char *checksum;
> +  svn_checksum_t *checksum;

const!

>...
> +      if (info2->wc_info->checksum
> +            && info2->wc_info->checksum->kind == svn_checksum_md5)
> +        info->checksum          = svn_checksum_to_cstring(
> +                                        info2->wc_info->checksum, pool);
> +      else
> +        info->checksum          = NULL;

I would note this means the checksum will be NULL for users of the old
API (since the new API returns SHA-1 checksums). This could be viewed
as a regression.

>...

Cheers,
-g