You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2010/04/25 03:39:39 UTC

svn commit: r937735 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_wc/node.c

Author: neels
Date: Sun Apr 25 01:39:39 2010
New Revision: 937735

URL: http://svn.apache.org/viewvc?rev=937735&view=rev
Log:
Clarify return values of svn_wc__node_get_kind(). Make a clear distinction
between svn_node_none (path is not versioned) and svn_node_unknown (node is
incomplete and kind is not known).

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_kind): Tweak comment.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_kind): As described above.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_wc/node.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=937735&r1=937734&r2=937735&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Sun Apr 25 01:39:39 2010
@@ -293,8 +293,15 @@ svn_wc__node_get_repos_info(const char *
 /**
  * Set @a kind to the @c svn_node_kind_t of @a abspath.  Use @a wc_ctx
  * to access the working copy, and @a scratch_pool for all temporary
- * allocations.  If @a abspath is not present in the working copy and
- * @a show_hidden is FALSE then set @a kind to @c svn_node_none.
+ * allocations.
+ *
+ * If @a abspath is not under version control, set @a kind to @c svn_node_none.
+ * If it is versioned but hidden and @a show_hidden is @c FALSE, also return @c
+ * svn_node_none.
+ *
+ * If the node's info is incomplete, it may or may not have a known node kind
+ * set. If the kind is not known (yet), set @a kind to @c svn_node_unknown.
+ * Otherwise return the node kind even though the node is marked incomplete.
  */
 svn_error_t *
 svn_wc__node_get_kind(svn_node_kind_t *kind,

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=937735&r1=937734&r2=937735&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Sun Apr 25 01:39:39 2010
@@ -176,9 +176,20 @@ svn_wc__node_get_kind(svn_node_kind_t *k
                       apr_pool_t *scratch_pool)
 {
   svn_wc__db_kind_t db_kind;
+  svn_error_t *err;
+
+  err = svn_wc__db_read_kind(&db_kind, wc_ctx->db, abspath, FALSE,
+                             scratch_pool);
+
+  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+    {
+      svn_error_clear(err);
+      *kind = svn_node_none;
+      return SVN_NO_ERROR;
+    }
+  else
+    SVN_ERR(err);
 
-  SVN_ERR(svn_wc__db_read_kind(&db_kind, wc_ctx->db, abspath, TRUE,
-                               scratch_pool));
   switch (db_kind)
     {
       case svn_wc__db_kind_file:
@@ -191,16 +202,14 @@ svn_wc__node_get_kind(svn_node_kind_t *k
         *kind = svn_node_file;
         break;
       case svn_wc__db_kind_unknown:
-        *kind = svn_node_unknown;  /* ### should probably be svn_node_none  */
+        *kind = svn_node_unknown;
         break;
       default:
         SVN_ERR_MALFUNCTION();
     }
 
-  /* If we found a svn_node_file or svn_node_dir, but it is hidden,
-     then consider *KIND to be svn_node_none unless SHOW_HIDDEN is true. */
-  if (! show_hidden
-      && (*kind == svn_node_file || *kind == svn_node_dir))
+  /* Make sure hidden nodes return svn_node_none. */
+  if (! show_hidden)
     {
       svn_boolean_t hidden;