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

Ev2: providing checksums of files Re: svn commit: r1241733 - /subversion/trunk/subversion/libsvn_delta/compat.c

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Thu, 9 Feb 2012 20:24:04 +0200

hwright_at_apache.org wrote on Wed, Feb 08, 2012 at 01:55:55 -0000:
> Author: hwright
> Date: Wed Feb 8 01:55:54 2012
> New Revision: 1241733
>
> URL: http://svn.apache.org/viewvc?rev=1241733&view=rev
> Log:
> Ev2 shims: Make sure that if we are providing content to alter_file(), we
> are also providing a checksum.
>
> * subversion/libsvn_delta/compat.c
> (path_checksum_args): Remove checksum member.
> (process_actions): Checksum the content file.
> (ev2_apply_textdelta): Don't checksum the output stream.
>
> Modified:
> subversion/trunk/subversion/libsvn_delta/compat.c
>
> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1241733&r1=1241732&r2=1241733&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/compat.c Wed Feb 8 01:55:54 2012
> @@ -203,7 +203,6 @@ struct path_checksum_args
> {
> const char *path;
> svn_revnum_t base_revision;
> - svn_checksum_t *checksum;
> };
>
> static svn_error_t *
> @@ -340,9 +339,10 @@ process_actions(void *edit_baton,
> /* We can only set text on files. */
> kind = svn_node_file;
>
> + SVN_ERR(svn_io_file_checksum2(&checksum, pca->path,
> + svn_checksum_sha1, scratch_pool));
> SVN_ERR(svn_stream_open_readonly(&contents, pca->path,
> scratch_pool, scratch_pool));

So, you first open the file and read it through to checksum it, and then
open it again to read it through as a stream.

That's because right now add_file()/alter_file() require the checksum to
be provided up front.

Would it make sense to relax that requirement? On the one hand,
many receivers don't need to know the checksum until after they've
received the whole file (eg, the fs txn process and the pristine store);
on the other hand, having the checksum will allow in some cases not
transmitting the file over the wire at all, and will allow for
error-checking the transmission in other cases.

Daniel
(some of the points above by Greg and/or Hyrum on IRC)

> - checksum = pca->checksum;
>
> if (!SVN_IS_VALID_REVNUM(text_base_revision))
> text_base_revision = pca->base_revision;
> @@ -779,11 +779,6 @@ ev2_apply_textdelta(void *file_baton,
> svn_io_file_del_on_pool_cleanup,
> fb->eb->edit_pool, result_pool));
>
> - /* Wrap our target with a checksum'ing stream. */
> - target = svn_stream_checksummed2(target, NULL, &pca->checksum,
> - svn_checksum_sha1, TRUE,
> - fb->eb->edit_pool);
> -
> svn_txdelta_apply(source, target,
> NULL, NULL,
> handler_pool,
>
>
Received on 2012-02-09 19:25:04 CET

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

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