Checkout
cmpilato
committed
on 31 Oct 08
Teach the Berkeley DB backend to store both MD5 and SHA1 checksums -- as
available and allowed for the FS format -- in the `representations'… Show more
Teach the Berkeley DB backend to store both MD5 and SHA1 checksums -- as

available and allowed for the FS format -- in the `representations' table.

* subversion/libsvn_fs_base/notes/structure

 (Representations): Tweak BNF to show that we'll always store MD5,

   and possibly also store SHA1, for representations.

* subversion/libsvn_fs/fs-loader.h,

* subversion/libsvn_fs/fs-loader.c

 (root_vtable_t): Add 'kind' parameter to file_checksum() method,

   passed into providers' file_checksum implementations.

* subversion/libsvn_fs_fs/tree.c

 (fs_file_checksum): Add 'kind' parameter, and use it to filter the

   returned data.

* subversion/libsvn_fs_base/fs.h

 (representation_t): Rename 'checksum' member to 'md5_checksum', and

   add 'sha1_checksum' member.

* subversion/libsvn_fs_base/reps-strings.h

 (svn_fs_base__rep_contents_checksums): Was

   svn_fs_base__rep_contents_checksum().  Rename 'checksum' parameter

   to 'md5_checksum', and add 'sha1_checksum' parameter.

* subversion/libsvn_fs_base/reps-strings.c

 (svn_fs_base__rep_contents_checksums): Was

   svn_fs_base__rep_contents_checksum().  Rename 'checksum' parameter

   to 'md5_checksum', and add 'sha1_checksum' parameter.

 (make_fulltext_rep): Rename 'checksum' parameter to 'md5_checksum',

   and add 'sha1_checksum' parameter, duping both.

 (svn_fs_base__get_mutable_rep): Update call to make_fulltext_rep.

 (txn_body_read_rep): Compare both MD5 and SHA1 checksums against

   their stored values where possible.

 (svn_fs_base__rep_contents): Allow checksum tests of either type of

   checksum, but prefer a SHA1 comparison.

 (struct rep_write_baton): Rename 'checksum_ctx' and 'checksum' to

   'md5_checksum_ctx' and 'md5_checksum', respective; add

   'sha1_checksum_ctx' and 'sha1_checksum'.

 (rep_write_get_baton): Track renamed baton members, and also

   initialize an MD5 checksum context.

 (txn_body_write_rep): Update both checksum contexts.

 (txn_body_write_close_rep): Copy both checksum contexts into the

   representation.

 (rep_write_close_contents): Finalize both checksum contexts.

 (rep_contents_clear): Clear both representation checksums.

 (svn_fs_base__rep_deltify): Use both representation checksums.

* subversion/libsvn_fs_base/dag.h

 (svn_fs_base__dag_file_checksum): Add 'checksum_kind' parameter.

* subversion/libsvn_fs_base/dag.c

 (svn_fs_base__dag_file_checksum): Add 'checksum_kind' parameter, and

   update call to svn_fs_base__rep_contents_checksums().

 (maybe_store_checksum_rep): Update call to

   svn_fs_base__rep_contents_checksums().

 (svn_fs_base__dag_finalize_edits): Update calls to

   svn_fs_base__rep_contents_checksums(), performing checksum

   comparisons against either MD5 or SHA1 as requested (if possible).

* subversion/libsvn_fs_base/tree.c

 (struct file_checksum_args): Add 'kind' variable.

 (txn_body_file_checksum): Pass baton's 'kind' into updated call to

   svn_fs_base__dag_file_checksum().

 (base_file_checksum): Add 'kind' parameter, and use it to populate

   baton's 'kind' variable.

 (txn_body_apply_textdelta): Update call to svn_fs_base__dag_file_checksum(),

   asking for the same kind of checksum as the one we'll compare against.

* subversion/libsvn_fs_base/util/fs_skels.h

 (svn_fs_base__unparse_representation_skel): Add 'format' parameter.

* subversion/libsvn_fs_base/util/fs_skels.c

 (is_valid_representation_skel, svn_fs_base__parse_representation_skel):

   Handle new representation format.

 (prepend_checksum): New helper function.

 (svn_fs_base__unparse_representation_skel): Add 'format' parameter,

   and use prepend_checksum() as needed to handle the new

   representation skel format.

* subversion/libsvn_fs_base/bdb/reps-table.c

 (svn_fs_bdb__write_rep): Pass filesystem format version to updated

   call to svn_fs_base__unparse_representation_skel().

* subversion/tests/libsvn_fs_base/strings-reps-test.c

 (txn_body_read_rep): Update call to svn_fs_base__unparse_representation_skel.

Show less