You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/09/14 17:46:32 UTC

svn commit: r1384826 - in /subversion/branches/inheritable-props/subversion: include/svn_fs.h libsvn_fs/fs-loader.c libsvn_fs/fs-loader.h libsvn_fs_base/tree.c libsvn_fs_fs/tree.c libsvn_ra_local/ra_plugin.c libsvn_repos/fs-wrap.c svnserve/serve.c

Author: cmpilato
Date: Fri Sep 14 15:46:31 2012
New Revision: 1384826

URL: http://svn.apache.org/viewvc?rev=1384826&view=rev
Log:
On the 'inheritable-props' branches: Revert all changes made to the FS
layer on this branch, which minimizes the overall code impact on the
branch with arguably no penalty.

* subversion/include/svn_fs.h
  (svn_fs_node_proplist2): Remove.
  (svn_fs_node_proplist): Un-deprecate.

* subversion/libsvn_fs/fs-loader.h
  (root_vtable_t): Revert changes made on this branch to node_proplist
    vtable function.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_node_proplist2): Remove.
  (svn_fs_node_proplist): Track changes to the provider's
    node_proplist function.

* subversion/libsvn_fs_base/tree.c
  (base_node_proplist): Remove inherited properties support.

* subversion/libsvn_fs_fs/tree.c
  (fs_node_proplist): Remove inherited properties support.
 
* subversion/libsvn_ra_local/ra_plugin.c
  (get_node_props): Now (conditionally) call svn_fs_node_proplist()
    instead of svn_fs_node_proplist2().  Also, call
    svn_repos_fs_get_inherited_props() to cover the inherited
    properties bit of the work.

* subversion/libsvn_repos/fs-wrap.c
  (svn_repos_fs_get_inherited_props): Handle the parent-path walk
    here, since there's no longer any FS-layer code to do it for us.

* subversion/svnserve/serve.c
  (get_props): Now (conditionally) call svn_fs_node_proplist()
    instead of svn_fs_node_proplist2().  Also, call
    svn_repos_fs_get_inherited_props() to cover the inherited
    properties bit of the work.

Modified:
    subversion/branches/inheritable-props/subversion/include/svn_fs.h
    subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.c
    subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.h
    subversion/branches/inheritable-props/subversion/libsvn_fs_base/tree.c
    subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c
    subversion/branches/inheritable-props/subversion/libsvn_ra_local/ra_plugin.c
    subversion/branches/inheritable-props/subversion/libsvn_repos/fs-wrap.c
    subversion/branches/inheritable-props/subversion/svnserve/serve.c

Modified: subversion/branches/inheritable-props/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/include/svn_fs.h?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/include/svn_fs.h (original)
+++ subversion/branches/inheritable-props/subversion/include/svn_fs.h Fri Sep 14 15:46:31 2012
@@ -1564,34 +1564,12 @@ svn_fs_node_prop(svn_string_t **value_p,
                  apr_pool_t *pool);
 
 
-/** If @a table_p is not null, then set @a *table_p to the entire property
- * list of @a path in @a root.  The resulting table maps
+/** Set @a *table_p to the entire property list of @a path in @a root,
+ * as an APR hash table allocated in @a pool.  The resulting table maps
  * property names to pointers to #svn_string_t objects containing the
  * property value.
- *
- * If @a inherited_values is not @c NULL, then set @a *inherited_values to
- * a depth-first ordered array of #svn_prop_inherited_item_t * structures
- * (the path_or_url members of which are relative filesystem paths)
- * representing the properties inherited by @a path.  If @a inherited_values
- * is not @c NULL and no properties are inherited, then set
- * @a *inherited_values to an empty array.
- *
- * @since New in 1.8.
  */
 svn_error_t *
-svn_fs_node_proplist2(apr_hash_t **table_p,
-                      apr_array_header_t **inherited_props,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *result_pool,
-                      apr_pool_t *scratch_pool);
-
-/**
- * Similar to svn_fs_node_proplist2 but doesn't support the retrieval of
- * the properties inherited by @a path and doesn't use a scratch pool.
- *
- * @deprecated Provided for backward compatibility with the 1.8 API. */
-svn_error_t *
 svn_fs_node_proplist(apr_hash_t **table_p,
                      svn_fs_root_t *root,
                      const char *path,

Modified: subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.c Fri Sep 14 15:46:31 2012
@@ -1023,25 +1023,11 @@ svn_fs_node_prop(svn_string_t **value_p,
 }
 
 svn_error_t *
-svn_fs_node_proplist2(apr_hash_t **table_p,
-                      apr_array_header_t **inherited_props,
-                      svn_fs_root_t *root,
-                      const char *path,
-                      apr_pool_t *result_pool,
-                      apr_pool_t *scratch_pool)
-{
-  return svn_error_trace(root->vtable->node_proplist(table_p, inherited_props,
-                                                     root, path,
-                                                     result_pool, scratch_pool));
-}
-
-
-svn_error_t *
 svn_fs_node_proplist(apr_hash_t **table_p, svn_fs_root_t *root,
                      const char *path, apr_pool_t *pool)
 {
-  return svn_error_trace(root->vtable->node_proplist(table_p, NULL, root,
-                                                     path, pool, pool));
+  return svn_error_trace(root->vtable->node_proplist(table_p, root, path,
+                                                     pool));
 }
 
 svn_error_t *

Modified: subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.h?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs/fs-loader.h Fri Sep 14 15:46:31 2012
@@ -274,11 +274,8 @@ typedef struct root_vtable_t
   svn_error_t *(*node_prop)(svn_string_t **value_p, svn_fs_root_t *root,
                             const char *path, const char *propname,
                             apr_pool_t *pool);
-  svn_error_t *(*node_proplist)(apr_hash_t **table_p,
-                                apr_array_header_t **inherited_props,
-                                svn_fs_root_t *root,
-                                const char *path, apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool);
+  svn_error_t *(*node_proplist)(apr_hash_t **table_p, svn_fs_root_t *root,
+                                const char *path, apr_pool_t *pool);
   svn_error_t *(*change_node_prop)(svn_fs_root_t *root, const char *path,
                                    const char *name,
                                    const svn_string_t *value,

Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_base/tree.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_base/tree.c Fri Sep 14 15:46:31 2012
@@ -1244,56 +1244,21 @@ txn_body_node_proplist(void *baton, trai
 
 static svn_error_t *
 base_node_proplist(apr_hash_t **table_p,
-                   apr_array_header_t **inherited_props,
                    svn_fs_root_t *root,
                    const char *path,
-                   apr_pool_t *result_pool,
-                   apr_pool_t *scratch_pool)
+                   apr_pool_t *pool)
 {
   apr_hash_t *table;
   struct node_proplist_args args;
 
   args.table_p = &table;
   args.root = root;
+  args.path = path;
 
-  /* Get explicit properties if requested. */
-  if (table_p)
-    {
-      args.path = path;
-      SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_proplist, &args,
-                                     FALSE, result_pool));
-      *table_p = table;
-    }
-
-
-  /* If the caller requested PATH's inherited properties, then walk from
-     PATH to the repository root to gather PATH's inherited props. */
-  if (inherited_props)
-    {
-      const char *parent_path = path;
-
-      *inherited_props = apr_array_make(result_pool, 1,
-                                        sizeof(svn_prop_inherited_item_t *));
-      while (!(parent_path[0] == '/' && parent_path[1] == '\0'))
-        {
-          parent_path = svn_fspath__dirname(parent_path, scratch_pool);
-          table = NULL;
-          args.path = parent_path;
-          SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_proplist,
-                                         &args, FALSE, result_pool));
-          if (apr_hash_count(table))
-            {
-              svn_prop_inherited_item_t *i_props =
-                apr_pcalloc(result_pool, sizeof(*i_props));
-              i_props->path_or_url =
-                apr_pstrdup(result_pool, parent_path + 1);
-              i_props->prop_hash = table;
-              /* Build the output array in depth-first order. */
-              svn_sort__array_insert(&i_props, *inherited_props, 0);
-            }
-        }
-    }
+  SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_proplist, &args,
+                                 FALSE, pool));
 
+  *table_p = table;
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c Fri Sep 14 15:46:31 2012
@@ -48,7 +48,6 @@
 #include "svn_mergeinfo.h"
 #include "svn_fs.h"
 #include "svn_props.h"
-#include "svn_sorts.h"
 
 #include "fs.h"
 #include "key-gen.h"
@@ -999,67 +998,22 @@ fs_node_prop(svn_string_t **value_p,
 }
 
 
-/* If TABLE_P is not null, then set *TABLE_P to the entire property list
-   of PATH under ROOT, as an APR hash table allocated in RESULT_POOL.
-   The resulting property table maps property names to pointers to
-   svn_string_t objects containing the property value.
-
-   If INHERITED_PROPS is not null, then set *INHERITED_PROPS to a depth-first
-   ordered array of svn_prop_inherited_item_t * structures (the path_or_url
-   members of which are relative filesystem paths), allocated in RESULT_POOL,
-   representing the properties inherited by PATH.  If INHERITED_PROPS is not
-   null and no properties are inherited, then set *INHERITED_PROPS to an
-   empty array.
- */
+/* Set *TABLE_P to the entire property list of PATH under ROOT, as an
+   APR hash table allocated in POOL.  The resulting property table
+   maps property names to pointers to svn_string_t objects containing
+   the property value. */
 static svn_error_t *
 fs_node_proplist(apr_hash_t **table_p,
-                 apr_array_header_t **inherited_props,
                  svn_fs_root_t *root,
                  const char *path,
-                 apr_pool_t *result_pool,
-                 apr_pool_t *scratch_pool)
+                 apr_pool_t *pool)
 {
   apr_hash_t *table;
   dag_node_t *node;
 
-  SVN_ERR(get_dag(&node, root, path, scratch_pool));
-
-  if (table_p)
-    {
-      SVN_ERR(svn_fs_fs__dag_get_proplist(&table, node, result_pool));
-      *table_p = table ? table : apr_hash_make(result_pool);
-    }
-
-  /* If the caller requested PATH's inherited properties, then walk from
-     PATH to the repository root to gather PATH's inherited props. */
-  if (inherited_props)
-    {
-      const char *parent_path = path;
-      apr_hash_t *parent_properties;
-      apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-
-      *inherited_props = apr_array_make(result_pool, 1,
-                                        sizeof(svn_prop_inherited_item_t *));
-      while (!(parent_path[0] == '/' && parent_path[1] == '\0'))
-        {
-          svn_pool_clear(iterpool);
-          parent_path = svn_fspath__dirname(parent_path, iterpool);
-          SVN_ERR(get_dag(&node, root, parent_path, iterpool));
-          SVN_ERR(svn_fs_fs__dag_get_proplist(&parent_properties, node,
-                                              result_pool));
-          if (parent_properties && apr_hash_count(parent_properties))
-            {
-              svn_prop_inherited_item_t *i_props =
-                apr_pcalloc(result_pool, sizeof(*i_props));
-              i_props->path_or_url =
-                apr_pstrdup(result_pool, parent_path + 1);
-              i_props->prop_hash = parent_properties;
-              /* Build the output array in depth-first order. */
-              svn_sort__array_insert(&i_props, *inherited_props, 0);
-            }
-        }
-      svn_pool_destroy(iterpool);
-    }
+  SVN_ERR(get_dag(&node, root, path, pool));
+  SVN_ERR(svn_fs_fs__dag_get_proplist(&table, node, pool));
+  *table_p = table ? table : apr_hash_make(pool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_local/ra_plugin.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_local/ra_plugin.c Fri Sep 14 15:46:31 2012
@@ -1049,14 +1049,24 @@ get_node_props(apr_hash_t **props,
   const char *cmt_date, *cmt_author;
 
   /* Create a hash with props attached to the fs node. */
-  SVN_ERR(svn_fs_node_proplist2(props, inherited_props, root, path,
-                                result_pool, scratch_pool));
+  if (props)
+    {
+      SVN_ERR(svn_fs_node_proplist(props, root, path, result_pool));
+    }
 
   /* Turn FS-path keys into URLs. */
   if (inherited_props)
     {
+      svn_revnum_t revision;
       int i;
 
+      revision = svn_fs_revision_root_revision(root);
+      SVN_ERR(svn_repos_fs_get_inherited_props(inherited_props,
+                                               sess->repos, path,
+                                               revision, NULL, NULL,
+                                               result_pool,
+                                               scratch_pool));
+
       for (i = 0; i < (*inherited_props)->nelts; i++)
         {
           svn_prop_inherited_item_t *i_props =

Modified: subversion/branches/inheritable-props/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_repos/fs-wrap.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_repos/fs-wrap.c Fri Sep 14 15:46:31 2012
@@ -36,6 +36,7 @@
 #include "svn_private_config.h"
 #include "private/svn_repos_private.h"
 #include "private/svn_utf_private.h"
+#include "private/svn_fspath.h"
 
 
 /*** Commit wrappers ***/
@@ -718,7 +719,7 @@ svn_repos_fs_pack2(svn_repos_t *repos,
 }
 
 svn_error_t *
-svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
+svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props_p,
                                  svn_repos_t *repos,
                                  const char *path,
                                  svn_revnum_t revision,
@@ -728,31 +729,47 @@ svn_repos_fs_get_inherited_props(apr_arr
                                  apr_pool_t *scratch_pool)
 {
   svn_fs_root_t *root;
-  int i;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_array_header_t *inherited_props;
+  const char *parent_path = path;
 
   if (!SVN_IS_VALID_REVNUM(revision))
     SVN_ERR(svn_fs_youngest_rev(&revision, repos->fs, iterpool));
   SVN_ERR(svn_fs_revision_root(&root, repos->fs, revision, scratch_pool));
-  SVN_ERR(svn_fs_node_proplist2(NULL, inherited_props, root, path,
-                                result_pool, scratch_pool));
-  for (i = 0; i < (*inherited_props)->nelts; i++)
+
+  inherited_props = apr_array_make(result_pool, 1,
+                                    sizeof(svn_prop_inherited_item_t *));
+  while (!(parent_path[0] == '/' && parent_path[1] == '\0'))
     {
       svn_boolean_t allowed = TRUE;
-      svn_prop_inherited_item_t *iprop =
-        APR_ARRAY_IDX(*inherited_props, i, svn_prop_inherited_item_t *);
+      apr_hash_t *parent_properties;
+
+      svn_pool_clear(iterpool);
+      parent_path = svn_fspath__dirname(parent_path, iterpool);
 
       if (authz_read_func)
-        SVN_ERR(authz_read_func(&allowed, root, iprop->path_or_url,
+        SVN_ERR(authz_read_func(&allowed, root, parent_path,
                                 authz_read_baton, iterpool));
-      if (!allowed)
+      if (allowed)
         {
-          svn_sort__array_delete(*inherited_props, i, 1);
-          i--;
+          SVN_ERR(svn_fs_node_proplist(&parent_properties, root,
+                                       parent_path, result_pool));
+          if (parent_properties && apr_hash_count(parent_properties))
+            {
+              svn_prop_inherited_item_t *i_props =
+                apr_pcalloc(result_pool, sizeof(*i_props));
+              i_props->path_or_url =
+                apr_pstrdup(result_pool, parent_path + 1);
+              i_props->prop_hash = parent_properties;
+              /* Build the output array in depth-first order. */
+              svn_sort__array_insert(&i_props, inherited_props, 0);
+            }
         }
     }
 
   svn_pool_destroy(iterpool);
+
+  *inherited_props_p = inherited_props;
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/inheritable-props/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svnserve/serve.c?rev=1384826&r1=1384825&r2=1384826&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svnserve/serve.c (original)
+++ subversion/branches/inheritable-props/subversion/svnserve/serve.c Fri Sep 14 15:46:31 2012
@@ -979,12 +979,7 @@ get_props(apr_hash_t **props,
       svn_revnum_t crev;
       const char *cdate, *cauthor, *uuid;
 
-      /* Yes, we could grab the inherited properties here too, but while we
-         already know the user has read access to PATH, we don't know that
-         the same holds true for PATH's parents, so we call
-         svn_repos_fs_get_inherited_props below, which performs the necessary
-         authz checks. */
-      SVN_ERR(svn_fs_node_proplist2(props, NULL, root, path, pool, pool));
+      SVN_ERR(svn_fs_node_proplist(props, root, path, pool));
 
       /* Hardcode the values for the committed revision, date, and author. */
       SVN_ERR(svn_repos_get_committed_info(&crev, &cdate, &cauthor, root,
@@ -1008,10 +1003,11 @@ get_props(apr_hash_t **props,
 
   /* Get any inherited properties the user is authorized to. */
   if (iprops)
-    SVN_ERR(svn_repos_fs_get_inherited_props(
-      iprops, b->repos, path,
-      svn_fs_revision_root_revision(root),
-      authz_check_access_cb_func(b), b, pool, pool));
+    {
+      SVN_ERR(svn_repos_fs_get_inherited_props(
+                  iprops, b->repos, path, svn_fs_revision_root_revision(root),
+                  authz_check_access_cb_func(b), b, pool, pool));
+    }
 
   return SVN_NO_ERROR;
 }