On Fri, 2011-10-07 at 17:29 +0200, Daniel Shahaf wrote: > No comments on the general idea as I'm not sufficiently familiar with > the internals of the client library. That said, ...
Thanks for the comments below. I've checked in an initial API and implementation in the branch 'tree-read-api', without addressing your comments yet. As for public ... well, if it's good, yes I'd hope so; and you said on IRC that in that case we'd prefer a hidden-vtable implementation (separate API functions) so I'll change it to that format at some point. - Julian > Julian Foad wrote on Fri, Oct 07, 2011 at 14:56:42 +0100: > > This is a Request For Comments on the creation of an API for reading a > > tree of dirs and files from an arbitrary source via a common API. > > > > Would it be a public API? > > > /* V-table for #svn_client_tree_t. > > * > > * Paths are relpaths, relative to the tree root. > > * Revision numbers and repository ids are #SVN_INVALID_REVNUM and NULL > > * for an unversioned node (including a node that is a local add/copy/move > > * in a WC working tree). > > */ > > typedef struct svn_client_tree__vtable_t > > { > > /* Fetch the node kind of the node at @a relpath. > > * (### and other metadata? revnum? props?) > > * > > * Set @a *kind to the node kind. > > */ > > svn_error_t *(*get_kind)(svn_client_tree_t *tree, > > svn_node_kind_t *kind, > > const char *relpath, > > apr_pool_t *scratch_pool); > > Return an svn_client_info2_t ? > > > > > /* Fetch the contents and properties of the file at @a relpath. > > svn_error_t *(*get_file)(svn_client_tree_t *tree, > > svn_stream_t **stream, > > apr_hash_t **props, > > const char *relpath, > > apr_pool_t *result_pool, > > apr_pool_t *scratch_pool); > > > > /* Fetch the entries and properties of the directory at @a relpath. > > svn_error_t *(*get_dir)(svn_client_tree_t *tree, > > apr_hash_t **dirents, > > apr_hash_t **props, > > const char *relpath, > > apr_pool_t *result_pool, > > apr_pool_t *scratch_pool); > > > > /* Push a sub-tree into an editor, as a delta against an empty tree. > > * This is useful for efficiency when streaming a (sub-)tree from a > > * remote source. */ > > svn_error_t *(*push_as_delta_edit)(svn_client_tree_t *tree, > > const char *relpath, > > svn_delta_editor_t *editor, > > void *edit_baton, > > apr_pool_t *result_pool, > > apr_pool_t *scratch_pool) > > Add a "describe this tree" member? e.g., it could return the > PATH_OR_URL@PEG being described. > > > } svn_client_tree__vtable_t;