You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/10/15 10:57:06 UTC

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

Author: julianfoad
Date: Fri Oct 15 08:57:06 2010
New Revision: 1022862

URL: http://svn.apache.org/viewvc?rev=1022862&view=rev
Log:
Simplify a WC DB function.  Remove a DB scan and a string compare, and
simply update the row in the same way every time.

* subversion/libsvn_wc/wc_db.c
  (start_directory_update_txn): Simplify

* subversion/libsvn_wc/wc-queries.sql
  (STMT_UPDATE_BASE_NODE_PRESENCE_AND_REVNUM): Remove.

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

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1022862&r1=1022861&r2=1022862&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Oct 15 08:57:06 2010
@@ -313,10 +313,6 @@ WHERE wc_id = ?1 AND local_relpath = ?2
   AND op_depth = (SELECT MAX(op_depth) FROM nodes
                   WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
 
--- STMT_UPDATE_BASE_NODE_PRESENCE_AND_REVNUM
-UPDATE nodes SET presence = ?3, revision = ?4
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-
 -- STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH
 UPDATE nodes SET presence = ?3, revision = ?4, repos_path = ?5
 WHERE wc_id = ?1 AND local_relpath = ?2 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=1022862&r1=1022861&r2=1022862&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Oct 15 08:57:06 2010
@@ -7478,42 +7478,22 @@ start_directory_update_txn(void *baton,
                            apr_pool_t *scratch_pool)
 {
   struct start_directory_update_baton *du = baton;
-  const char *repos_relpath;
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, NULL, NULL,
-                                     du->db, du->local_abspath,
-                                     scratch_pool, scratch_pool));
-
-  if (strcmp(du->new_repos_relpath, repos_relpath) == 0)
-    {
-      /* Just update revision and status */
-      SVN_ERR(svn_sqlite__get_statement(
-                        &stmt, db,
-                        STMT_UPDATE_BASE_NODE_PRESENCE_AND_REVNUM));
-
-      SVN_ERR(svn_sqlite__bindf(stmt, "isti",
-                                du->wc_id,
-                                du->local_relpath,
-                                presence_map, svn_wc__db_status_incomplete,
-                                (apr_int64_t)du->new_rev));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
-  else
-    {
-      /* ### TODO: Maybe check if we can make repos_relpath NULL. */
-      SVN_ERR(svn_sqlite__get_statement(
-                   &stmt, db,
-                   STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH));
+  /* Note: In the majority of calls, the repos_relpath is unchanged. */
+  /* ### TODO: Maybe check if we can make repos_relpath NULL. */
+  SVN_ERR(svn_sqlite__get_statement(
+               &stmt, db,
+               STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH));
+
+  SVN_ERR(svn_sqlite__bindf(stmt, "istis",
+                            du->wc_id,
+                            du->local_relpath,
+                            presence_map, svn_wc__db_status_incomplete,
+                            (apr_int64_t)du->new_rev,
+                            du->new_repos_relpath));
+  SVN_ERR(svn_sqlite__step_done(stmt));
 
-      SVN_ERR(svn_sqlite__bindf(stmt, "istis",
-                                du->wc_id,
-                                du->local_relpath,
-                                presence_map, svn_wc__db_status_incomplete,
-                                (apr_int64_t)du->new_rev,
-                                du->new_repos_relpath));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
   return SVN_NO_ERROR;
 }