You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/09/23 19:20:32 UTC

svn commit: r1000545 - in /subversion/trunk/subversion/libsvn_wc: entries.c wc-queries.sql wc_db.c

Author: philip
Date: Thu Sep 23 17:20:32 2010
New Revision: 1000545

URL: http://svn.apache.org/viewvc?rev=1000545&view=rev
Log:
Make externals_tests.py PASS with SVN_WC__NODES_ONLY.

* subversion/libsvn_wc/wc_db.c
  (prop_upgrade_trees): Query NODES table.

* subversion/libsvn_wc/entries.c
  (read_one_entry): Query NODES table.
  (write_one_entry): Update NODES table.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_NOT_PRESENT_1, STMT_PLAN_PROP_UPGRADE_1): New.

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

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=1000545&r1=1000544&r2=1000545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Thu Sep 23 17:20:32 2010
@@ -606,16 +606,35 @@ read_one_entry(const svn_wc_entry_t **ne
         {
           svn_sqlite__db_t *sdb;
           svn_sqlite__stmt_t *stmt;
+#ifdef SVN_WC__NODES
+          svn_sqlite__stmt_t *stmt_nodes;
+          svn_boolean_t have_nodes_row;
+#endif
 
           SVN_ERR(svn_wc__db_temp_borrow_sdb(
                     &sdb, db, dir_abspath,
                     svn_wc__db_openmode_readonly,
                     scratch_pool));
 
+#ifndef SVN_WC__NODES_ONLY
           SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                             STMT_SELECT_NOT_PRESENT));
           SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, entry->name));
           SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+#ifdef SVN_WC__NODES
+          SVN_ERR(svn_sqlite__get_statement(&stmt_nodes, sdb,
+                                            STMT_SELECT_NOT_PRESENT));
+          SVN_ERR(svn_sqlite__bindf(stmt_nodes, "is", wc_id, entry->name));
+          SVN_ERR(svn_sqlite__step(&have_nodes_row, stmt_nodes));
+#ifndef SVN_WC__NODES_ONLY
+          SVN_ERR_ASSERT(have_row == have_nodes_row);
+          SVN_ERR(svn_sqlite__reset(stmt_nodes));
+#else
+          stmt = stmt_nodes;
+          have_row = have_nodes_row;
+#endif
+#endif
           SVN_ERR(svn_sqlite__reset(stmt));
         }
 
@@ -2138,6 +2157,7 @@ write_entry(svn_wc__db_t *db,
                                                   &entry->file_external_rev,
                                                   scratch_pool));
 
+#ifndef SVN_WC__NODES_ONLY
           SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
                                             STMT_UPDATE_FILE_EXTERNAL));
           SVN_ERR(svn_sqlite__bindf(stmt, "iss",
@@ -2145,6 +2165,16 @@ write_entry(svn_wc__db_t *db,
                                     entry->name,
                                     str));
           SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                            STMT_UPDATE_FILE_EXTERNAL_1));
+          SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+                                    (apr_uint64_t)1 /* wc_id */,
+                                    entry->name,
+                                    str));
+          SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1000545&r1=1000544&r2=1000545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Sep 23 17:20:32 2010
@@ -829,6 +829,11 @@ values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, 
 select 1 from base_node
 where wc_id = ?1 and local_relpath = ?2 and presence = 'not-present';
 
+-- STMT_SELECT_NOT_PRESENT_1
+select 1 from nodes
+where wc_id = ?1 and local_relpath = ?2 and presence = 'not-present'
+  and op_depth = 0;
+
 -- STMT_SELECT_FILE_EXTERNAL
 select file_external from base_node
 where wc_id = ?1 and local_relpath = ?2;
@@ -879,6 +884,15 @@ select 0, presence, wc_id from base_node
 union all
 select 1, presence, wc_id from working_node where local_relpath = ?1;
 
+-- STMT_PLAN_PROP_UPGRADE_1
+select 0, nodes_base.presence, nodes_base.wc_id from nodes nodes_base
+where nodes_base.local_relpath = ?1 and nodes_base.op_depth = 0
+union all
+select 1, nodes_work.presence, nodes_work.wc_id from nodes nodes_work
+where nodes_work.local_relpath = ?1
+  and nodes_work.op_depth = (select max(op_depth) from nodes
+                             where local_relpath = ?1 and op_depth > 0);
+
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1000545&r1=1000544&r2=1000545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Sep 23 17:20:32 2010
@@ -1601,15 +1601,32 @@ prop_upgrade_trees(svn_boolean_t *base_e
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
+#ifdef SVN_WC__NODES
+  svn_sqlite__stmt_t *stmt_nodes;
+  svn_boolean_t have_nodes_row;
+#endif
 
   *base_exists = FALSE;
   *working_exists = FALSE;
 
+#ifndef SVN_WC__NODES_ONLY
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_PLAN_PROP_UPGRADE));
   SVN_ERR(svn_sqlite__bindf(stmt, "s", local_relpath));
-
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
+#endif
+#ifdef SVN_WC__NODES
+  SVN_ERR(svn_sqlite__get_statement(&stmt_nodes, sdb,
+                                    STMT_PLAN_PROP_UPGRADE_1));
+  SVN_ERR(svn_sqlite__bindf(stmt_nodes, "s", local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_nodes_row, stmt_nodes));
+#ifndef SVN_WC__NODES_ONLY
+  SVN_ERR_ASSERT(have_row == have_nodes_row);
+  SVN_ERR(svn_sqlite__reset(stmt_nodes));
+#else
+  stmt = stmt_nodes;
+  have_row = have_nodes_row;
+#endif
+#endif
   /* During a property upgrade, there better be a row corresponding to
      the provided LOCAL_RELPATH. We shouldn't even be here without a
      query for available rows.  */