Author: kotkov
Date: Sun Jan 10 03:20:57 2016
New Revision: 1723900

URL: http://svn.apache.org/viewvc?rev=1723900&view=rev
Log:
On 'fs-node-api' branch: Lay the groundwork for switching the update reporter
to the new FS node API.

Provide new versions for almost all existing FS API functions used by the
reporter that accept a svn_fs_node_t instead of a (svn_fs_root, path) pair,
and thus avoid a DAG walk:

  svn_fs_node_relation2()
  svn_fs_props_different2()
  svn_fs_file_checksum2()
  svn_fs_file_contents2()
  svn_fs_contents_different2()

Add native implementations for these functions in libsvn_fs_fs/node.c,
and add a compatible implementation in libsvn_fs/node_compat.c.

* subversion/include/svn_fs.h
  (svn_fs_node_relation2, svn_fs_props_different2, svn_fs_file_checksum2,
   svn_fs_file_contents2, svn_fs_contents_different2): New, work with
   svn_fs_node_t instead of a svn_fs_root_t and a path.  Revved from
   these ...
  (svn_fs_node_relation, svn_fs_props_different, svn_fs_file_checksum,
   svn_fs_file_contents, svn_fs_contents_different): ...functions.

* subversion/libsvn_fs/fs-loader.h
  (struct node_vtable_t): Add new node_relation, props_changed, file_checksum,
   file_contents and contents_changed vtable members.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_node_relation2, svn_fs_props_different2, svn_fs_file_checksum2,
   svn_fs_file_contents2, svn_fs_contents_different2): Implement these new
   functions.

* subversion/libsvn_fs/node_compat.c
  (compat_fs_node_relation, compat_fs_node_props_changed,
   compat_fs_node_file_checksum, compat_fs_node_file_contents,
   compat_fs_node_contents_changed): Implement these compatibility wrappers.
   Open a svn_fs_root_t and call the corresponding function from its vtable.
  (compat_node_vtable): Update this vtable instance.

* subversion/libsvn_fs_fs/node.c
  (fs_node_relation, fs_node_props_changed, fs_node_file_checksum,
   fs_node_file_contents, fs_node_contents_changed): Implement these natively
   by forwarding the call to corresponding svn_fs_fs__dag functions.
  (fs_node_vtable): Update this vtable instance.

* subversion/tests/libsvn_fs/fs-test.c
  (check_related, check_txn_related): Extend these tests to also call and
   verify the result of svn_fs_node_relation2().

Modified:
    subversion/branches/fs-node-api/subversion/include/svn_fs.h
    subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.c
    subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.h
    subversion/branches/fs-node-api/subversion/libsvn_fs/node_compat.c
    subversion/branches/fs-node-api/subversion/libsvn_fs_fs/node.c
    subversion/branches/fs-node-api/subversion/tests/libsvn_fs/fs-test.c

Modified: subversion/branches/fs-node-api/subversion/include/svn_fs.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/include/svn_fs.h?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/include/svn_fs.h (original)
+++ subversion/branches/fs-node-api/subversion/include/svn_fs.h Sun Jan 10 
03:20:57 2016
@@ -1806,15 +1806,27 @@ svn_fs_node_id(const svn_fs_id_t **id_p,
                const char *path,
                apr_pool_t *pool);
 
-/** Determine how @a path_a under @a root_a and @a path_b under @a root_b
- * are related and return the result in @a relation.  There is no restriction
- * concerning the roots: They may refer to different repositories, be in
- * arbitrary revision order and any of them may pertain to a transaction.
+/** Determine how @a node_a and @a node_b are related and return the result in
+ * @a relation.  There is no restriction concerning the nodes: They may refer
+ * to different repositories, be in arbitrary revision order and any of them
+ * may pertain to a transaction.
  * @a scratch_pool is used for temporary allocations.
  *
- * @note Paths from different svn_fs_t will be reported as unrelated even
+ * @note Nodes from different svn_fs_t will be reported as unrelated even
  * if the underlying physical repository is the same.
  *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_node_relation2(svn_fs_node_relation_t *relation,
+                      svn_fs_node_t *node_a,
+                      svn_fs_node_t *node_b,
+                      apr_pool_t *scratch_pool);
+
+/**
+ * Same as svn_fs_node_relation2(), but reference nodes by @a root_a,
+ * @a path_a, @a root_b and @a path_b.
+ *
  * @since New in 1.9.
  */
 svn_error_t *
@@ -1960,21 +1972,32 @@ svn_fs_change_node_prop(svn_fs_root_t *r
 
 /** Determine if the properties of two path/root combinations are different.
  *
- * Set @a *different_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.  Both paths must exist under their respective roots, and
- * both roots must be in the same filesystem.
- * Do any necessary temporary allocation in @a scratch_pool.
+ * Set @a *different_p to #TRUE if the properties at @a node1 differ from
+ * those at @a node2, or set it to #FALSE if they are the same.  Both nodes
+ * must be in the same filesystem.  Do any necessary temporary allocation in
+ * @a scratch_pool.
  *
  * @note For the purposes of preserving accurate history, certain bits of
  * code (such as the repository dump code) need to care about the distinction
  * between situations when the properties are "different" and "have changed
  * across two points in history".  We have a pair of functions that can
- * answer both of these questions, svn_fs_props_different() and
+ * answer both of these questions, svn_fs_props_different2() and
  * svn_fs_props_changed().  See issue 4598 for more details.
  *
  * @see svn_fs_props_changed
  *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_props_different2(svn_boolean_t *different_p,
+                        svn_fs_node_t *node1,
+                        svn_fs_node_t *node2,
+                        apr_pool_t *scratch_pool);
+
+/**
+ * Same as svn_fs_props_different2(), but reference nodes by @a root1,
+ * @a path1, @a root2 and @a path2.
+ *
  * @since New in 1.9.
  */
 svn_error_t *
@@ -2365,12 +2388,12 @@ svn_fs_file_length(svn_filesize_t *lengt
                    apr_pool_t *pool);
 
 
-/** Set @a *checksum to the checksum of type @a kind for the file @a path.
+/** Set @a *checksum to the checksum of type @a kind for the file @a node.
  * @a *checksum will be allocated out of @a pool, which will also be used
  * for temporary allocations.
  *
  * If the filesystem does not have a prerecorded checksum of @a kind for
- * @a path, and @a force is not TRUE, do not calculate a checksum
+ * @a node, and @a force is not TRUE, do not calculate a checksum
  * dynamically, just put NULL into @a checksum.  (By convention, the NULL
  * checksum is considered to match any checksum.)
  *
@@ -2399,6 +2422,17 @@ svn_fs_file_length(svn_filesize_t *lengt
  * @since New in 1.6.
  */
 svn_error_t *
+svn_fs_file_checksum2(svn_checksum_t **checksum,
+                      svn_checksum_kind_t kind,
+                      svn_fs_node_t *root,
+                      svn_boolean_t force,
+                      apr_pool_t *pool);
+
+/**
+ * Same as svn_fs_file_checksum2(), but reference node by @a root and
+ * @a path.
+ */
+svn_error_t *
 svn_fs_file_checksum(svn_checksum_t **checksum,
                      svn_checksum_kind_t kind,
                      svn_fs_root_t *root,
@@ -2422,21 +2456,29 @@ svn_fs_file_md5_checksum(unsigned char d
 
 
 /** Set @a *contents to a readable generic stream that will yield the
- * contents of the file @a path in @a root.  Allocate the stream in
- * @a pool.  You can only use @a *contents for as long as the underlying
- * filesystem is open.  If @a path is not a file, return
+ * contents of the file node @a node.  Allocate the stream in @a pool.
+ * You can only use @a *contents for as long as the underlying
+ * filesystem is open.  If @a node is not a file, return
  * #SVN_ERR_FS_NOT_FILE.
  *
- * If @a root is the root of a transaction, it is possible that the
- * contents of the file @a path will change between calls to
- * svn_fs_file_contents().  In that case, the result of reading from
- * @a *contents is undefined.
+ * If @a node is in transaction, it is possible that the contents of
+ * the file will change between calls to svn_fs_file_contents().
+ * In that case, the result of reading from @a *contents is undefined.
  *
  * ### @todo kff: I am worried about lifetime issues with this pool vs
  * the trail created farther down the call stack.  Trace this function
  * to investigate...
  */
 svn_error_t *
+svn_fs_file_contents2(svn_stream_t **contents,
+                      svn_fs_node_t *node,
+                      apr_pool_t *pool);
+
+/**
+ * Same as svn_fs_file_contents2(), but reference node by @a root and
+ * @a path.
+ */
+svn_error_t *
 svn_fs_file_contents(svn_stream_t **contents,
                      svn_fs_root_t *root,
                      const char *path,
@@ -2567,24 +2609,35 @@ svn_fs_apply_text(svn_stream_t **content
                   apr_pool_t *pool);
 
 
-/** Check if the contents of two root/path combos are different.
+/** Check if the contents of two filesystem nodes are different.
  *
- * Set @a *different_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.  Both paths must exist under their
- * respective roots, and both roots must be in the same filesystem.
- * Do any necessary temporary allocation in @a scratch_pool.
+ * Set @a *different_p to #TRUE if the file contents at @a node1 differ
+ * from those at @a node2, or set it to #FALSE if they are the same.
+ * Both nodes must be in the same filesystem.  Do any necessary
+ * temporary allocation in @a scratch_pool.
  *
  * @note For the purposes of preserving accurate history, certain bits of
  * code (such as the repository dump code) need to care about the distinction
  * between situations when two files have "different" content and when the
  * contents of a given file "have changed" across two points in its history.
  * We have a pair of functions that can answer both of these questions,
- * svn_fs_contents_different() and svn_fs_contents_changed().  See issue
+ * svn_fs_contents_different2() and svn_fs_contents_changed().  See issue
  * 4598 for more details.
  *
  * @see svn_fs_contents_changed
  *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_contents_different2(svn_boolean_t *different_p,
+                           svn_fs_node_t *node1,
+                           svn_fs_node_t *node2,
+                           apr_pool_t *scratch_pool);
+
+/**
+ * Same as svn_fs_contents_different(), but reference nodes by @a root1,
+ * @a path1, @a root2 and @a path2.
+ *
  * @since New in 1.9.
  */
 svn_error_t *

Modified: subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.c?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.c Sun Jan 10 
03:20:57 2016
@@ -1161,6 +1161,24 @@ svn_fs_node_relation(svn_fs_node_relatio
 }
 
 svn_error_t *
+svn_fs_node_relation2(svn_fs_node_relation_t *relation,
+                      svn_fs_node_t *node_a,
+                      svn_fs_node_t *node_b,
+                      apr_pool_t *scratch_pool)
+{
+  /* Different repository types? */
+  if (node_a->fs != node_b->fs)
+    {
+      *relation = svn_fs_node_unrelated;
+      return SVN_NO_ERROR;
+    }
+
+  return svn_error_trace(node_a->vtable->node_relation(relation,
+                                                       node_a, node_b,
+                                                       scratch_pool));
+}
+
+svn_error_t *
 svn_fs_node_created_rev(svn_revnum_t *revision, svn_fs_root_t *root,
                         const char *path, apr_pool_t *pool)
 {
@@ -1257,6 +1275,18 @@ svn_fs_props_different(svn_boolean_t *ch
 }
 
 svn_error_t *
+svn_fs_props_different2(svn_boolean_t *different_p,
+                        svn_fs_node_t *node1,
+                        svn_fs_node_t *node2,
+                        apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(node1->vtable->props_changed(different_p,
+                                                      node1, node2,
+                                                      TRUE,
+                                                      scratch_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)
@@ -1439,6 +1469,31 @@ svn_fs_file_checksum(svn_checksum_t **ch
 }
 
 svn_error_t *
+svn_fs_file_checksum2(svn_checksum_t **checksum,
+                      svn_checksum_kind_t kind,
+                      svn_fs_node_t *node,
+                      svn_boolean_t force,
+                      apr_pool_t *pool)
+{
+  SVN_ERR(node->vtable->file_checksum(checksum, kind, node, pool));
+
+  if (force && (*checksum == NULL || (*checksum)->kind != kind))
+    {
+      svn_stream_t *contents, *checksum_contents;
+
+      SVN_ERR(svn_fs_file_contents2(&contents, node, pool));
+      checksum_contents = svn_stream_checksummed2(contents, checksum, NULL,
+                                                  kind, TRUE, pool);
+
+      /* This will force a read of any remaining data (which is all of it in
+         this case) and dump the checksum into checksum->digest. */
+      SVN_ERR(svn_stream_close(checksum_contents));
+    }
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_fs_file_contents(svn_stream_t **contents, svn_fs_root_t *root,
                      const char *path, apr_pool_t *pool)
 {
@@ -1447,6 +1502,13 @@ svn_fs_file_contents(svn_stream_t **cont
 }
 
 svn_error_t *
+svn_fs_file_contents2(svn_stream_t **contents, svn_fs_node_t *node,
+                      apr_pool_t *pool)
+{
+  return svn_error_trace(node->vtable->file_contents(contents, node, pool));
+}
+
+svn_error_t *
 svn_fs_try_process_file_contents(svn_boolean_t *success,
                                  svn_fs_root_t *root,
                                  const char *path,
@@ -1525,6 +1587,18 @@ svn_fs_contents_different(svn_boolean_t
                                                          TRUE,
                                                          scratch_pool));
 }
+
+svn_error_t *
+svn_fs_contents_different2(svn_boolean_t *different_p,
+                           svn_fs_node_t *node1,
+                           svn_fs_node_t *node2,
+                           apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(node1->vtable->contents_changed(different_p,
+                                                         node1, node2,
+                                                         TRUE,
+                                                         scratch_pool));
+}
 
 svn_error_t *
 svn_fs_contents_changed(svn_boolean_t *changed_p, svn_fs_root_t *root1,

Modified: subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.h?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/fs-node-api/subversion/libsvn_fs/fs-loader.h Sun Jan 10 
03:20:57 2016
@@ -456,6 +456,10 @@ typedef struct node_vtable_t
   svn_error_t *(*node_kind)(svn_node_kind_t *kind_p,
                             svn_fs_node_t *node,
                             apr_pool_t *scratch_pool);
+  svn_error_t *(*node_relation)(svn_fs_node_relation_t *relation_p,
+                                svn_fs_node_t *node_a,
+                                svn_fs_node_t *node_b,
+                                apr_pool_t *scratch_pool);
   svn_error_t *(*node_created_rev)(svn_revnum_t *revision_p,
                                    svn_fs_node_t *node,
                                    apr_pool_t *scratch_pool);
@@ -467,10 +471,28 @@ typedef struct node_vtable_t
                                 svn_fs_node_t *node,
                                 apr_pool_t *result_pool,
                                 apr_pool_t *scratch_pool);
+  svn_error_t *(*props_changed)(int *changed_p,
+                                svn_fs_node_t *node1,
+                                svn_fs_node_t *node2,
+                                svn_boolean_t strict,
+                                apr_pool_t *scratch_pool);
   /* Files */
   svn_error_t *(*file_length)(svn_filesize_t *length_p,
                               svn_fs_node_t *node,
                               apr_pool_t *pool);
+  svn_error_t *(*file_checksum)(svn_checksum_t **checksum_p,
+                                svn_checksum_kind_t kind,
+                                svn_fs_node_t *node,
+                                apr_pool_t *pool);
+  svn_error_t *(*file_contents)(svn_stream_t **contents_p,
+                                svn_fs_node_t *node,
+                                apr_pool_t *pool);
+  svn_error_t *(*contents_changed)(int *changed_p,
+                                   svn_fs_node_t *node1,
+                                   svn_fs_node_t *node2,
+                                   svn_boolean_t strict,
+                                   apr_pool_t *scratch_pool);
+
   /* Directories */
   svn_error_t *(*dir_entries)(apr_hash_t **entries_p,
                               svn_fs_node_t *node,

Modified: subversion/branches/fs-node-api/subversion/libsvn_fs/node_compat.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/libsvn_fs/node_compat.c?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/libsvn_fs/node_compat.c 
(original)
+++ subversion/branches/fs-node-api/subversion/libsvn_fs/node_compat.c Sun Jan 
10 03:20:57 2016
@@ -66,6 +66,26 @@ compat_fs_node_kind(svn_node_kind_t *kin
 }
 
 static svn_error_t *
+compat_fs_node_relation(svn_fs_node_relation_t *relation_p,
+                        svn_fs_node_t *node_a,
+                        svn_fs_node_t *node_b,
+                        apr_pool_t *scratch_pool)
+{
+  compat_node_data_t *fnd_a = node_a->fsap_data;
+  compat_node_data_t *fnd_b = node_b->fsap_data;
+  svn_fs_root_t *root_a;
+  svn_fs_root_t *root_b;
+
+  SVN_ERR(get_root(&root_a, fnd_a, scratch_pool));
+  SVN_ERR(get_root(&root_b, fnd_b, scratch_pool));
+
+  return svn_error_trace(root_a->vtable->node_relation(relation_p,
+                                                       root_a, fnd_a->path,
+                                                       root_b, fnd_b->path,
+                                                       scratch_pool));
+}
+
+static svn_error_t *
 compat_fs_node_created_rev(svn_revnum_t *revision_p,
                            svn_fs_node_t *node,
                            apr_pool_t *scratch_pool)
@@ -109,6 +129,28 @@ compat_fs_node_proplist(apr_hash_t **pro
 }
 
 static svn_error_t *
+compat_fs_node_props_changed(int *changed_p,
+                             svn_fs_node_t *node1,
+                             svn_fs_node_t *node2,
+                             svn_boolean_t strict,
+                             apr_pool_t *scratch_pool)
+{
+  compat_node_data_t *fnd1 = node1->fsap_data;
+  compat_node_data_t *fnd2 = node2->fsap_data;
+  svn_fs_root_t *root1;
+  svn_fs_root_t *root2;
+
+  SVN_ERR(get_root(&root1, fnd1, scratch_pool));
+  SVN_ERR(get_root(&root2, fnd2, scratch_pool));
+
+  return svn_error_trace(root1->vtable->props_changed(changed_p,
+                                                      root1, fnd1->path,
+                                                      root2, fnd2->path,
+                                                      strict,
+                                                      scratch_pool));
+}
+
+static svn_error_t *
 compat_fs_node_file_length(svn_filesize_t *length_p,
                            svn_fs_node_t *node,
                            apr_pool_t *pool)
@@ -124,6 +166,59 @@ compat_fs_node_file_length(svn_filesize_
 }
 
 static svn_error_t *
+compat_fs_node_file_checksum(svn_checksum_t **checksum_p,
+                             svn_checksum_kind_t kind,
+                             svn_fs_node_t *node,
+                             apr_pool_t *pool)
+{
+  compat_node_data_t *fnd = node->fsap_data;
+  svn_fs_root_t *root;
+
+  SVN_ERR(get_root(&root, fnd, pool));
+
+  return svn_error_trace(root->vtable->file_checksum(checksum_p, kind,
+                                                     root, fnd->path,
+                                                     pool));
+}
+
+static svn_error_t *
+compat_fs_node_file_contents(svn_stream_t **contents_p,
+                             svn_fs_node_t *node,
+                             apr_pool_t *pool)
+{
+  compat_node_data_t *fnd = node->fsap_data;
+  svn_fs_root_t *root;
+
+  SVN_ERR(get_root(&root, fnd, pool));
+
+  return svn_error_trace(root->vtable->file_contents(contents_p,
+                                                     root, fnd->path,
+                                                     pool));
+}
+
+static svn_error_t *
+compat_fs_node_contents_changed(int *changed_p,
+                                svn_fs_node_t *node1,
+                                svn_fs_node_t *node2,
+                                svn_boolean_t strict,
+                                apr_pool_t *scratch_pool)
+{
+  compat_node_data_t *fnd1 = node1->fsap_data;
+  compat_node_data_t *fnd2 = node2->fsap_data;
+  svn_fs_root_t *root1;
+  svn_fs_root_t *root2;
+
+  SVN_ERR(get_root(&root1, fnd1, scratch_pool));
+  SVN_ERR(get_root(&root2, fnd2, scratch_pool));
+
+  return svn_error_trace(root1->vtable->contents_changed(changed_p,
+                                                         root1, fnd1->path,
+                                                         root2, fnd2->path,
+                                                         strict,
+                                                         scratch_pool));
+}
+
+static svn_error_t *
 compat_fs_node_dir_entries(apr_hash_t **entries_p,
                            svn_fs_node_t *node,
                            apr_pool_t *result_pool,
@@ -164,10 +259,15 @@ compat_fs_node_dir_entries(apr_hash_t **
 static const node_vtable_t compat_node_vtable = 
 {
   compat_fs_node_kind,
+  compat_fs_node_relation,
   compat_fs_node_created_rev,
   compat_fs_node_has_props,
   compat_fs_node_proplist,
+  compat_fs_node_props_changed,
   compat_fs_node_file_length,
+  compat_fs_node_file_checksum,
+  compat_fs_node_file_contents,
+  compat_fs_node_contents_changed,
   compat_fs_node_dir_entries
 };
 

Modified: subversion/branches/fs-node-api/subversion/libsvn_fs_fs/node.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/libsvn_fs_fs/node.c?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/libsvn_fs_fs/node.c (original)
+++ subversion/branches/fs-node-api/subversion/libsvn_fs_fs/node.c Sun Jan 10 
03:20:57 2016
@@ -39,6 +39,24 @@ fs_node_kind(svn_node_kind_t *kind_p,
 }
 
 static svn_error_t *
+fs_node_relation(svn_fs_node_relation_t *relation_p,
+                 svn_fs_node_t *node_a,
+                 svn_fs_node_t *node_b,
+                 apr_pool_t *scratch_pool)
+{
+  fs_node_data_t *fnd_a = node_a->fsap_data;
+  fs_node_data_t *fnd_b = node_b->fsap_data;
+  const svn_fs_id_t *id_a;
+  const svn_fs_id_t *id_b;
+
+  id_a = svn_fs_fs__dag_get_id(fnd_a->dag_node);
+  id_b = svn_fs_fs__dag_get_id(fnd_b->dag_node);
+
+  *relation_p = svn_fs_fs__id_compare(id_a, id_b);
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 fs_node_created_rev(svn_revnum_t *revision_p,
                     svn_fs_node_t *node,
                     apr_pool_t *scratch_pool)
@@ -78,6 +96,23 @@ fs_node_proplist(apr_hash_t **proplist_p
 }
 
 static svn_error_t *
+fs_node_props_changed(int *changed_p,
+                      svn_fs_node_t *node1,
+                      svn_fs_node_t *node2,
+                      svn_boolean_t strict,
+                      apr_pool_t *scratch_pool)
+{
+  fs_node_data_t *fnd1 = node1->fsap_data;
+  fs_node_data_t *fnd2 = node2->fsap_data;
+
+  SVN_ERR(svn_fs_fs__dag_things_different(changed_p, NULL,
+                                          fnd1->dag_node, fnd2->dag_node,
+                                          strict, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 fs_node_file_length(svn_filesize_t *length_p,
                            svn_fs_node_t *node,
                            apr_pool_t *pool)
@@ -90,6 +125,49 @@ fs_node_file_length(svn_filesize_t *leng
 }
 
 static svn_error_t *
+fs_node_file_checksum(svn_checksum_t **checksum_p,
+                      svn_checksum_kind_t kind,
+                      svn_fs_node_t *node,
+                      apr_pool_t *pool)
+{
+  fs_node_data_t *fnd = node->fsap_data;
+
+  SVN_ERR(svn_fs_fs__dag_file_checksum(checksum_p, fnd->dag_node, kind,
+                                       pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fs_node_file_contents(svn_stream_t **contents_p,
+                      svn_fs_node_t *node,
+                      apr_pool_t *pool)
+{
+  fs_node_data_t *fnd = node->fsap_data;
+
+  SVN_ERR(svn_fs_fs__dag_get_contents(contents_p, fnd->dag_node, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fs_node_contents_changed(int *changed_p,
+                         svn_fs_node_t *node1,
+                         svn_fs_node_t *node2,
+                         svn_boolean_t strict,
+                         apr_pool_t *scratch_pool)
+{
+  fs_node_data_t *fnd1 = node1->fsap_data;
+  fs_node_data_t *fnd2 = node2->fsap_data;
+
+  SVN_ERR(svn_fs_fs__dag_things_different(NULL, changed_p,
+                                          fnd1->dag_node, fnd2->dag_node,
+                                          strict, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 fs_node_dir_entries(apr_hash_t **entries_p,
                     svn_fs_node_t *node,
                     apr_pool_t *result_pool,
@@ -127,10 +205,15 @@ fs_node_dir_entries(apr_hash_t **entries
 static const node_vtable_t fs_node_vtable = 
 {
   fs_node_kind,
+  fs_node_relation,
   fs_node_created_rev,
   fs_node_has_props,
   fs_node_proplist,
+  fs_node_props_changed,
   fs_node_file_length,
+  fs_node_file_checksum,
+  fs_node_file_contents,
+  fs_node_contents_changed,
   fs_node_dir_entries
 };
 

Modified: subversion/branches/fs-node-api/subversion/tests/libsvn_fs/fs-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/tests/libsvn_fs/fs-test.c?rev=1723900&r1=1723899&r2=1723900&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/tests/libsvn_fs/fs-test.c 
(original)
+++ subversion/branches/fs-node-api/subversion/tests/libsvn_fs/fs-test.c Sun 
Jan 10 03:20:57 2016
@@ -4274,7 +4274,10 @@ check_related(const svn_test_opts_t *opt
             const svn_fs_id_t *id1, *id2;
             int related = 0;
             svn_fs_node_relation_t relation;
+            svn_fs_node_relation_t relation2;
             svn_fs_root_t *rev_root1, *rev_root2;
+            svn_fs_node_t *node1;
+            svn_fs_node_t *node2;
 
             /* Get the ID for the first path/revision combination. */
             SVN_ERR(svn_fs_revision_root(&rev_root1, fs, pr1.rev, subpool));
@@ -4337,6 +4340,14 @@ check_related(const svn_test_opts_t *opt
                    pr1.path, (int)pr1.rev, pr2.path, (int)pr2.rev);
               }
 
+            /* Try svn_fs_node_relation2() as well. */
+            SVN_ERR(svn_fs_open_node(&node1, rev_root1, pr1.path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_open_node(&node2, rev_root2, pr2.path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_node_relation2(&relation2, node1, node2, subpool));
+            SVN_TEST_INT_ASSERT(relation2, relation);
+
             svn_pool_clear(subpool);
           } /* for ... */
       } /* for ... */
@@ -4349,6 +4360,8 @@ check_related(const svn_test_opts_t *opt
         svn_fs_root_t *latest_root;
         svn_revnum_t rev;
         svn_fs_node_relation_t relation;
+        svn_fs_node_t *node1;
+        svn_fs_node_t *node2;
 
         /* FS root of the latest change. */
         svn_pool_clear(subpool);
@@ -4371,6 +4384,14 @@ check_related(const svn_test_opts_t *opt
                   " it was not",
                   path, (int)latest, path, (int)rev);
               }
+
+            /* Try svn_fs_node_relation2() as well. */
+            SVN_ERR(svn_fs_open_node(&node1, latest_root, path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_open_node(&node2, rev_root, path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_node_relation2(&relation, node1, node2, subpool));
+            SVN_TEST_INT_ASSERT(relation, svn_fs_node_unchanged);
           } /* for ... */
       } /* for ... */
   }
@@ -4493,6 +4514,9 @@ check_txn_related(const svn_test_opts_t
             const svn_fs_id_t *id1, *id2;
             int related = 0;
             svn_fs_node_relation_t relation;
+            svn_fs_node_relation_t relation2;
+            svn_fs_node_t *node1;
+            svn_fs_node_t *node2;
 
             svn_pool_clear(subpool);
 
@@ -4554,6 +4578,14 @@ check_txn_related(const svn_test_opts_t
                    "expected '%s-%d' to not be related to '%s-%d'; it was",
                    pr1.path, pr1.root, pr2.path, pr2.root);
               }
+
+            /* Try svn_fs_node_relation2() as well. */
+            SVN_ERR(svn_fs_open_node(&node1, root[pr1.root], pr1.path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_open_node(&node2, root[pr2.root], pr2.path,
+                                     FALSE, subpool, subpool));
+            SVN_ERR(svn_fs_node_relation2(&relation2, node1, node2, subpool));
+            SVN_TEST_INT_ASSERT(relation2, relation);
           } /* for ... */
       } /* for ... */
 
@@ -4562,6 +4594,9 @@ check_txn_related(const svn_test_opts_t
     for (i = 1; i <= 2; ++i)
       {
         svn_fs_node_relation_t relation;
+        svn_fs_node_t *node1;
+        svn_fs_node_t *node2;
+
         svn_pool_clear(subpool);
 
         /* Query their noderev relationship to the latest change. */
@@ -4575,6 +4610,14 @@ check_txn_related(const svn_test_opts_t
               (SVN_ERR_TEST_FAILED, NULL,
               "expected 'D-%d' to be the same as 'D-0'; it was not", i);
           }
+
+        /* Try svn_fs_node_relation2() as well. */
+        SVN_ERR(svn_fs_open_node(&node1, root[i], "D",
+                                 FALSE, subpool, subpool));
+        SVN_ERR(svn_fs_open_node(&node2, root[0], "D",
+                                 FALSE, subpool, subpool));
+        SVN_ERR(svn_fs_node_relation2(&relation, node1, node2, subpool));
+        SVN_TEST_INT_ASSERT(relation, svn_fs_node_unchanged);
       } /* for ... */
   }
 


Reply via email to