subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r918226 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc-queries.sql wc_db.c wc_db.h
Date Tue, 02 Mar 2010 22:26:21 GMT
Author: rhuijben
Date: Tue Mar  2 22:26:20 2010
New Revision: 918226

URL: http://svn.apache.org/viewvc?rev=918226&view=rev
Log:
Update the incomplete presence directly via the wc_db apis instead of via
entries during update. Also make sure we don't propagate incomplete from
BASE_NODE to WORKING_NODE while handling tree conflicts.

* subversion/libsvn_wc/update_editor.c
  (complete_directory): Remove incomplete status via wc_db temp api.
  (open_root): Mark incomplete via wc_db temp api.
  (add_directory): When handling an addition below a deleted tree, remove
    the incomplete status or an invalid incomplete state will be introduced
    in the WORKING tree.
  (open_directory): Mark the BASE_NODE incomplete via wc_db.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_UPDATE_BASE_PRESENCE): New query.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_temp_op_set_base_incomplete): New function.
  (svn_wc__db_temp_op_set_working_incomplete): New function.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_temp_op_set_base_incomplete): New function.
  (svn_wc__db_temp_op_set_working_incomplete): New function.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.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/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=918226&r1=918225&r2=918226&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Mar  2 22:26:20 2010
@@ -663,7 +663,6 @@
   const apr_array_header_t *children;
   int i;
   apr_pool_t *iterpool;
-  svn_wc_entry_t tmp_entry;
 
   /* If this is the root directory and there is a target, we can't
      mark this directory complete. */
@@ -718,10 +717,24 @@
     }
 
   /* Mark THIS_DIR complete. */
-  tmp_entry.incomplete = FALSE;
-  SVN_ERR(svn_wc__entry_modify2(eb->db, local_abspath, svn_node_dir, FALSE,
-                                &tmp_entry, SVN_WC__ENTRY_MODIFY_INCOMPLETE,
-                                pool));
+  SVN_ERR(svn_wc__db_temp_op_set_base_incomplete(eb->db, local_abspath, FALSE,
+                                                 pool));
+
+  /* ### If we are updating below a delete-* treeconflict, all the
+         entries are moved to the copied state. This duplicates the incomplete
+         state to WORKING_NODE, so also clear it there. */
+  {
+    svn_wc__db_status_t status;
+    SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL,
+                                 eb->db, local_abspath, pool, pool));
+
+    if (status == svn_wc__db_status_incomplete)
+      SVN_ERR(svn_wc__db_temp_op_set_working_incomplete(eb->db, local_abspath,
+                                                        FALSE, pool));
+  }
 
   if (eb->depth_is_sticky)
     {
@@ -1365,7 +1378,7 @@
       svn_depth_t depth;
       svn_wc__db_status_t status;
       apr_uint64_t flags = SVN_WC__ENTRY_MODIFY_REVISION |
-        SVN_WC__ENTRY_MODIFY_URL | SVN_WC__ENTRY_MODIFY_INCOMPLETE;
+        SVN_WC__ENTRY_MODIFY_URL;
 
       /* Read the depth from the entry. */
       SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -1381,11 +1394,13 @@
       /* Mark directory as being at target_revision, but incomplete. */
       tmp_entry.revision = *(eb->target_revision);
       tmp_entry.url = db->new_URL;
-      tmp_entry.incomplete = TRUE;
       SVN_ERR(svn_wc__entry_modify2(eb->db, db->local_abspath, svn_node_dir,
                                     FALSE,
                                     &tmp_entry, flags,
                                     pool));
+
+      SVN_ERR(svn_wc__db_temp_op_set_base_incomplete(eb->db, db->local_abspath,
+                                                     TRUE, pool));
     }
 
   return SVN_NO_ERROR;
@@ -2903,6 +2918,11 @@
                                     svn_node_dir, TRUE,
                                     &tmp_entry, modify_flags, pool));
 
+      /* ### HACK: Remove the incomplete status or the next entry_modify2
+                    will move the incomplete status to WORKING_NODE */
+      SVN_ERR(svn_wc__db_temp_op_set_base_incomplete(eb->db, db->local_abspath,
+                                                     FALSE, pool));
+
       /* Mark PATH's 'this dir' entry as scheduled for deletion. */
       SVN_ERR(svn_wc__entry_modify2(eb->db, db->local_abspath,
                                     svn_node_dir, FALSE,
@@ -2947,7 +2967,7 @@
   struct edit_baton *eb = pb->edit_baton;
   svn_wc_entry_t tmp_entry;
   apr_uint64_t flags = SVN_WC__ENTRY_MODIFY_REVISION |
-    SVN_WC__ENTRY_MODIFY_URL | SVN_WC__ENTRY_MODIFY_INCOMPLETE;
+    SVN_WC__ENTRY_MODIFY_URL;
 
   svn_boolean_t already_conflicted;
   svn_wc_conflict_description2_t *tree_conflict = NULL;
@@ -3052,12 +3072,16 @@
   /* Mark directory as being at target_revision and URL, but incomplete. */
   tmp_entry.revision = *(eb->target_revision);
   tmp_entry.url = db->new_URL;
-  tmp_entry.incomplete = TRUE;
 
-  return svn_wc__entry_modify2(eb->db, db->local_abspath,
-                               svn_node_dir, FALSE,
-                              &tmp_entry, flags,
-                              pool);
+  SVN_ERR(svn_wc__entry_modify2(eb->db, db->local_abspath,
+                                svn_node_dir, FALSE,
+                                &tmp_entry, flags,
+                                pool));
+
+  SVN_ERR(svn_wc__db_temp_op_set_base_incomplete(eb->db, db->local_abspath,
+                                                 TRUE, pool));
+
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=918226&r1=918225&r2=918226&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Mar  2 22:26:20 2010
@@ -235,6 +235,10 @@
 update working_node set depth = ?3
 where wc_id = ?1 and local_relpath = ?2;
 
+-- STMT_UPDATE_BASE_PRESENCE
+update base_node set presence= ?3
+where wc_id = ?1 and local_relpath = ?2;
+
 -- STMT_UPDATE_WORKING_PRESENCE
 update working_node set presence = ?3
 where wc_id = ?1 and local_relpath =?2;
@@ -368,7 +372,6 @@
 update base_node set file_external = ?3
 where wc_id = ?1 and local_relpath = ?2;
 
-
 /* ------------------------------------------------------------------------- */
 
 /* these are used in upgrade.c  */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=918226&r1=918225&r2=918226&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Mar  2 22:26:20 2010
@@ -6153,3 +6153,76 @@
   return SVN_NO_ERROR;
 
 }
+
+svn_error_t *
+svn_wc__db_temp_op_set_base_incomplete(svn_wc__db_t *db,
+                                       const char *local_dir_abspath,
+                                       svn_boolean_t incomplete,
+                                       apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  svn_wc__db_pdh_t *pdh;
+  int affected_rows;
+  svn_wc__db_status_t base_status;
+
+  SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL,
+                                   db, local_dir_abspath,
+                                   scratch_pool, scratch_pool));
+
+  SVN_ERR_ASSERT(base_status == svn_wc__db_status_normal ||
+                 base_status == svn_wc__db_status_incomplete);
+
+  SVN_ERR(get_statement_for_path(&stmt, db, local_dir_abspath,
+                                 STMT_UPDATE_BASE_PRESENCE, scratch_pool));
+
+  SVN_ERR(svn_sqlite__bind_text(stmt, 3, incomplete ? "incomplete" : "normal"));
+
+  SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+  if (affected_rows > 0)
+   {
+     pdh = get_or_create_pdh(db, local_dir_abspath, FALSE, scratch_pool);
+     flush_entries(pdh);
+   }
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__db_temp_op_set_working_incomplete(svn_wc__db_t *db,
+                                       const char *local_dir_abspath,
+                                       svn_boolean_t incomplete,
+                                       apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  svn_wc__db_pdh_t *pdh;
+  int affected_rows;
+  svn_wc__db_status_t status;
+
+  SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL,
+                               db, local_dir_abspath,
+                               scratch_pool, scratch_pool));
+
+  SVN_ERR_ASSERT(status == svn_wc__db_status_normal ||
+                 status == svn_wc__db_status_incomplete);
+
+  SVN_ERR(get_statement_for_path(&stmt, db, local_dir_abspath,
+                                 STMT_UPDATE_WORKING_PRESENCE, scratch_pool));
+
+  SVN_ERR(svn_sqlite__bind_text(stmt, 3, incomplete ? "incomplete" : "normal"));
+
+  SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+  if (affected_rows > 0)
+   {
+     pdh = get_or_create_pdh(db, local_dir_abspath, FALSE, scratch_pool);
+     flush_entries(pdh);
+   }
+
+  return SVN_NO_ERROR;
+}
\ No newline at end of file

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=918226&r1=918225&r2=918226&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Mar  2 22:26:20 2010
@@ -2021,6 +2021,18 @@
                          const char *local_dir_abspath,
                          apr_pool_t *scratch_pool);
 
+svn_error_t *
+svn_wc__db_temp_op_set_base_incomplete(svn_wc__db_t *db,
+                                       const char *local_dir_abspath,
+                                       svn_boolean_t incomplete,
+                                       apr_pool_t *scratch_pool);
+
+svn_error_t *
+svn_wc__db_temp_op_set_working_incomplete(svn_wc__db_t *db,
+                                          const char *local_dir_abspath,
+                                          svn_boolean_t incomplete,
+                                          apr_pool_t *scratch_pool);
+
 
 /** @} */
 



Mime
View raw message