subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r952416 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/status.c libsvn_wc/util.c
Date Mon, 07 Jun 2010 20:25:42 GMT
Author: rhuijben
Date: Mon Jun  7 20:25:42 2010
New Revision: 952416

URL: http://svn.apache.org/viewvc?rev=952416&view=rev
Log:
Remove the svn_wc_entry_t field from svn_wc_status3_t.

* subversion/include/svn_wc.h
  (svn_wc_status3_t): Remove entry field and move versioned up to its old
    place, to make this important boolean more visible.

* subversion/libsvn_wc/status.c
  (assemble_status): Only retrieve an entry to determine the exact add
     state. Retrieve more useful values from _read_info() to optimize
     some other code paths with data we already read.

* subversion/libsvn_wc/util.c
  (svn_wc__status2_from_3): Load entry like assemble_status() did.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/libsvn_wc/util.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=952416&r1=952415&r2=952416&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon Jun  7 20:25:42 2010
@@ -3532,8 +3532,9 @@ typedef struct svn_wc_status3_t
    * (#svn_depth_unknown for files or when no depth is set) */
   svn_depth_t depth;
 
-  /** Can be @c NULL if not under version control. */
-  const svn_wc_entry_t *entry;
+  /** If the path is under version control, versioned is TRUE, otherwise
+   * FALSE. */
+  svn_boolean_t versioned;
 
   /** The status of the entry itself, including its text if it is a file. */
   enum svn_wc_status_kind text_status;
@@ -3652,9 +3653,6 @@ typedef struct svn_wc_status3_t
   /** Set to TRUE if the item is the victim of a conflict. */
   svn_boolean_t conflicted;
 
-  /** If the path is under version control, versioned is TRUE. */
-  svn_boolean_t versioned;
-
   /** Which changelist this item is part of, or NULL if not part of any. */
   const char *changelist;
 

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=952416&r1=952415&r2=952416&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Mon Jun  7 20:25:42 2010
@@ -291,6 +291,7 @@ assemble_status(svn_wc_status3_t **statu
   svn_boolean_t switched_p = FALSE;
   const svn_wc_conflict_description2_t *tree_conflict;
   svn_boolean_t file_external_p = FALSE;
+  svn_boolean_t prop_modified_p;
   svn_wc__db_lock_t *lock;
   svn_revnum_t revision;
   svn_revnum_t changed_rev;
@@ -299,7 +300,8 @@ assemble_status(svn_wc_status3_t **statu
   const char *changelist;
   svn_boolean_t base_shadowed;
   svn_boolean_t conflicted;
-  const svn_wc_entry_t *entry;
+  svn_boolean_t copied = FALSE;
+  svn_depth_t depth;
   svn_error_t *err;
 
   /* Defaults for two main variables. */
@@ -309,14 +311,6 @@ assemble_status(svn_wc_status3_t **statu
   enum svn_wc_status_kind pristine_text_status = svn_wc_status_none;
   enum svn_wc_status_kind pristine_prop_status = svn_wc_status_none;
 
-  err = svn_wc__get_entry(&entry, db, local_abspath, FALSE, svn_node_unknown,
-                          FALSE, result_pool, scratch_pool);
-
-  if (err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND)
-    svn_error_clear(err);
-  else
-    SVN_ERR(err);
-
   /* Find out whether the path is a tree conflict victim.
    * This function will set tree_conflict to NULL if the path
    * is not a victim. */
@@ -326,11 +320,11 @@ assemble_status(svn_wc_status3_t **statu
   SVN_ERR(svn_wc__db_read_info(&db_status, &db_kind, &revision,
                                &repos_relpath, &repos_root_url, NULL,
                                &changed_rev, &changed_date,
-                               &changed_author, NULL, NULL, NULL, NULL,
+                               &changed_author, NULL, &depth, NULL, NULL,
                                NULL, &changelist, NULL, NULL, NULL, NULL,
-                               NULL, NULL, &base_shadowed, &conflicted,
-                               &lock, db, local_abspath, result_pool,
-                               scratch_pool));
+                               NULL, &prop_modified_p, &base_shadowed,
+                               &conflicted, &lock, db, local_abspath,
+                               result_pool, scratch_pool));
 
   /* ### Temporary until we've revved svn_wc_status3_t to only use
    * ### repos_{root_url,relpath} */
@@ -422,7 +416,6 @@ assemble_status(svn_wc_status3_t **statu
   if (final_text_status == svn_wc_status_normal)
     {
       svn_boolean_t has_props;
-      svn_boolean_t prop_modified_p = FALSE;
       svn_boolean_t text_modified_p = FALSE;
 #ifdef HAVE_SYMLINK
       svn_boolean_t wc_special;
@@ -434,18 +427,26 @@ assemble_status(svn_wc_status3_t **statu
             Together, these two stati are of lowest precedence, and C has
             precedence over M. */
 
-      /* Does the entry have props? */
-      {
-        apr_hash_t *pristine;
-        apr_hash_t *actual;
+      /* Does the node have props? */
+      if (prop_modified_p)
+        has_props = TRUE;
+      else
+        {
+          apr_hash_t *props;
+        
+          SVN_ERR(svn_wc__get_pristine_props(&props, db, local_abspath,
+                                             scratch_pool, scratch_pool));
+        
+          if (props != NULL && apr_hash_count(props) > 0)
+            has_props = TRUE;
+          else
+            {
+              SVN_ERR(svn_wc__get_actual_props(&props, db, local_abspath,
+                                               scratch_pool, scratch_pool));
 
-        SVN_ERR(svn_wc__get_pristine_props(&pristine, db, local_abspath,
-                                           scratch_pool, scratch_pool));
-        SVN_ERR(svn_wc__get_actual_props(&actual, db, local_abspath,
-                                         scratch_pool, scratch_pool));
-        has_props = ((pristine != NULL && apr_hash_count(pristine) > 0)
-                     || (actual != NULL && apr_hash_count(actual) > 0));
-      }
+              has_props = (props != NULL && apr_hash_count(props) > 0);
+            }
+        }
       if (has_props)
         final_prop_status = svn_wc_status_normal;
 
@@ -454,8 +455,11 @@ assemble_status(svn_wc_status3_t **statu
          ### fetched above. but for now, there is some trickery we may
          ### need to rely upon in ths function. keep it for now.  */
       /* ### see r944980 as an example of the brittleness of this stuff.  */
-      SVN_ERR(svn_wc__props_modified(&prop_modified_p, db, local_abspath,
-                                     scratch_pool));
+#if (SVN_WC__VERSION < SVN_WC__PROPS_IN_DB)
+      if (has_props)
+        SVN_ERR(svn_wc__props_modified(&prop_modified_p, db, local_abspath,
+                                       scratch_pool));
+#endif
 
       /* Record actual property status */
       pristine_prop_status = prop_modified_p ? svn_wc_status_modified
@@ -506,8 +510,7 @@ assemble_status(svn_wc_status3_t **statu
       if (prop_modified_p)
         final_prop_status = svn_wc_status_modified;
 
-      if (entry->prejfile || entry->conflict_old ||
-          entry->conflict_new || entry->conflict_wrk)
+      if (conflicted)
         {
           svn_boolean_t text_conflict_p, prop_conflict_p;
 
@@ -534,28 +537,43 @@ assemble_status(svn_wc_status3_t **statu
       /* ### db_status, base_shadowed, and fetching base_status can
          ### fully replace entry->schedule here.  */
 
-      if (entry->schedule == svn_wc_schedule_add
-          && final_text_status != svn_wc_status_conflicted)
+      if (db_status == svn_wc__db_status_added)
         {
-          final_text_status = svn_wc_status_added;
-          final_prop_status = svn_wc_status_none;
-        }
+          const svn_wc_entry_t *entry;
 
-      else if (entry->schedule == svn_wc_schedule_replace
-               && final_text_status != svn_wc_status_conflicted)
-        {
-          final_text_status = svn_wc_status_replaced;
-          final_prop_status = svn_wc_status_none;
-        }
+          err = svn_wc__get_entry(&entry, db, local_abspath, FALSE,
+                                  svn_node_unknown, FALSE, result_pool,
+                                  scratch_pool);
+
+          if (err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND)
+            svn_error_clear(err);
+          else
+            SVN_ERR(err);
+
+          copied = entry->copied;
+
+          if (entry->schedule == svn_wc_schedule_add
+              && final_text_status != svn_wc_status_conflicted)
+            {
+              final_text_status = svn_wc_status_added;
+              final_prop_status = svn_wc_status_none;
+            }
 
-      else if (entry->schedule == svn_wc_schedule_delete
+          else if (entry->schedule == svn_wc_schedule_replace
+                   && final_text_status != svn_wc_status_conflicted)
+            {
+              final_text_status = svn_wc_status_replaced;
+              final_prop_status = svn_wc_status_none;
+            }
+        }
+      else if (db_status == svn_wc__db_status_deleted
                && final_text_status != svn_wc_status_conflicted)
         {
+          /* ### Set copied for working_node only delete? */
           final_text_status = svn_wc_status_deleted;
           final_prop_status = svn_wc_status_none;
         }
 
-
       /* 3. Highest precedence:
 
             a. check to see if file or dir is just missing, or
@@ -569,7 +587,7 @@ assemble_status(svn_wc_status3_t **statu
 
          4. Check for locked directory (only for directories). */
 
-      if (entry->incomplete
+      if (db_status == svn_wc__db_status_incomplete
           && (final_text_status != svn_wc_status_deleted)
           && (final_text_status != svn_wc_status_added))
         {
@@ -620,9 +638,21 @@ assemble_status(svn_wc_status3_t **statu
   /* 6. Build and return a status structure. */
 
   stat = apr_pcalloc(result_pool, sizeof(**status));
-  stat->kind = entry->kind;
-  stat->depth = entry->depth;
-  stat->entry = entry;
+
+  switch (db_kind)
+    {
+      case svn_wc__db_kind_dir:
+        stat->kind = svn_node_dir;
+        break;
+      case svn_wc__db_kind_file:
+      case svn_wc__db_kind_symlink:
+        stat->kind = svn_node_file;
+        break;
+      case svn_wc__db_kind_unknown:
+      default:
+        stat->kind = svn_node_unknown;
+    }
+  stat->depth = depth;
   stat->text_status = final_text_status;
   stat->prop_status = final_prop_status;
   stat->repos_text_status = svn_wc_status_none;   /* default */
@@ -630,7 +660,7 @@ assemble_status(svn_wc_status3_t **statu
   stat->locked = locked_p;
   stat->switched = switched_p;
   stat->file_external = file_external_p;
-  stat->copied = entry->copied;
+  stat->copied = copied;
   stat->repos_lock = repos_lock;
   stat->url = url;
   stat->revision = revision;
@@ -2640,9 +2670,6 @@ svn_wc_dup_status3(const svn_wc_status3_
   *new_stat = *orig_stat;
 
   /* Now go back and dup the deep items into this pool. */
-  if (orig_stat->entry)
-    new_stat->entry = svn_wc_entry_dup(orig_stat->entry, pool);
-
   if (orig_stat->repos_lock)
     new_stat->repos_lock = svn_lock_dup(orig_stat->repos_lock, pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=952416&r1=952415&r2=952416&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Mon Jun  7 20:25:42 2010
@@ -565,9 +565,17 @@ svn_wc__status2_from_3(svn_wc_status2_t 
   *status = apr_pcalloc(result_pool, sizeof(**status));
 
   if (old_status->versioned)
-    SVN_ERR(svn_wc__get_entry(&entry, wc_ctx->db, local_abspath, TRUE,
-                              svn_node_unknown, FALSE, result_pool,
-                              scratch_pool));
+    {
+      svn_error_t *err;
+      err= svn_wc__get_entry(&entry, wc_ctx->db, local_abspath, FALSE,
+                             svn_node_unknown, FALSE, result_pool,
+                             scratch_pool);
+
+      if (err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND)
+        svn_error_clear(err);
+      else
+        SVN_ERR(err);
+    }
 
   SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, wc_ctx->db,
                                            local_abspath, scratch_pool,



Mime
View raw message