You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/10/30 22:23:53 UTC

svn commit: r1767193 - /subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c

Author: stefan2
Date: Sun Oct 30 22:23:53 2016
New Revision: 1767193

URL: http://svn.apache.org/viewvc?rev=1767193&view=rev
Log:
Implement svn_ra_list in ra_local.

* subversion/libsvn_ra_local/ra_plugin.c
  (svn_ra_local__has_capability): ra_local new supports the list function.
  (dirent_receiver_baton_t,
   dirent_receiver,
   svn_ra_local__list): New functions implementing the list API by trivially
                        adapting between RA- and repos-layer.
  (ra_local_vtable): Activate the LIST function in the vtable.

Modified:
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1767193&r1=1767192&r2=1767193&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Sun Oct 30 22:23:53 2016
@@ -1648,6 +1648,7 @@ svn_ra_local__has_capability(svn_ra_sess
       || strcmp(capability, SVN_RA_CAPABILITY_INHERITED_PROPS) == 0
       || strcmp(capability, SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS) == 0
       || strcmp(capability, SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE) == 0
+      || strcmp(capability, SVN_RA_CAPABILITY_LIST) == 0
       )
     {
       *has = TRUE;
@@ -1790,6 +1791,54 @@ svn_ra_local__get_commit_ev2(svn_editor_
                            result_pool, scratch_pool));
 }
 
+/* Trivially forward repos-layer callbacks to RA-layer callbacks.
+ * Their signatures are the same. */
+typedef struct dirent_receiver_baton_t
+{
+  svn_ra_dirent_receiver_t receiver;
+  void *receiver_baton;
+} dirent_receiver_baton_t;
+
+static svn_error_t *
+dirent_receiver(const char *rel_path,
+                svn_dirent_t *dirent,
+                void *baton,
+                apr_pool_t *pool)
+{
+  dirent_receiver_baton_t *b = baton;
+  return b->receiver(rel_path, dirent, b->receiver_baton, pool);
+}
+
+static svn_error_t *
+svn_ra_local__list(svn_ra_session_t *session,
+                   const char *path,
+                   svn_revnum_t revision,
+                   apr_array_header_t *patterns,
+                   svn_depth_t depth,
+                   apr_uint32_t dirent_fields,
+                   svn_ra_dirent_receiver_t receiver,
+                   void *receiver_baton,
+                   apr_pool_t *pool)
+{
+  svn_ra_local__session_baton_t *sess = session->priv;
+  svn_fs_root_t *root;
+  svn_boolean_t path_info_only = (dirent_fields & ~SVN_DIRENT_KIND) == 0;
+
+  dirent_receiver_baton_t baton;
+  baton.receiver = receiver;
+  baton.receiver_baton = receiver_baton;
+
+  SVN_ERR(svn_fs_revision_root(&root, sess->fs, revision, pool));
+  path = svn_dirent_join(sess->fs_path->data, path, pool);
+  return svn_error_trace(svn_repos_list(root, path, patterns, depth,
+                                        path_info_only, NULL, NULL,
+                                        dirent_receiver, &baton,
+                                        sess->callbacks
+                                          ? sess->callbacks->cancel_func
+                                          : NULL,
+                                        sess->callback_baton, pool));
+}
+
 /*----------------------------------------------------------------*/
 
 static const svn_version_t *
@@ -1840,7 +1889,7 @@ static const svn_ra__vtable_t ra_local_v
   svn_ra_local__get_deleted_rev,
   svn_ra_local__get_inherited_props,
   NULL /* set_svn_ra_open */,
-  NULL /* svn_ra_list */,
+  svn_ra_local__list ,
   svn_ra_local__register_editor_shim_callbacks,
   svn_ra_local__get_commit_ev2,
   NULL /* replay_range_ev2 */