You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/08/29 20:31:33 UTC

svn commit: r1378673 - in /subversion/branches/inheritable-props/subversion: libsvn_client/iprops.c libsvn_wc/wc-queries.sql

Author: pburba
Date: Wed Aug 29 18:31:32 2012
New Revision: 1378673

URL: http://svn.apache.org/viewvc?rev=1378673&view=rev
Log:
On the inheritable-props branch: Partially revert r1378317 and fix some bugs 
that revision exposed.

* subversion/libsvn_client/iprops.c

  (need_to_cache_iprops): It's back, was deleted in r1378317, but it still
   serves a purpose.

  (svn_client__get_inheritable_props): Return to using need_to_cache_iprops,
   but instead of checking *all* the nodes returned by
   svn_wc__get_cached_iprop_children as we did pre-r1378317, now we only
   check the target itself.  A fuller explanation in the code.

* subversion/libsvn_wc/wc-queries.sql

  (STMT_SELECT_INODES): Holy smokes!  This query was unchanged from before
   the move of the iprop cache to the NODES table.  It needs to return *only*
   nodes that have iprops (which it does now).  This is what caused a slew
   of failures post-r1378317, the excessive use of need_to_cache_iprops prior
   to that was masking the fact that this query was unconditionally returning
   nodes regardless of their iprop cache.

Modified:
    subversion/branches/inheritable-props/subversion/libsvn_client/iprops.c
    subversion/branches/inheritable-props/subversion/libsvn_wc/wc-queries.sql

Modified: subversion/branches/inheritable-props/subversion/libsvn_client/iprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_client/iprops.c?rev=1378673&r1=1378672&r2=1378673&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_client/iprops.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_client/iprops.c Wed Aug 29 18:31:32 2012
@@ -40,6 +40,55 @@
 
 /*** Code. ***/
 
+/* Determine if ABSPATH needs an inherited property cache (i.e. it is a WC
+   root that is not also the repository root or it is switched).  If it does,
+   then set *NEEDS_CACHE to true, set it to false otherwise. */
+static svn_error_t *
+need_to_cache_iprops(svn_boolean_t *needs_cache,
+                     const char *abspath,
+                     svn_client_ctx_t *ctx,
+                     apr_pool_t *scratch_pool)
+{
+  svn_boolean_t is_wc_root;
+  svn_error_t *err;
+
+  /* Our starting assumption. */
+  *needs_cache = FALSE;
+
+  err = svn_wc_is_wc_root2(&is_wc_root, ctx->wc_ctx, abspath,
+                           scratch_pool);
+
+  /* ABSPATH can't need a cache if it doesn't exist. */
+  if (err)
+    {
+      if (err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+        {
+          svn_error_clear(err);
+          is_wc_root = FALSE;
+        }
+      else
+        {
+          return svn_error_trace(err);
+        }
+    }
+
+  if (is_wc_root)
+    {
+      const char *child_repos_relpath;
+
+      /* We want to cache the inherited properties for WC roots, unless that
+         root points to the root of the repository, then there in nowhere to
+         inherit properties from. */
+      SVN_ERR(svn_wc__node_get_repos_relpath(&child_repos_relpath,
+                                             ctx->wc_ctx, abspath,
+                                             scratch_pool, scratch_pool));
+      if (child_repos_relpath[0] != '\0')
+        *needs_cache = TRUE;
+    }
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_client__get_inheritable_props(apr_hash_t **wcroot_iprops,
                                   const char *local_abspath,
@@ -66,13 +115,23 @@ svn_client__get_inheritable_props(apr_ha
                                                 ctx->wc_ctx, local_abspath,
                                                 scratch_pool, iterpool));
 
-      /* Make sure LOCAL_ABSPATH is present. */
+      /* If we are in the midst of a checkout or an update that is bringing in
+         an external, then svn_wc__get_cached_iprop_children won't return
+         LOCAL_ABSPATH in IPROPS_PATHS because the former has no cached iprops
+         yet.  So make sure LOCAL_ABSPATH is present if it's a WC root. */
       if (!apr_hash_get(iprop_paths, local_abspath, APR_HASH_KEY_STRING))
         {
-          const char *target_abspath = apr_pstrdup(scratch_pool,
-                                                   local_abspath);
-          apr_hash_set(iprop_paths, target_abspath, APR_HASH_KEY_STRING,
-                       target_abspath);
+          svn_boolean_t needs_cached_iprops;
+
+          SVN_ERR(need_to_cache_iprops(&needs_cached_iprops, local_abspath,
+                                       ctx, iterpool));
+          if (needs_cached_iprops)
+            {
+              const char *target_abspath = apr_pstrdup(scratch_pool,
+                                                       local_abspath);
+              apr_hash_set(iprop_paths, target_abspath, 
+                           APR_HASH_KEY_STRING, target_abspath);
+            }
         }
 
       for (hi = apr_hash_first(scratch_pool, iprop_paths);

Modified: subversion/branches/inheritable-props/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_wc/wc-queries.sql?rev=1378673&r1=1378672&r2=1378673&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_wc/wc-queries.sql Wed Aug 29 18:31:32 2012
@@ -1532,6 +1532,7 @@ SELECT local_relpath FROM nodes
 WHERE wc_id = ?1
   AND local_relpath = ?2
   AND op_depth = 0
+  AND inherited_props not null
 
 -- STMT_SELECT_INODES_RECURSIVE
 SELECT local_relpath FROM nodes