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 2012/11/13 16:56:34 UTC

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

Author: rhuijben
Date: Tue Nov 13 15:56:32 2012
New Revision: 1408809

URL: http://svn.apache.org/viewvc?rev=1408809&view=rev
Log:
Fetch whether a node is copied during the wc-db call for status processing
to avoid having to call into an entry fallback function which calculates
the schedule.

* subversion/libsvn_wc/status.c
  (read_info): Obtain copied value.
  (assemble_status): Use copied value to simplify setting copied and to
    make it easy to fetch the replaced status.

* subversion/libsvn_wc/wc_db.c
  (read_children_info): Fill copied boolean.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_info_t): Add copied boolean.

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=1408809&r1=1408808&r2=1408809&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Tue Nov 13 15:56:32 2012
@@ -252,14 +252,15 @@ read_info(const struct svn_wc__db_info_t
 {
   struct svn_wc__db_info_t *mtb = apr_pcalloc(result_pool, sizeof(*mtb));
   const svn_checksum_t *checksum;
+  const char *original_repos_relpath;
 
   SVN_ERR(svn_wc__db_read_info(&mtb->status, &mtb->kind,
                                &mtb->revnum, &mtb->repos_relpath,
                                &mtb->repos_root_url, &mtb->repos_uuid,
                                &mtb->changed_rev, &mtb->changed_date,
                                &mtb->changed_author, &mtb->depth,
-                               &checksum, NULL, NULL, NULL, NULL,
-                               NULL, &mtb->lock, &mtb->recorded_size,
+                               &checksum, NULL, &original_repos_relpath, 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,
@@ -358,6 +359,7 @@ read_info(const struct svn_wc__db_info_t
     }
 
   mtb->has_checksum = (checksum != NULL);
+  mtb->copied = (original_repos_relpath != NULL);
 
 #ifdef HAVE_SYMLINK
   if (mtb->kind == svn_kind_file
@@ -676,27 +678,33 @@ assemble_status(svn_wc_status3_t **statu
             override a C text status.*/
       if (info->status == svn_wc__db_status_added)
         {
+          copied = info->copied;
           if (!info->op_root)
-            copied = TRUE; /* And keep status normal */
-          else if (info->kind == svn_kind_file
-                   && !info->have_base && !info->have_more_work)
+            { /* Keep status normal */ }
+          else if (!info->have_base && !info->have_more_work)
             {
               /* Simple addition or copy, no replacement */
               node_status = svn_wc_status_added;
-              /* If an added node has a pristine file, it was copied */
-              copied = info->has_checksum;
             }
           else
             {
-              svn_wc_schedule_t schedule;
-              SVN_ERR(svn_wc__internal_node_get_schedule(&schedule, &copied,
-                                                         db, local_abspath,
-                                                         scratch_pool));
+              svn_wc__db_status_t below_working;
+              svn_boolean_t have_base, have_work;
 
-              if (schedule == svn_wc_schedule_add)
+              SVN_ERR(svn_wc__db_info_below_working(&have_base, &have_work,
+                                                    &below_working,
+                                                    db, local_abspath,
+                                                    scratch_pool));
+
+              /* If the node is not present or deleted (read: not present
+                 in working), then the node is not a replacement */
+              if (below_working != svn_wc__db_status_not_present
+                  && below_working != svn_wc__db_status_deleted)
+                {
+                  node_status = svn_wc_status_replaced;
+                }
+              else
                 node_status = svn_wc_status_added;
-              else if (schedule == svn_wc_schedule_replace)
-                node_status = svn_wc_status_replaced;
             }
 
           /* Get moved-from info (only for potential op-roots of a move). */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1408809&r1=1408808&r2=1408809&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Nov 13 15:56:32 2012
@@ -8057,6 +8057,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->copied = op_depth > 0 && !svn_sqlite__column_is_null(stmt, 2);
           child->had_props = SQLITE_PROPERTIES_AVAILABLE(stmt, 14);
 #ifdef HAVE_SYMLINK
           if (child->had_props)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1408809&r1=1408808&r2=1408809&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Nov 13 15:56:32 2012
@@ -1918,6 +1918,7 @@ struct svn_wc__db_info_t {
   svn_boolean_t op_root;
 
   svn_boolean_t has_checksum;
+  svn_boolean_t copied;
   svn_boolean_t had_props;
   svn_boolean_t props_mod;