Author: rhuijben
Date: Tue Apr 19 12:40:36 2011
New Revision: 1095064

URL: http://svn.apache.org/viewvc?rev=1095064&view=rev
Log:
Update svn_wc__db_base_info_t and svn_wc__db_info_t to be more similar to
their one path counterparts. Add a few values which are cheap to obtain
and can avoid further database calls.

* subversion/libsvn_wc/status.c
  (read_info): Update conversion to fill more fields. Remove SVN_DBG() call.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_BASE_CHILDREN_INFO): Fetch property information.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_base_get_children_info): Initialize had_props and shift columns.
  (read_children_info): Follow column renames and calculate op_root.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_base_info_t): Add had_props boolean.
  (svn_wc__db_info_t): Rename fields; organize as normal function and
    add op_root.

Modified:
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1095064&r1=1095063&r2=1095064&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Tue Apr 19 12:40:36 2011
@@ -250,18 +250,17 @@ read_info(const struct svn_wc__db_info_t
                                &mtb->revnum, &mtb->repos_relpath,
                                &mtb->repos_root_url, NULL, &mtb->changed_rev,
                                &mtb->changed_date, &mtb->changed_author,
-                               &mtb->depth, NULL, NULL,
-                               NULL, NULL, NULL, NULL,
-                               &mtb->lock, &mtb->translated_size,
-                               &mtb->last_mod_time, &mtb->changelist,
-                               &mtb->conflicted, NULL,
-                               &mtb->has_props, &mtb->props_mod,
+                               &mtb->depth, NULL, NULL, NULL, NULL, NULL, NULL,
+                               &mtb->lock, &mtb->recorded_size,
+                               &mtb->recorded_mod_time, &mtb->changelist,
+                               &mtb->conflicted, &mtb->op_root,
+                               &mtb->had_props, &mtb->props_mod,
                                &mtb->have_base, NULL, NULL,
                                db, local_abspath,
                                result_pool, scratch_pool));
 
 #ifdef HAVE_SYMLINK
-  if (mtb->has_props || mtb->props_mod)
+  if (mtb->had_props || mtb->props_mod)
     {
       apr_hash_t *properties;
 
@@ -416,9 +415,12 @@ assemble_status(svn_wc_status3_t **statu
         {
           node_status = svn_wc_status_deleted;
 
-          SVN_ERR(svn_wc__internal_node_get_schedule(NULL, &copied,
-                                                     db, local_abspath,
-                                                     scratch_pool));
+          if (!info->have_base)
+            copied = TRUE;
+          else
+            SVN_ERR(svn_wc__internal_node_get_schedule(NULL, &copied,
+                                                       db, local_abspath,
+                                                       scratch_pool));
         }
       else if (!dirent || dirent->kind != svn_node_dir)
         {
@@ -456,7 +458,7 @@ assemble_status(svn_wc_status3_t **statu
     {
       if (info->props_mod)
         prop_status = svn_wc_status_modified;
-      else if (info->has_props)
+      else if (info->had_props)
         prop_status = svn_wc_status_normal;
     }
 
@@ -493,8 +495,8 @@ assemble_status(svn_wc_status3_t **statu
               ||(dirent
                  && dirent->filesize != SVN_INVALID_FILESIZE
                  && dirent->mtime != 0
-                 && info->translated_size == dirent->filesize
-                 && info->last_mod_time == dirent->mtime))
+                 && info->recorded_size == dirent->filesize
+                 && info->recorded_mod_time == dirent->mtime))
             text_modified_p = FALSE;
           else
             {
@@ -550,15 +552,20 @@ assemble_status(svn_wc_status3_t **statu
             override a C text status.*/
       if (info->status == svn_wc__db_status_added)
         {
-          svn_wc_schedule_t schedule;
-          SVN_ERR(svn_wc__internal_node_get_schedule(&schedule, &copied,
-                                                     db, local_abspath,
-                                                     scratch_pool));
-
-          if (schedule == svn_wc_schedule_add)
-            node_status = svn_wc_status_added;
-          else if (schedule == svn_wc_schedule_replace)
-            node_status = svn_wc_status_replaced;
+          if (!info->op_root)
+            copied = TRUE; /* And keep status normal */
+          else
+            {
+              svn_wc_schedule_t schedule;
+              SVN_ERR(svn_wc__internal_node_get_schedule(&schedule, &copied,
+                                                         db, local_abspath,
+                                                         scratch_pool));
+            
+              if (schedule == svn_wc_schedule_add)
+                node_status = svn_wc_status_added;
+              else if (schedule == svn_wc_schedule_replace)
+                node_status = svn_wc_status_replaced;
+            }
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1095064&r1=1095063&r2=1095064&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Apr 19 12:40:36 
2011
@@ -64,7 +64,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 
 -- STMT_SELECT_BASE_CHILDREN_INFO
 SELECT local_relpath, nodes.repos_id, nodes.repos_path, presence, kind,
-  revision, depth, file_external IS NOT NULL,
+  revision, depth, properties, file_external IS NOT NULL,
   lock_token, lock_owner, lock_comment, lock_date
 FROM nodes
 LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1095064&r1=1095063&r2=1095064&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Apr 19 12:40:36 2011
@@ -2119,9 +2119,11 @@ svn_wc__db_base_get_children_info(apr_ha
 
       info->depth = (depth_str != NULL) ? svn_depth_from_word(depth_str)
                                         : svn_depth_unknown;
-      info->update_root = svn_sqlite__column_boolean(stmt, 7);
 
-      info->lock = lock_from_columns(stmt, 8, 9, 10, 11, result_pool);
+      info->had_props = SQLITE_PROPERTIES_AVAILABLE(stmt, 7);
+      info->update_root = svn_sqlite__column_boolean(stmt, 8);
+
+      info->lock = lock_from_columns(stmt, 9, 10, 11, 12, result_pool);
 
       err = fetch_repos_info(&info->repos_root_url, NULL, wcroot->sdb,
                              repos_id, result_pool);
@@ -5292,7 +5294,6 @@ read_info(svn_wc__db_status_t *status,
       if (had_props)
         {
           *had_props = SQLITE_PROPERTIES_AVAILABLE(stmt_info, 14);
-          SVN_DBG(("Had props for %s is %d status=%s\n", local_relpath, 
*had_props, svn_sqlite__column_text(stmt_info, 3, NULL)));
         }
       if (conflicted)
         {
@@ -5611,8 +5612,6 @@ read_children_info(void *baton,
           child->changed_author = svn_sqlite__column_text(stmt, 10,
                                                           result_pool);
 
-          child->last_mod_time = svn_sqlite__column_int64(stmt, 13);
-
           if (child->kind != svn_wc__db_kind_dir)
             child->depth = svn_depth_unknown;
           else
@@ -5625,8 +5624,9 @@ read_children_info(void *baton,
                 child->depth = svn_depth_unknown;
             }
 
-          child->translated_size = get_translated_size(stmt, 7);
-          child->has_props = SQLITE_PROPERTIES_AVAILABLE(stmt, 14);
+          child->recorded_mod_time = svn_sqlite__column_int64(stmt, 13);
+          child->recorded_size = get_translated_size(stmt, 7);
+          child->had_props = SQLITE_PROPERTIES_AVAILABLE(stmt, 14);
 #ifdef HAVE_SYMLINK
           if (child->has_props)
             {
@@ -5641,6 +5641,10 @@ read_children_info(void *baton,
                                               APR_HASH_KEY_STRING));
             }
 #endif
+          if (op_depth == 0)
+            child->op_root = FALSE;
+          else
+            child->op_root = (op_depth == relpath_depth(child_relpath));
 
           apr_hash_set(nodes, apr_pstrdup(result_pool, name),
                        APR_HASH_KEY_STRING, child);

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1095064&r1=1095063&r2=1095064&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Apr 19 12:40:36 2011
@@ -778,6 +778,7 @@ struct svn_wc__db_base_info_t {
   const char *repos_relpath;
   const char *repos_root_url;
   svn_depth_t depth;
+  svn_boolean_t had_props;
   svn_boolean_t update_root;
   svn_wc__db_lock_t *lock;
 };
@@ -1618,17 +1619,23 @@ struct svn_wc__db_info_t {
   svn_revnum_t changed_rev;
   const char *changed_author;
   apr_time_t changed_date;
-  apr_time_t last_mod_time;
   svn_depth_t depth;
-  svn_filesize_t translated_size;
+
+  svn_filesize_t recorded_size;
+  apr_time_t recorded_mod_time;
+
   const char *changelist;
-  svn_boolean_t has_props;
+svn_boolean_t conflicted;
 #ifdef HAVE_SYMLINK
   svn_boolean_t special;
 #endif
+  svn_boolean_t op_root;
+
+  svn_boolean_t had_props;
   svn_boolean_t props_mod;
+
   svn_boolean_t have_base;
-  svn_boolean_t conflicted;
+
   svn_wc__db_lock_t *lock;
 };
 


Reply via email to