You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/05/16 17:35:25 UTC

svn commit: r1103770 - in /subversion/trunk/subversion/libsvn_wc: status.c wc_db.c wc_db.h

Author: rhuijben
Date: Mon May 16 15:35:24 2011
New Revision: 1103770

URL: http://svn.apache.org/viewvc?rev=1103770&view=rev
Log:
Handle added files a bit more intelligent in the status walker. When we don't
have a checksum we certainly don't have to compare them against pristine to
see if they are modified. This removes some database transactions from some
not unlikely working copy statee.

If we have an added file without a checksum, then we know it wasn't copied. If
we combine that with the information that there are no lower layers, we can
just show status 'A'dded.

* subversion/libsvn_wc/status.c
  (read_info): Fill has_checksum and have more work.
  (assemble_status): Shortcut a few more cases to work without further db
    calls.

* subversion/libsvn_wc/wc_db.c
  (read_children_info_item_t): Add int to count the number of layers per node.
  (read_children_info): Provide has_checksum and have_more_work.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_info_t): Add two fields.

Modified:
    subversion/trunk/subversion/libsvn_wc/status.c
    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=1103770&r1=1103769&r2=1103770&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Mon May 16 15:35:24 2011
@@ -248,17 +248,18 @@ read_info(const struct svn_wc__db_info_t
           apr_pool_t *scratch_pool)
 {
   struct svn_wc__db_info_t *mtb = apr_pcalloc(result_pool, sizeof(*mtb));
+  const svn_checksum_t *checksum;
 
   SVN_ERR(svn_wc__db_read_info(&mtb->status, &mtb->kind,
                                &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->recorded_size,
+                               &mtb->depth, &checksum, 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,
+                               &mtb->have_base, &mtb->have_more_work, NULL,
                                db, local_abspath,
                                result_pool, scratch_pool));
 
@@ -275,6 +276,8 @@ read_info(const struct svn_wc__db_info_t
                                        result_pool, scratch_pool));
     }
 
+  mtb->has_checksum = (checksum != NULL);
+
 #ifdef HAVE_SYMLINK
   if (mtb->had_props || mtb->props_mod)
     {
@@ -507,12 +510,14 @@ assemble_status(svn_wc_status3_t **statu
              to avoid an extra filestat for every file, which can be
              expensive on network drives as a filestat usually can't
              be cached there */
-          if (ignore_text_mods
-              ||(dirent
-                 && dirent->filesize != SVN_INVALID_FILESIZE
-                 && dirent->mtime != 0
-                 && info->recorded_size == dirent->filesize
-                 && info->recorded_mod_time == dirent->mtime))
+          if (!info->has_checksum)
+            text_modified_p = TRUE; /* Local addition -> Modified */
+          else if (ignore_text_mods
+                  ||(dirent
+                     && info->recorded_size != SVN_INVALID_FILESIZE
+                     && info->recorded_mod_time != 0
+                     && info->recorded_size == dirent->filesize
+                     && info->recorded_mod_time == dirent->mtime))
             text_modified_p = FALSE;
           else
             {
@@ -569,6 +574,14 @@ assemble_status(svn_wc_status3_t **statu
         {
           if (!info->op_root)
             copied = TRUE; /* And keep status normal */
+          else if (info->kind == svn_wc__db_kind_file
+                   && !info->have_base && !info->have_more_work
+                   && !info->has_checksum)
+            {
+              /* Simple file addition, no replacement */
+              node_status = svn_wc_status_added;
+              copied = FALSE;
+            }
           else
             {
               svn_wc_schedule_t schedule;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1103770&r1=1103769&r2=1103770&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon May 16 15:35:24 2011
@@ -6814,6 +6814,7 @@ struct read_children_info_item_t
 {
   struct svn_wc__db_info_t info;
   apr_int64_t op_depth;
+  int nr_layers;
 };
 
 static svn_error_t *
@@ -6836,7 +6837,6 @@ read_children_info(void *baton,
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, dir_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-  
   while (have_row)
     {
       /* CHILD item points to what we have about the node. We only provide
@@ -6930,6 +6930,7 @@ read_children_info(void *baton,
 
           child->recorded_mod_time = svn_sqlite__column_int64(stmt, 13);
           child->recorded_size = get_recorded_size(stmt, 7);
+          child->has_checksum = !svn_sqlite__column_is_null(stmt, 6);
           child->had_props = SQLITE_PROPERTIES_AVAILABLE(stmt, 14);
 #ifdef HAVE_SYMLINK
           if (child->had_props)
@@ -6964,6 +6965,11 @@ read_children_info(void *baton,
             child_item->info.lock = lock_from_columns(stmt, 15, 16, 17, 18,
                                                       result_pool);
         }
+      else
+        {
+          child_item->nr_layers++;
+          child_item->info.have_more_work = (child_item->nr_layers > 1);
+        }
 
       err = svn_sqlite__step(&have_row, stmt);
       if (err)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1103770&r1=1103769&r2=1103770&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon May 16 15:35:24 2011
@@ -1872,10 +1872,12 @@ struct svn_wc__db_info_t {
 #endif
   svn_boolean_t op_root;
 
+  svn_boolean_t has_checksum;
   svn_boolean_t had_props;
   svn_boolean_t props_mod;
 
   svn_boolean_t have_base;
+  svn_boolean_t have_more_work;
 
   svn_wc__db_lock_t *lock;
 };