Author: ivan
Date: Fri Jan 8 22:59:43 2016
New Revision: 1723814
URL: http://svn.apache.org/viewvc?rev=1723814&view=rev
Log:
On 'fs-node-api' branch: Revv svn_fs_node_has_props() and svn_fs_file_length()
to accept svn_fs_node_t.
* subversion/include/svn_fs.h
(svn_fs_node_has_props2): New. Same as svn_fs_node_has_props() but accepts
svn_fs_node_t instead of ROOT+PATH.
(svn_fs_file_length2): New. Same as svn_fs_file_length() but accepts
svn_fs_node_t instead of ROOT+PATH.
* subversion/libsvn_fs/fs-loader.c
(svn_fs_node_has_props2, svn_fs_file_length2): Implement.
* subversion/libsvn_fs/fs-loader.h
(node_vtable_t): Add NODE_HAS_PROPS and FILE_LENGTH vtable members.
* subversion/libsvn_fs/node_compat.c
(compat_fs_node_has_props, compat_fs_node_file_length): New.
(compat_node_vtable): Updata node vtable.
* subversion/libsvn_repos/repos.c
(svn_repos_stat): Use FS node API.
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_repos/repos.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=1723814&r1=1723813&r2=1723814&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/include/svn_fs.h (original)
+++ subversion/branches/fs-node-api/subversion/include/svn_fs.h Fri Jan 8
22:59:43 2016
@@ -1884,11 +1884,23 @@ svn_fs_node_proplist(apr_hash_t **table_
const char *path,
apr_pool_t *pool);
-/** Set @a *has_props to TRUE if the node @a path in @a root has properties
- * and to FALSE if it doesn't have properties. Perform temporary allocations
- * in @a scratch_pool.
+/** Set @a *has_props to TRUE if the node @a node has properties and to FALSE
+ * if it doesn't have properties. Perform temporary allocations in
+ * @a scratch_pool.
*
- * @since New in 1.9.
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_node_has_props2(svn_boolean_t *has_props,
+ svn_fs_node_t *node,
+ apr_pool_t *scratch_pool);
+
+
+/**
+ * Same as svn_fs_node_has_props2(), but reference node by @a root and
+ * @a path.
+ *
+ * @since New in 1.9
*/
svn_error_t *
svn_fs_node_has_props(svn_boolean_t *has_props,
@@ -2270,10 +2282,19 @@ svn_fs_revision_link(svn_fs_root_t *from
/* Files. */
-/** Set @a *length_p to the length of the file @a path in @a root, in bytes.
+/** Set @a *length_p to the length of the file @a node, in bytes.
* Do any necessary temporary allocation in @a pool.
*/
svn_error_t *
+svn_fs_file_length2(svn_filesize_t *length_p,
+ svn_fs_node_t *node,
+ apr_pool_t *pool);
+
+/** Same as svn_fs_file_length2(), but reference node by @a root and
+ * @a path.
+ *
+ */
+svn_error_t *
svn_fs_file_length(svn_filesize_t *length_p,
svn_fs_root_t *root,
const char *path,
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=1723814&r1=1723813&r2=1723814&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 Fri Jan 8
22:59:43 2016
@@ -1204,6 +1204,15 @@ svn_fs_node_has_props(svn_boolean_t *has
}
svn_error_t *
+svn_fs_node_has_props2(svn_boolean_t *has_props,
+ svn_fs_node_t *node,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(node->vtable->node_has_props(has_props, node,
+ scratch_pool));
+}
+
+svn_error_t *
svn_fs_change_node_prop(svn_fs_root_t *root, const char *path,
const char *name, const svn_string_t *value,
apr_pool_t *pool)
@@ -1362,6 +1371,13 @@ svn_fs_file_length(svn_filesize_t *lengt
}
svn_error_t *
+svn_fs_file_length2(svn_filesize_t *length_p, svn_fs_node_t *node,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(node->vtable->file_length(length_p, node, pool));
+}
+
+svn_error_t *
svn_fs_file_checksum(svn_checksum_t **checksum,
svn_checksum_kind_t kind,
svn_fs_root_t *root,
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=1723814&r1=1723813&r2=1723814&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 Fri Jan 8
22:59:43 2016
@@ -449,6 +449,14 @@ 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);
+ /* Property operations */
+ svn_error_t *(*node_has_props)(svn_boolean_t *has_props,
+ svn_fs_node_t *node,
+ 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);
} node_vtable_t;
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=1723814&r1=1723813&r2=1723814&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 Fri Jan
8 22:59:43 2016
@@ -63,9 +63,40 @@ compat_fs_node_kind(svn_node_kind_t *kin
return SVN_NO_ERROR;
}
+static svn_error_t *
+compat_fs_node_has_props(svn_boolean_t *has_props,
+ svn_fs_node_t *node,
+ apr_pool_t *scratch_pool)
+{
+ compat_node_data_t *fnd = node->fsap_data;
+ svn_fs_root_t *root;
+ SVN_ERR(get_root(&root, fnd, scratch_pool));
+
+ return svn_error_trace(root->vtable->node_has_props(has_props, root,
+ fnd->path,
+ 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)
+{
+ 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_length(length_p, root,
+ fnd->path,
+ pool));
+}
+
static const node_vtable_t compat_node_vtable =
{
compat_fs_node_kind,
+ compat_fs_node_has_props,
+ compat_fs_node_file_length
};
svn_fs_node_t *
Modified: subversion/branches/fs-node-api/subversion/libsvn_repos/repos.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fs-node-api/subversion/libsvn_repos/repos.c?rev=1723814&r1=1723813&r2=1723814&view=diff
==============================================================================
--- subversion/branches/fs-node-api/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/fs-node-api/subversion/libsvn_repos/repos.c Fri Jan 8
22:59:43 2016
@@ -2064,25 +2064,24 @@ svn_repos_stat(svn_dirent_t **dirent,
const char *path,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
svn_dirent_t *ent;
const char *datestring;
+ svn_fs_node_t *node;
- SVN_ERR(svn_fs_check_path(&kind, root, path, pool));
+ SVN_ERR(svn_fs_open_node(&node, root, path, TRUE, pool, pool));
- if (kind == svn_node_none)
+ if (!node)
{
*dirent = NULL;
return SVN_NO_ERROR;
}
ent = svn_dirent_create(pool);
- ent->kind = kind;
+ SVN_ERR(svn_fs_node_kind(&ent->kind, node, pool));
+ if (ent->kind == svn_node_file)
+ SVN_ERR(svn_fs_file_length2(&(ent->size), node, pool));
- if (kind == svn_node_file)
- SVN_ERR(svn_fs_file_length(&(ent->size), root, path, pool));
-
- SVN_ERR(svn_fs_node_has_props(&ent->has_props, root, path, pool));
+ SVN_ERR(svn_fs_node_has_props2(&ent->has_props, node, pool));
SVN_ERR(svn_repos_get_committed_info(&(ent->created_rev),
&datestring,