diff options
Diffstat (limited to 'subversion/libsvn_repos/delta.c')
-rw-r--r-- | subversion/libsvn_repos/delta.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/subversion/libsvn_repos/delta.c b/subversion/libsvn_repos/delta.c index cd7d73a..51cfda7 100644 --- a/subversion/libsvn_repos/delta.c +++ b/subversion/libsvn_repos/delta.c @@ -24,6 +24,7 @@ #include <apr_hash.h> +#include "svn_hash.h" #include "svn_types.h" #include "svn_delta.h" #include "svn_fs.h" @@ -506,8 +507,7 @@ delta_proplists(struct context *c, pool)); /* Transmit the committed-date. */ - committed_date = apr_hash_get(r_props, SVN_PROP_REVISION_DATE, - APR_HASH_KEY_STRING); + committed_date = svn_hash_gets(r_props, SVN_PROP_REVISION_DATE); if (committed_date || source_path) { SVN_ERR(change_fn(c, object, SVN_PROP_ENTRY_COMMITTED_DATE, @@ -515,8 +515,7 @@ delta_proplists(struct context *c, } /* Transmit the last-author. */ - last_author = apr_hash_get(r_props, SVN_PROP_REVISION_AUTHOR, - APR_HASH_KEY_STRING); + last_author = svn_hash_gets(r_props, SVN_PROP_REVISION_AUTHOR); if (last_author || source_path) { SVN_ERR(change_fn(c, object, SVN_PROP_ENTRY_LAST_AUTHOR, @@ -629,12 +628,23 @@ svn_repos__compare_files(svn_boolean_t *changed_p, if (!*changed_p) return SVN_NO_ERROR; - /* From this point on, assume things haven't changed. */ + /* If the SHA1 checksums match for these things, we'll claim they + have the same contents. (We don't give quite as much weight to + MD5 checksums.) */ + SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_sha1, + root1, path1, FALSE, pool)); + SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_sha1, + root2, path2, FALSE, pool)); + if (checksum1 && checksum2) + { + *changed_p = !svn_checksum_match(checksum1, checksum2); + return SVN_NO_ERROR; + } + + /* From this point on, our default answer is "Nothing's changed". */ *changed_p = FALSE; - /* So, things have changed. But we need to know if the two sets of - file contents are actually different. If they have differing - sizes, then we know they differ. */ + /* Different filesizes means the contents are different. */ SVN_ERR(svn_fs_file_length(&size1, root1, path1, pool)); SVN_ERR(svn_fs_file_length(&size2, root2, path2, pool)); if (size1 != size2) @@ -643,8 +653,7 @@ svn_repos__compare_files(svn_boolean_t *changed_p, return SVN_NO_ERROR; } - /* Same sizes, huh? Well, if their checksums differ, we know they - differ. */ + /* Different MD5 checksums means the contents are different. */ SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_md5, root1, path1, FALSE, pool)); SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_md5, root2, path2, @@ -655,13 +664,11 @@ svn_repos__compare_files(svn_boolean_t *changed_p, return SVN_NO_ERROR; } - /* Same sizes, same checksums. Chances are reallllly good that they - don't differ, but to be absolute sure, we need to compare bytes. */ + /* And finally, different contents means the ... uh ... contents are + different. */ SVN_ERR(svn_fs_file_contents(&stream1, root1, path1, pool)); SVN_ERR(svn_fs_file_contents(&stream2, root2, path2, pool)); - SVN_ERR(svn_stream_contents_same2(&same, stream1, stream2, pool)); - *changed_p = !same; return SVN_NO_ERROR; @@ -1012,7 +1019,7 @@ delta_dirs(struct context *c, } /* Remove the entry from the source_hash. */ - apr_hash_set(s_entries, key, APR_HASH_KEY_STRING, NULL); + svn_hash_sets(s_entries, key, NULL); } else { |