[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Get checksums from 'svn info -R URL'

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Fri, 08 Aug 2008 11:30:46 -0400

"Erik Huelsmann" <ehuels_at_gmail.com> writes:
> The server does store checksums, however, since it often stores
> partial file content (only the difference between 2 versions) it's not
> immediately apparant whether the checksum in the repository is valid
> for the stored content (delta) or the re-assembled content (actual
> file). There will be someone with the definite answer, though.

I believe the repository stores the checksum of the re-assembled content
(actual file). The implementation of svn_fs_fs__file_checksum() implies
this:

   svn_error_t *
   svn_fs_fs__file_checksum(unsigned char digest[],
                            node_revision_t *noderev,
                            apr_pool_t *pool)
   {
     if (noderev->data_rep)
       memcpy(digest, noderev->data_rep->checksum, APR_MD5_DIGESTSIZE);
     else
       memset(digest, 0, APR_MD5_DIGESTSIZE);
   
     return SVN_NO_ERROR;
   }

For more evidence, look at the vtable implementations of the public
svn_fs_file_md5_checksum() API. In FSFS, that's this:

   /* Set DIGEST to the MD5 checksum of PATH under ROOT. Temporary
      allocations are from POOL. */
   static svn_error_t *
   fs_file_md5_checksum(unsigned char digest[],
                        svn_fs_root_t *root,
                        const char *path,
                        apr_pool_t *pool)
   {
     dag_node_t *file;
   
     SVN_ERR(get_dag(&file, root, path, pool));
     return svn_fs_fs__dag_file_checksum(digest, file, pool);
   }

...which calls this:

   svn_error_t *
   svn_fs_fs__dag_file_checksum(unsigned char digest[],
                                dag_node_t *file,
                                apr_pool_t *pool)
   {
     node_revision_t *noderev;
   
     if (file->kind != svn_node_file)
       return svn_error_createf
         (SVN_ERR_FS_NOT_FILE, NULL,
          "Attempted to get checksum of a *non*-file node");
   
     SVN_ERR(get_node_revision(&noderev, file, pool));
   
     SVN_ERR(svn_fs_fs__file_checksum(digest, noderev, pool));
   
     return SVN_NO_ERROR;
   }

...which calls svn_fs_fs__file_checksum(), which we've already seen.

Similar arrangements are the case in BDB, IIRC.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-08 17:31:11 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.