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/08/23 12:18:50 UTC

svn commit: r988059 - in /subversion/trunk/subversion: libsvn_wc/entries.c libsvn_wc/entries.h libsvn_wc/upgrade.c tests/cmdline/upgrade_tests.py

Author: philip
Date: Mon Aug 23 10:18:49 2010
New Revision: 988059

URL: http://svn.apache.org/viewvc?rev=988059&view=rev
Log:
A basic 1.6 to single-db upgrade sufficient to pass some of the
regression tests.

* subversion/libsvn_wc/entries.c
  (insert_base_node): Don't force kind to subdir.
  (write_entry): Force subdirs to incomplete in single-db.
  (struct entries_write_baton): Add root_abspath element.
  (entries_write_new_cb): Construct single-db relpath.
  (svn_wc__write_upgraded_entries): Add root_abspath parameter.

* subversion/libsvn_wc/entries.h
  (svn_wc__write_upgraded_entries): Add root_abspath parameter.

* subversion/libsvn_wc/upgrade.c
  (struct upgrade_data_t): Add root_abspath element.
  (upgrade_to_wcng): Set and pass root_abspath.

* subversion/tests/cmdline/upgrade_tests.py
  (check_format): Only look in root directory in single-db.

Modified:
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/libsvn_wc/entries.h
    subversion/trunk/subversion/libsvn_wc/upgrade.c
    subversion/trunk/subversion/tests/cmdline/upgrade_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=988059&r1=988058&r2=988059&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Mon Aug 23 10:18:49 2010
@@ -1650,13 +1650,16 @@ insert_base_node(svn_sqlite__db_t *sdb,
 
   SVN_ERR(svn_sqlite__bind_int64(stmt, 7, base_node->revision));
 
+#ifndef SVN_WC__SINGLE_DB
   /* ### in per-subdir operation, if we're about to write a directory and
      ### it is *not* "this dir", then we're writing a row in the parent
      ### directory about the child. note that in the kind.  */
-  /* ### kind might be "symlink" or "unknown" */
   if (base_node->kind == svn_node_dir && *base_node->local_relpath != '\0')
     SVN_ERR(svn_sqlite__bind_text(stmt, 8, "subdir"));
-  else if (base_node->kind == svn_node_none)
+  else
+#endif
+  /* ### kind might be "symlink" or "unknown" */
+  if (base_node->kind == svn_node_none)
     SVN_ERR(svn_sqlite__bind_text(stmt, 5, "unknown"));
   else
     SVN_ERR(svn_sqlite__bind_text(stmt, 8,
@@ -2032,12 +2035,27 @@ write_entry(svn_wc__db_t *db,
         {
           base_node->kind = entry->kind;
 
-          if (entry->incomplete)
+#ifdef SVN_WC__SINGLE_DB
+          /* All subdirs are initially incomplete, they stop being
+             incomplete when the entries file in the subdir is
+             upgraded and remain incomplete if that doesn't happen. */
+          if (entry->kind == svn_node_dir
+              && strcmp(entry->name, SVN_WC_ENTRY_THIS_DIR))
             {
-              /* ### nobody should have set the presence.  */
-              SVN_ERR_ASSERT(base_node->presence == svn_wc__db_status_normal);
               base_node->presence = svn_wc__db_status_incomplete;
             }
+          else
+#endif
+            {
+
+              if (entry->incomplete)
+                {
+                  /* ### nobody should have set the presence.  */
+                  SVN_ERR_ASSERT(base_node->presence
+                                 == svn_wc__db_status_normal);
+                  base_node->presence = svn_wc__db_status_incomplete;
+                }
+            }
         }
 
       if (entry->kind == svn_node_dir)
@@ -2228,6 +2246,7 @@ struct entries_write_baton
   apr_int64_t repos_id;
   apr_int64_t wc_id;
   const char *local_abspath;
+  const char *root_abspath;
   apr_hash_t *entries;
 };
 
@@ -2241,6 +2260,7 @@ entries_write_new_cb(void *baton,
   struct entries_write_baton *ewb = baton;
   svn_wc__db_t *db = ewb->db;
   const char *local_abspath = ewb->local_abspath;
+  const char *root_abspath = ewb->root_abspath;
   const svn_wc_entry_t *this_dir;
   apr_hash_index_t *hi;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
@@ -2260,7 +2280,9 @@ entries_write_new_cb(void *baton,
 
   /* Write out "this dir" */
   SVN_ERR(write_entry(db, sdb, ewb->wc_id, ewb->repos_id, repos_root,
-                      this_dir, SVN_WC_ENTRY_THIS_DIR, local_abspath,
+                      this_dir,
+                      svn_dirent_skip_ancestor(root_abspath, local_abspath),
+                      local_abspath,
                       this_dir, FALSE, FALSE, iterpool));
 
   for (hi = apr_hash_first(scratch_pool, ewb->entries); hi;
@@ -2280,7 +2302,9 @@ entries_write_new_cb(void *baton,
          use this function for upgrading old working copies. */
       child_abspath = svn_dirent_join(local_abspath, name, iterpool);
       SVN_ERR(write_entry(db, sdb, ewb->wc_id, ewb->repos_id, repos_root,
-                          this_entry, name, child_abspath, this_dir,
+                          this_entry,
+                          svn_dirent_skip_ancestor(root_abspath, child_abspath),
+                          child_abspath, this_dir,
                           FALSE, TRUE,
                           iterpool));
     }
@@ -2296,6 +2320,7 @@ svn_wc__write_upgraded_entries(svn_wc__d
                                apr_int64_t repos_id,
                                apr_int64_t wc_id,
                                const char *local_abspath,
+                               const char *root_abspath,
                                apr_hash_t *entries,
                                apr_pool_t *scratch_pool)
 {
@@ -2305,6 +2330,7 @@ svn_wc__write_upgraded_entries(svn_wc__d
   ewb.repos_id = repos_id;
   ewb.wc_id = wc_id;
   ewb.local_abspath = local_abspath;
+  ewb.root_abspath = root_abspath;
   ewb.entries = entries;
 
   /* Run this operation in a transaction to speed up SQLite.

Modified: subversion/trunk/subversion/libsvn_wc/entries.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.h?rev=988059&r1=988058&r2=988059&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.h (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.h Mon Aug 23 10:18:49 2010
@@ -105,6 +105,7 @@ svn_wc__write_upgraded_entries(svn_wc__d
                                apr_int64_t repos_id,
                                apr_int64_t wc_id,
                                const char *dir_abspath,
+                               const char *root_abspath,
                                apr_hash_t *entries,
                                apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=988059&r1=988058&r2=988059&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Mon Aug 23 10:18:49 2010
@@ -1169,6 +1169,7 @@ bump_to_XXX(void *baton, svn_sqlite__db_
 
 struct upgrade_data_t {
   svn_sqlite__db_t *sdb;
+  const char *root_abspath;
   apr_int64_t repos_id;
   apr_int64_t wc_id;
 };
@@ -1278,11 +1279,13 @@ upgrade_to_wcng(svn_wc__db_t *db,
                                            scratch_pool));
       SVN_ERR(svn_wc__db_wclock_obtain(db, dir_abspath, 0, FALSE,
                                        scratch_pool));
+      data->root_abspath = apr_pstrdup(result_pool, dir_abspath);
     }
  
   SVN_ERR(svn_wc__write_upgraded_entries(db, data->sdb,
                                          data->repos_id, data->wc_id,
-                                         dir_abspath, entries,
+                                         dir_abspath, data->root_abspath,
+                                         entries,
                                          scratch_pool));
 
   /***** WC PROPS *****/

Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/upgrade_tests.py?rev=988059&r1=988058&r2=988059&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Mon Aug 23 10:18:49 2010
@@ -85,6 +85,9 @@ def check_format(sbox, expected_format):
       raise svntest.Failure("found format '%d'; expected '%d'; in wc '%s'" %
                             (found_format, expected_format, root))
 
+    if svntest.main.wc_is_singledb(sbox.wc_dir):
+      dirs[:] = []
+
     if dot_svn in dirs:
       dirs.remove(dot_svn)