subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1412651 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/iprops.c libsvn_client/mergeinfo.c libsvn_wc/deprecated.c libsvn_wc/update_editor.c
Date Thu, 22 Nov 2012 19:58:30 GMT
Author: rhuijben
Date: Thu Nov 22 19:58:28 2012
New Revision: 1412651

URL: http://svn.apache.org/viewvc?rev=1412651&view=rev
Log:
Fix the merge test that I accidentally broke by reverting svn_wc_is_wc_root2
to its 1.7 behavior, by deprecating this function. The new function allows its
callers

* subversion/include/svn_wc.h
  (svn_wc_is_wc_root2): Deprecate and describe legacy behavior.
  (svn_wc_is_root_or_switched): New function.

* subversion/libsvn_client/iprops.c
  (need_to_cache_iprops): Use svn_wc_check_root() to work properly on files
    and just return TRUE for the repository root as fetching from the wc is
    just as expensive as testing for the wcroot.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo): Use svn_wc_is_root_or_switched instead of
    the older function that should return FALSE for files for legacy reasons.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_is_wc_root2): Move function here.

* subversion/libsvn_wc/update_editor.c
  (svn_wc_is_wc_root2): Move to deprecated.c.
  (svn_wc_is_root_or_switched): New function.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/iprops.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1412651&r1=1412650&r2=1412651&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Nov 22 19:58:28 2012
@@ -5414,14 +5414,42 @@ svn_wc_crawl_revisions(const char *path,
  *
  * Use @a scratch_pool for any temporary allocations.
  *
+ * For legacy reasons only directories can be a wc-root.
+ * svn_wc_is_root_or_switched() also sets wc_root to @c TRUE for switched
+ * files.
+ *
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
  */
-svn_error_t *
+SVN_DEPRECATED svn_error_t *
 svn_wc_is_wc_root2(svn_boolean_t *wc_root,
                    svn_wc_context_t *wc_ctx,
                    const char *local_abspath,
                    apr_pool_t *scratch_pool);
 
+
+/** If @a is_wcroot is not @c NULL, set @a *is_wcroot to @c TRUE if @a
+ * local_abspath is the root of the working, otherwise to @c FALSE.
+ *
+ * If @a is_switched is not @c NULL, set @a *is_switched to @c TRUE if @a
+ * local_abspath is not the root of the working, and switched against its
+ * parent.
+ *
+ * If @a kind is not @c NULL, set @a *kind to the node kind of @a
+ * local_abspath.
+ *
+ * Use @a scratch_pool for any temporary allocations.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_wc_check_root(svn_boolean_t *is_wcroot,
+                  svn_boolean_t *is_switched,
+                  svn_kind_t *kind,
+                  svn_wc_context_t *wc_ctx,
+                  const char *local_abspath,
+                  apr_pool_t *scratch_pool);
+
 /**
  * Similar to svn_wc_is_wc_root2(), but with an access baton and relative
  * path.

Modified: subversion/trunk/subversion/libsvn_client/iprops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/iprops.c?rev=1412651&r1=1412650&r2=1412651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/iprops.c (original)
+++ subversion/trunk/subversion/libsvn_client/iprops.c Thu Nov 22 19:58:28 2012
@@ -45,26 +45,26 @@
    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,
+                     const char *local_abspath,
                      svn_client_ctx_t *ctx,
                      apr_pool_t *scratch_pool)
 {
   svn_boolean_t is_wc_root;
+  svn_boolean_t is_switched;
   svn_error_t *err;
 
-  /* Our starting assumption. */
-  *needs_cache = FALSE;
-
-  err = svn_wc_is_wc_root2(&is_wc_root, ctx->wc_ctx, abspath,
+  err = svn_wc_check_root(&is_wc_root, &is_switched, NULL,
+                          ctx->wc_ctx, local_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)
+        if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
         {
           svn_error_clear(err);
           is_wc_root = FALSE;
+          is_switched = FALSE;
         }
       else
         {
@@ -72,19 +72,7 @@ need_to_cache_iprops(svn_boolean_t *need
         }
     }
 
-  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;
-    }
+  *needs_cache = (is_wc_root || is_switched);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1412651&r1=1412650&r2=1412651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Thu Nov 22 19:58:28 2012
@@ -264,6 +264,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
           !svn_dirent_is_root(local_abspath, strlen(local_abspath)))
         {
           svn_boolean_t is_wc_root;
+          svn_boolean_t is_switched;
           svn_revnum_t parent_base_rev;
           svn_revnum_t parent_changed_rev;
 
@@ -273,9 +274,9 @@ svn_client__get_wc_mergeinfo(svn_mergein
 
           /* If we've reached the root of the working copy don't look any
              higher. */
-          SVN_ERR(svn_wc_is_wc_root2(&is_wc_root, ctx->wc_ctx,
-                                     local_abspath, iterpool));
-          if (is_wc_root)
+          SVN_ERR(svn_wc_check_root(&is_wc_root, &is_switched, NULL,
+                                    ctx->wc_ctx, local_abspath, iterpool));
+          if (is_wc_root || is_switched)
             break;
 
           /* No explicit mergeinfo on this path.  Look higher up the

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1412651&r1=1412650&r2=1412651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Thu Nov 22 19:58:28 2012
@@ -3196,6 +3196,38 @@ svn_wc_get_actual_target(const char *pat
   return svn_error_trace(svn_wc_context_destroy(wc_ctx));
 }
 
+/* This function has no internal variant as its behavior on switched
+   non-directories is not what you would expect. But this happens to
+   be the legacy behavior of this function. */
+svn_error_t *
+svn_wc_is_wc_root2(svn_boolean_t *wc_root,
+                   svn_wc_context_t *wc_ctx,
+                   const char *local_abspath,
+                   apr_pool_t *scratch_pool)
+{
+  svn_boolean_t is_root;
+  svn_boolean_t is_switched;
+  svn_kind_t kind;
+  svn_error_t *err;
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+  err = svn_wc__check_wc_root(&is_root, &kind, &is_switched,
+                              wc_ctx->db, local_abspath, scratch_pool);
+
+  if (err)
+    {
+      if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND &&
+          err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+        return svn_error_trace(err);
+
+      return svn_error_create(SVN_ERR_ENTRY_NOT_FOUND, err, err->message);
+    }
+
+  *wc_root = is_root || (kind == svn_kind_dir && is_switched);
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_wc_is_wc_root(svn_boolean_t *wc_root,
                   const char *path,

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1412651&r1=1412650&r2=1412651&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Nov 22 19:58:28 2012
@@ -5022,36 +5022,19 @@ svn_wc__check_wc_root(svn_boolean_t *wc_
                                    scratch_pool));
 }
 
-/* This function has no internal variant as its behavior on switched
-   non-directories is not what you would expect. But this happens to
-   be the legacy behavior of this function. */
 svn_error_t *
-svn_wc_is_wc_root2(svn_boolean_t *wc_root,
-                   svn_wc_context_t *wc_ctx,
-                   const char *local_abspath,
-                   apr_pool_t *scratch_pool)
+svn_wc_check_root(svn_boolean_t *is_wcroot,
+                  svn_boolean_t *is_switched,
+                  svn_kind_t *kind,
+                  svn_wc_context_t *wc_ctx,
+                  const char *local_abspath,
+                  apr_pool_t *scratch_pool)
 {
-  svn_boolean_t is_root;
-  svn_boolean_t is_switched;
-  svn_kind_t kind;
-  svn_error_t *err;
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  err = svn_wc__check_wc_root(&is_root, &kind, &is_switched,
-                              wc_ctx->db, local_abspath, scratch_pool);
-
-  if (err)
-    {
-      if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND &&
-          err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
-        return svn_error_trace(err);
-
-      return svn_error_create(SVN_ERR_ENTRY_NOT_FOUND, err, err->message);
-    }
-
-  *wc_root = is_root || (kind == svn_kind_dir && is_switched);
-
-  return SVN_NO_ERROR;
+  return svn_error_trace(svn_wc__db_is_switched(is_wcroot,is_switched, kind,
+                                                wc_ctx->db, local_abspath,
+                                                scratch_pool));
 }
 
 svn_error_t*



Mime
View raw message