Author: stefan2
Date: Thu Feb 27 00:15:07 2014
New Revision: 1572363
URL: http://svn.apache.org/r1572363
Log:
Expose the recent change detection improvements in the FS API by adding
a STRICT option to rev'ed svn_fs_props_changed and svn_fs_content_changed
functions.
Update all backends and API users. Most API users want strict behavior
as they would otherwise to calc the diff on their own. The only exception
is the svn_repos_get_file_revs2 API which passes the data on to a callback.
* subversion/include/svn_fs.h
(svn_fs_props_changed2,
svn_fs_contents_changed2): Revved versions of the respective APIs.
(svn_fs_props_changed,
svn_fs_contents_changed): Deprecate.
* subversion/libsvn_fs/fs-loader.c
(svn_fs_props_changed2,
svn_fs_contents_changed2): Implement.
(svn_fs_props_changed,
svn_fs_contents_changed): Update vtable call.
* subversion/libsvn_fs/fs-loader.h
(root_vtable_t): Update vtable entries for revved API functions.
* subversion/libsvn_fs_base/tree.c
(base_props_changed,
base_contents_changed): Accept new STRICT parameter and pass it on.
* subversion/libsvn_fs_fs/tree.c
(fs_props_changed,
fs_contents_changed): Ditto.
* subversion/libsvn_fs_x/tree.c
(x_props_changed,
x_contents_changed): Ditto.
* subversion/libsvn_repos/delta.c
(delta_proplists): Update API call.
(svn_repos__compare_files,
delta_files): Use the revved API and greatly simplify the code since
the FS API changed indications are now reliable.
* subversion/libsvn_repos/dump.c
(dump_node): Update API call.
* subversion/libsvn_repos/reporter.c
(delta_proplists): Ditto.
* subversion/libsvn_repos/rev_hunt.c
(send_path_revision): Update API call but allow false positives for now.
Modified:
subversion/trunk/subversion/include/svn_fs.h
subversion/trunk/subversion/libsvn_fs/fs-loader.c
subversion/trunk/subversion/libsvn_fs/fs-loader.h
subversion/trunk/subversion/libsvn_fs_base/tree.c
subversion/trunk/subversion/libsvn_fs_fs/tree.c
subversion/trunk/subversion/libsvn_fs_x/tree.c
subversion/trunk/subversion/libsvn_repos/delta.c
subversion/trunk/subversion/libsvn_repos/dump.c
subversion/trunk/subversion/libsvn_repos/reporter.c
subversion/trunk/subversion/libsvn_repos/rev_hunt.c
Modified: subversion/trunk/subversion/include/svn_fs.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Thu Feb 27 00:15:07 2014
@@ -1670,11 +1670,37 @@ svn_fs_change_node_prop(svn_fs_root_t *r
/** Determine if the properties of two path/root combinations are different.
*
- * Set @a *changed_p to 1 if the properties at @a path1 under @a root1 differ
- * from those at @a path2 under @a root2, or set it to 0 if they are the
- * same. Both paths must exist under their respective roots, and both
- * roots must be in the same filesystem.
+ * Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1
+ * differ from those at @a path2 under @a root2, or set it to #FALSE if they
+ * are the same. If @a strict is #FALSE, the function may report false
+ * positives, otherwise a full comparison may be necessary. Both paths must
+ * exist under their respective roots, and both roots must be in the same
+ * filesystem.
+ * Do any necessary temporary allocation in @a pool.
+ *
+ * @note The behavior under @a strict == #FALSE is implementation dependent
+ * in that the false positives reported may differ from release to release
+ * and backend to backend. It is perfectly legal to report all combinations
+ * as "changed" even for @a path1 == @a path2 and @a root1 == @a root2.
+ * There is also no guarantee that there will be false positives at all.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_fs_props_changed2(svn_boolean_t *changed_p,
+ svn_fs_root_t *root1,
+ const char *path1,
+ svn_fs_root_t *root2,
+ const char *path2,
+ svn_boolean_t strict,
+ apr_pool_t *pool);
+
+
+/** Similar to svn_fs_props_changed2 with @a strict set to #FALSE.
+ *
+ * @deprecated Provided for backward compatibility with the 1.8 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_fs_props_changed(svn_boolean_t *changed_p,
svn_fs_root_t *root1,
@@ -2227,11 +2253,36 @@ svn_fs_apply_text(svn_stream_t **content
/** Check if the contents of two root/path combos have changed.
*
- * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ
- * from those at @a path2 under @a root2, or set it to 0 if they are the
- * same. Both paths must exist under their respective roots, and both
- * roots must be in the same filesystem.
+ * Set @a *changed_p to #TRUE if the file contents at @a path1 under
+ * @a root1 differ from those at @a path2 under @a root2, or set it to
+ * #FALSE if they are the same. If @a strict is #FALSE, the function may
+ * report false positives, otherwise a full comparison may be necessary.
+ * Both paths must exist under their respective roots, and both roots must
+ * be in the same filesystem.
+ * Do any necessary temporary allocation in @a pool.
+ *
+ * @note The behavior under @a strict == #FALSE is implementation dependent
+ * in that the false positives reported may differ from release to release
+ * and backend to backend. It is perfectly legal to report all combinations
+ * as "changed" even for @a path1 == @a path2 and @a root1 == @a root2.
+ * There is also no guarantee that there will be false positives at all.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_fs_contents_changed2(svn_boolean_t *changed_p,
+ svn_fs_root_t *root1,
+ const char *path1,
+ svn_fs_root_t *root2,
+ const char *path2,
+ svn_boolean_t strict,
+ apr_pool_t *pool);
+
+/** Similar to svn_fs_contents_changed2 with @a strict set to #FALSE.
+ *
+ * @deprecated Provided for backward compatibility with the 1.8 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_fs_contents_changed(svn_boolean_t *changed_p,
svn_fs_root_t *root1,
Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Thu Feb 27 00:15:07 2014
@@ -1167,6 +1167,18 @@ svn_fs_change_node_prop(svn_fs_root_t *r
}
svn_error_t *
+svn_fs_props_changed2(svn_boolean_t *changed_p, svn_fs_root_t *root1,
+ const char *path1, svn_fs_root_t *root2,
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(root1->vtable->props_changed(changed_p,
+ root1, path1,
+ root2, path2,
+ strict, pool));
+}
+
+svn_error_t *
svn_fs_props_changed(svn_boolean_t *changed_p, svn_fs_root_t *root1,
const char *path1, svn_fs_root_t *root2,
const char *path2, apr_pool_t *pool)
@@ -1174,7 +1186,7 @@ svn_fs_props_changed(svn_boolean_t *chan
return svn_error_trace(root1->vtable->props_changed(changed_p,
root1, path1,
root2, path2,
- pool));
+ FALSE, pool));
}
svn_error_t *
@@ -1442,6 +1454,18 @@ svn_fs_apply_text(svn_stream_t **content
}
svn_error_t *
+svn_fs_contents_changed2(svn_boolean_t *changed_p, svn_fs_root_t *root1,
+ const char *path1, svn_fs_root_t *root2,
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(root1->vtable->contents_changed(changed_p,
+ root1, path1,
+ root2, path2,
+ strict, pool));
+}
+
+svn_error_t *
svn_fs_contents_changed(svn_boolean_t *changed_p, svn_fs_root_t *root1,
const char *path1, svn_fs_root_t *root2,
const char *path2, apr_pool_t *pool)
@@ -1449,7 +1473,7 @@ svn_fs_contents_changed(svn_boolean_t *c
return svn_error_trace(root1->vtable->contents_changed(changed_p,
root1, path1,
root2, path2,
- pool));
+ FALSE, pool));
}
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.h?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.h Thu Feb 27 00:15:07 2014
@@ -29,6 +29,7 @@
#include "svn_fs.h"
#include "svn_props.h"
#include "private/svn_mutex.h"
+#include <apr_poll.h>
#ifdef __cplusplus
extern "C" {
@@ -343,7 +344,8 @@ typedef struct root_vtable_t
apr_pool_t *pool);
svn_error_t *(*props_changed)(int *changed_p, svn_fs_root_t *root1,
const char *path1, svn_fs_root_t *root2,
- const char *path2, apr_pool_t *pool);
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *pool);
/* Directories */
svn_error_t *(*dir_entries)(apr_hash_t **entries_p, svn_fs_root_t *root,
@@ -383,7 +385,8 @@ typedef struct root_vtable_t
apr_pool_t *pool);
svn_error_t *(*contents_changed)(int *changed_p, svn_fs_root_t *root1,
const char *path1, svn_fs_root_t *root2,
- const char *path2, apr_pool_t *pool);
+ const char *path2, svn_boolean_t strict,
+ apr_pool_t *pool);
svn_error_t *(*get_file_delta_stream)(svn_txdelta_stream_t **stream_p,
svn_fs_root_t *source_root,
const char *source_path,
Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Thu Feb 27 00:15:07 2014
@@ -1441,6 +1441,7 @@ base_props_changed(svn_boolean_t *change
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
struct things_changed_args args;
@@ -1457,7 +1458,7 @@ base_props_changed(svn_boolean_t *change
args.path2 = path2;
args.changed_p = changed_p;
args.pool = pool;
- args.strict = FALSE;
+ args.strict = strict;
return svn_fs_base__retry_txn(root1->fs, txn_body_props_changed, &args,
TRUE, pool);
@@ -4079,6 +4080,7 @@ base_contents_changed(svn_boolean_t *cha
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
struct things_changed_args args;
@@ -4110,7 +4112,7 @@ base_contents_changed(svn_boolean_t *cha
args.path2 = path2;
args.changed_p = changed_p;
args.pool = pool;
- args.strict = FALSE;
+ args.strict = strict;
return svn_fs_base__retry_txn(root1->fs, txn_body_contents_changed, &args,
TRUE, pool);
Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Thu Feb 27 00:15:07 2014
@@ -1618,6 +1618,7 @@ fs_props_changed(svn_boolean_t *changed_
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
dag_node_t *node1, *node2;
@@ -1631,7 +1632,7 @@ fs_props_changed(svn_boolean_t *changed_
SVN_ERR(get_dag(&node1, root1, path1, TRUE, pool));
SVN_ERR(get_dag(&node2, root2, path2, TRUE, pool));
return svn_fs_fs__dag_things_different(changed_p, NULL,
- node1, node2, FALSE, pool);
+ node1, node2, strict, pool);
}
@@ -3343,6 +3344,7 @@ fs_contents_changed(svn_boolean_t *chang
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
dag_node_t *node1, *node2;
@@ -3371,7 +3373,7 @@ fs_contents_changed(svn_boolean_t *chang
SVN_ERR(get_dag(&node1, root1, path1, TRUE, pool));
SVN_ERR(get_dag(&node2, root2, path2, TRUE, pool));
return svn_fs_fs__dag_things_different(NULL, changed_p,
- node1, node2, FALSE, pool);
+ node1, node2, strict, pool);
}
Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Thu Feb 27 00:15:07 2014
@@ -1591,6 +1591,7 @@ x_props_changed(svn_boolean_t *changed_p
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
dag_node_t *node1, *node2;
@@ -1604,7 +1605,7 @@ x_props_changed(svn_boolean_t *changed_p
SVN_ERR(get_dag(&node1, root1, path1, TRUE, pool));
SVN_ERR(get_dag(&node2, root2, path2, TRUE, pool));
return svn_fs_x__dag_things_different(changed_p, NULL, node1, node2,
- FALSE, pool);
+ strict, pool);
}
@@ -3268,6 +3269,7 @@ x_contents_changed(svn_boolean_t *change
const char *path1,
svn_fs_root_t *root2,
const char *path2,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
dag_node_t *node1, *node2;
@@ -3296,7 +3298,7 @@ x_contents_changed(svn_boolean_t *change
SVN_ERR(get_dag(&node1, root1, path1, TRUE, pool));
SVN_ERR(get_dag(&node2, root2, path2, TRUE, pool));
return svn_fs_x__dag_things_different(NULL, changed_p, node1, node2,
- FALSE, pool);
+ strict, pool);
}
Modified: subversion/trunk/subversion/libsvn_repos/delta.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/delta.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/delta.c (original)
+++ subversion/trunk/subversion/libsvn_repos/delta.c Thu Feb 27 00:15:07 2014
@@ -523,8 +523,9 @@ delta_proplists(struct context *c,
svn_boolean_t changed;
/* Is this deltification worth our time? */
- SVN_ERR(svn_fs_props_changed(&changed, c->target_root, target_path,
- c->source_root, source_path, subpool));
+ SVN_ERR(svn_fs_props_changed2(&changed, c->target_root, target_path,
+ c->source_root, source_path, TRUE,
+ subpool));
if (! changed)
goto cleanup;
@@ -604,62 +605,8 @@ svn_repos__compare_files(svn_boolean_t *
const char *path2,
apr_pool_t *pool)
{
- svn_filesize_t size1, size2;
- svn_checksum_t *checksum1, *checksum2;
- svn_stream_t *stream1, *stream2;
- svn_boolean_t same;
-
- /* If the filesystem claims the things haven't changed, then they
- haven't changed. */
- SVN_ERR(svn_fs_contents_changed(changed_p, root1, path1,
- root2, path2, pool));
- if (!*changed_p)
- return SVN_NO_ERROR;
-
- /* 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;
-
- /* 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)
- {
- *changed_p = TRUE;
- return SVN_NO_ERROR;
- }
-
- /* 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,
- FALSE, pool));
- if (! svn_checksum_match(checksum1, checksum2))
- {
- *changed_p = TRUE;
- return SVN_NO_ERROR;
- }
-
- /* 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;
+ return svn_error_trace(svn_fs_contents_changed2(changed_p, root1, path1,
+ root2, path2, TRUE, pool));
}
@@ -686,22 +633,10 @@ delta_files(struct context *c,
if (source_path)
{
- /* Is this delta calculation worth our time? If we are ignoring
- ancestry, then our editor implementor isn't concerned by the
- theoretical differences between "has contents which have not
- changed with respect to" and "has the same actual contents
- as". We'll do everything we can to avoid transmitting even
- an empty text-delta in that case. */
- if (c->ignore_ancestry)
- SVN_ERR(svn_repos__compare_files(&changed,
- c->target_root, target_path,
- c->source_root, source_path,
- subpool));
- else
- SVN_ERR(svn_fs_contents_changed(&changed,
- c->target_root, target_path,
- c->source_root, source_path,
- subpool));
+ SVN_ERR(svn_fs_contents_changed2(&changed,
+ c->target_root, target_path,
+ c->source_root, source_path,
+ TRUE, subpool));
}
else
{
Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Thu Feb 27 00:15:07 2014
@@ -857,13 +857,13 @@ dump_node(struct edit_baton *eb,
svn_fs_root_fs(eb->fs_root),
compare_rev, pool));
- SVN_ERR(svn_fs_props_changed(&must_dump_props,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_props_changed2(&must_dump_props,
+ compare_root, compare_path,
+ eb->fs_root, path, TRUE, pool));
if (kind == svn_node_file)
- SVN_ERR(svn_fs_contents_changed(&must_dump_text,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_contents_changed2(&must_dump_text,
+ compare_root, compare_path,
+ eb->fs_root, path, TRUE, pool));
}
else if (action == svn_node_action_replace)
{
@@ -1009,16 +1009,17 @@ dump_node(struct edit_baton *eb,
/* Need to decide if the copied node had any extra textual or
property mods as well. */
- SVN_ERR(svn_fs_props_changed(&must_dump_props,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_props_changed2(&must_dump_props,
+ compare_root, compare_path,
+ eb->fs_root, path, TRUE, pool));
if (kind == svn_node_file)
{
svn_checksum_t *checksum;
const char *hex_digest;
- SVN_ERR(svn_fs_contents_changed(&must_dump_text,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_contents_changed2(&must_dump_text,
+ compare_root, compare_path,
+ eb->fs_root, path, TRUE,
+ pool));
SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5,
compare_root, compare_path,
Modified: subversion/trunk/subversion/libsvn_repos/reporter.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/reporter.c (original)
+++ subversion/trunk/subversion/libsvn_repos/reporter.c Thu Feb 27 00:15:07 2014
@@ -576,8 +576,8 @@ delta_proplists(report_baton_t *b, svn_r
SVN_ERR(get_source_root(b, &s_root, s_rev));
/* Is this deltification worth our time? */
- SVN_ERR(svn_fs_props_changed(&changed, b->t_root, t_path, s_root,
- s_path, pool));
+ SVN_ERR(svn_fs_props_changed2(&changed, b->t_root, t_path, s_root,
+ s_path, TRUE, pool));
if (! changed)
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1572363&r1=1572362&r2=1572363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Thu Feb 27 00:15:07 2014
@@ -1365,9 +1365,9 @@ send_path_revision(struct path_revision
/* Check if the contents changed. */
/* Special case: In the first revision, we always provide a delta. */
if (sb->last_root)
- SVN_ERR(svn_fs_contents_changed(&contents_changed, sb->last_root,
- sb->last_path, root, path_rev->path,
- sb->iterpool));
+ SVN_ERR(svn_fs_contents_changed2(&contents_changed, sb->last_root,
+ sb->last_path, root, path_rev->path,
+ FALSE, sb->iterpool));
else
contents_changed = TRUE;