Modified: 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c 
(original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c 
Wed Dec 29 00:10:25 2010
@@ -1632,10 +1632,15 @@ make_file_baton(struct dir_baton *parent
 }
 
 
-svn_boolean_t
-svn_wc__is_sendable_status(const svn_wc_status3_t *status,
-                           svn_boolean_t no_ignore,
-                           svn_boolean_t get_all)
+/**
+ * Return a boolean answer to the question "Is @a status something that
+ * should be reported?".  @a no_ignore and @a get_all are the same as
+ * svn_wc_get_status_editor4().
+ */
+static svn_boolean_t
+is_sendable_status(const svn_wc_status3_t *status,
+                   svn_boolean_t no_ignore,
+                   svn_boolean_t get_all)
 {
   /* If the repository status was touched at all, it's interesting. */
   if (status->repos_node_status != svn_wc_status_none)
@@ -1764,7 +1769,7 @@ handle_statii(struct edit_baton *eb,
         }
       if (dir_was_deleted)
         status->repos_node_status = svn_wc_status_deleted;
-      if (svn_wc__is_sendable_status(status, eb->no_ignore, eb->get_all))
+      if (is_sendable_status(status, eb->no_ignore, eb->get_all))
         SVN_ERR((eb->status_func)(eb->status_baton, local_abspath, status,
                                   iterpool));
     }
@@ -2001,8 +2006,8 @@ close_directory(void *dir_baton,
                             dir_status ? dir_status->repos_root_url : NULL,
                             dir_status ? dir_status->repos_relpath : NULL,
                             db->statii, was_deleted, db->depth, pool));
-      if (dir_status && svn_wc__is_sendable_status(dir_status, eb->no_ignore,
-                                                   eb->get_all))
+      if (dir_status && is_sendable_status(dir_status, eb->no_ignore,
+                                           eb->get_all))
         SVN_ERR((eb->status_func)(eb->status_baton, db->local_abspath,
                                   dir_status, pool));
       apr_hash_set(pb->statii, db->local_abspath, APR_HASH_KEY_STRING, NULL);
@@ -2032,8 +2037,7 @@ close_directory(void *dir_baton,
                                          eb->cancel_func, eb->cancel_baton,
                                          pool));
                 }
-              if (svn_wc__is_sendable_status(tgt_status, eb->no_ignore,
-                                             eb->get_all))
+              if (is_sendable_status(tgt_status, eb->no_ignore, eb->get_all))
                 SVN_ERR((eb->status_func)(eb->status_baton, eb->target_abspath,
                                           tgt_status, pool));
             }
@@ -2047,8 +2051,8 @@ close_directory(void *dir_baton,
                                 eb->anchor_status->repos_root_url,
                                 eb->anchor_status->repos_relpath,
                                 db->statii, FALSE, eb->default_depth, pool));
-          if (svn_wc__is_sendable_status(eb->anchor_status, eb->no_ignore,
-                                         eb->get_all))
+          if (is_sendable_status(eb->anchor_status, eb->no_ignore,
+                                 eb->get_all))
             SVN_ERR((eb->status_func)(eb->status_baton, db->local_abspath,
                                       eb->anchor_status, pool));
           eb->anchor_status = NULL;

Modified: 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c
 (original)
+++ 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c
 Wed Dec 29 00:10:25 2010
@@ -908,9 +908,6 @@ struct file_baton
   /* Set if this file is new. */
   svn_boolean_t adding_file;
 
-  /* Set if this file is new with history. */
-  svn_boolean_t added_with_history;
-
   /* Set if an unversioned file of the same name already existed in
      this directory. */
   svn_boolean_t obstruction_found;
@@ -928,24 +925,6 @@ struct file_baton
   svn_checksum_t *new_text_base_md5_checksum;
   svn_checksum_t *new_text_base_sha1_checksum;
 
-  /* If this file was added with history, these are the checksums of the
-     copy-from text base, which is in the pristine store, else NULL. */
-  svn_checksum_t *copied_text_base_md5_checksum;
-  svn_checksum_t *copied_text_base_sha1_checksum;
-
-  /* If this file was added with history, and the copyfrom had local
-     mods, this is the path to a copy of the user's version with local
-     mods (in the temporary area). */
-  const char *copied_working_text;
-
-  /* If this file was added with history, this hash contains the base
-     properties of the copied file. */
-  apr_hash_t *copied_base_props;
-
-  /* If this file was added with history, this hash contains the working
-     properties of the copied file. */
-  apr_hash_t *copied_working_props;
-
   /* Set if we've received an apply_textdelta for this file. */
   svn_boolean_t received_textdelta;
 
@@ -1318,18 +1297,21 @@ typedef struct modcheck_baton_t {
                                           then this field has no meaning. */
 } modcheck_baton_t;
 
-/* */
+/* An implementation of svn_wc__node_found_func_t. */
 static svn_error_t *
 modcheck_found_node(const char *local_abspath,
+                    svn_node_kind_t kind,
                     void *walk_baton,
                     apr_pool_t *scratch_pool)
 {
   modcheck_baton_t *baton = walk_baton;
-  svn_wc__db_kind_t kind;
+  svn_wc__db_kind_t db_kind;
   svn_wc__db_status_t status;
   svn_boolean_t modified;
 
-  SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
+  /* ### The walker could in theory pass status and db kind as arguments.
+   * ### So this read_info call is probably redundant. */
+  SVN_ERR(svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, NULL,
@@ -1342,7 +1324,7 @@ modcheck_found_node(const char *local_ab
      modification */
   else if (!baton->found_mod || baton->all_edits_are_deletes)
     SVN_ERR(entry_has_local_mods(&modified, baton->db, local_abspath,
-                                 kind, scratch_pool));
+                                 db_kind, scratch_pool));
 
   if (modified)
     {
@@ -3496,13 +3478,7 @@ apply_textdelta(void *file_baton,
     }
   else
     {
-      if (fb->copied_text_base_sha1_checksum)
-        SVN_ERR(svn_wc__db_pristine_read(&source, fb->edit_baton->db,
-                                         fb->local_abspath,
-                                         fb->copied_text_base_sha1_checksum,
-                                         handler_pool, handler_pool));
-      else
-        source = svn_stream_empty(handler_pool);
+      source = svn_stream_empty(handler_pool);
     }
 
   /* If we don't have a recorded checksum, use the ra provided checksum */
@@ -3704,8 +3680,7 @@ merge_file(svn_skel_t **work_items,
      Note that this compares to the current pristine file, which is
      different from fb->old_text_base_path if we have a replaced-with-history
      file.  However, in the case we had an obstruction, we check against the
-     new text base. (And if we're doing an add-with-history and we've already
-     saved a copy of a locally-modified file, then there certainly are mods.)
+     new text base.
 
      Special case: The working file is referring to a file external? If so
                    then we must mark it as unmodified in order to avoid bogus
@@ -3713,17 +3688,7 @@ merge_file(svn_skel_t **work_items,
                    merge externals item from the repository.
 
      ### Newly added file externals have a svn_wc_schedule_add here. */
-  if (fb->copied_working_text)
-    {
-      /* The file was copied here, and it came with both a (new) pristine
-         and a working file. Presumably, the working file is modified
-         relative to the new pristine.
-
-         The new pristine is in NEW_TEXT_BASE_TMP_ABSPATH, which should also
-         be FB->COPIED_TEXT_BASE_ABSPATH.  */
-      is_locally_modified = TRUE;
-    }
-  else if (file_external &&
+  if (file_external &&
            status ==svn_wc__db_status_added)
     {
       is_locally_modified = FALSE; /* ### Or a conflict will be raised */
@@ -3859,7 +3824,7 @@ merge_file(svn_skel_t **work_items,
           svn_node_kind_t wfile_kind;
 
           SVN_ERR(svn_io_check_path(fb->local_abspath, &wfile_kind, pool));
-          if (wfile_kind == svn_node_none && ! fb->added_with_history)
+          if (wfile_kind == svn_node_none)
             {
               /* working file is missing?!
                  Just copy the new text-base to the file. */
@@ -3890,26 +3855,18 @@ merge_file(svn_skel_t **work_items,
                     path_ext = "";
                 }
 
-              /* Create strings representing the revisions of the
-                 old and new text-bases. */
-              /* Either an old version, or an add-with-history */
-              if (fb->added_with_history)
-                oldrev_str = apr_psprintf(pool, ".copied%s%s",
+              {
+                svn_revnum_t old_rev = revision;
+
+                /* ### BH: Why is this necessary? */
+                if (!SVN_IS_VALID_REVNUM(old_rev))
+                  old_rev = 0;
+
+                oldrev_str = apr_psprintf(pool, ".r%ld%s%s",
+                                          old_rev,
                                           *path_ext ? "." : "",
                                           *path_ext ? path_ext : "");
-              else
-                {
-                  svn_revnum_t old_rev = revision;
-
-                  /* ### BH: Why is this necessary? */
-                  if (!SVN_IS_VALID_REVNUM(old_rev))
-                    old_rev = 0;
-
-                  oldrev_str = apr_psprintf(pool, ".r%ld%s%s",
-                                            old_rev,
-                                            *path_ext ? "." : "",
-                                            *path_ext ? path_ext : "");
-                }
+              }
               newrev_str = apr_psprintf(pool, ".r%ld%s%s",
                                         *eb->target_revision,
                                         *path_ext ? "." : "",
@@ -3925,11 +3882,6 @@ merge_file(svn_skel_t **work_items,
                                              pool, pool));
                   delete_left = TRUE;
                 }
-              else if (fb->copied_text_base_sha1_checksum)
-                SVN_ERR(svn_wc__db_pristine_get_path(&merge_left, eb->db,
-                                                     fb->local_abspath,
-                                                     
fb->copied_text_base_sha1_checksum,
-                                                     pool, pool));
               else
                 SVN_ERR(svn_wc__ultimate_base_text_path_to_read(
                   &merge_left, eb->db, fb->local_abspath, pool, pool));
@@ -3950,7 +3902,7 @@ merge_file(svn_skel_t **work_items,
                         merge_left, NULL,
                         new_text_base_tmp_abspath, NULL,
                         fb->local_abspath,
-                        fb->copied_working_text,
+                        NULL /* copyfrom_abspath */,
                         oldrev_str, newrev_str, mine_str,
                         FALSE /* dry_run */,
                         eb->diff3_cmd, NULL, fb->propchanges,
@@ -3967,16 +3919,6 @@ merge_file(svn_skel_t **work_items,
                                                        pool, pool));
                   *work_items = svn_wc__wq_merge(*work_items, work_item, pool);
                 }
-
-              /* And clean up add-with-history-related temp file too. */
-              if (fb->copied_working_text)
-                {
-                  SVN_ERR(svn_wc__wq_build_file_remove(&work_item,
-                                                       eb->db,
-                                                       fb->copied_working_text,
-                                                       pool, pool));
-                  *work_items = svn_wc__wq_merge(*work_items, work_item, pool);
-                }
             } /* end: working file exists and has mods */
         } /* end: working file has mods */
     } /* end: "textual" merging process */
@@ -4095,8 +4037,6 @@ close_file(void *file_baton,
   svn_wc_notify_state_t content_state, prop_state;
   svn_wc_notify_lock_state_t lock_state;
   svn_checksum_t *expected_md5_checksum = NULL;
-  svn_checksum_t *new_text_base_md5_checksum;
-  svn_checksum_t *new_text_base_sha1_checksum;
   apr_hash_t *new_base_props = NULL;
   apr_hash_t *new_actual_props = NULL;
   apr_array_header_t *entry_props;
@@ -4126,42 +4066,24 @@ close_file(void *file_baton,
     SVN_ERR(svn_checksum_parse_hex(&expected_md5_checksum, svn_checksum_md5,
                                    expected_md5_digest, pool));
 
-  /* Retrieve the new text-base file's path and checksums.  If it was an
-   * add-with-history, with no apply_textdelta, then that means the text-base
-   * of the copied file, else the new text-base created by apply_textdelta(),
-   * if any. */
   if (fb->received_textdelta)
-    {
-      new_text_base_md5_checksum = fb->new_text_base_md5_checksum;
-      new_text_base_sha1_checksum = fb->new_text_base_sha1_checksum;
-      SVN_ERR_ASSERT(new_text_base_md5_checksum &&
-                     new_text_base_sha1_checksum);
-    }
-  else if (fb->added_with_history)
-    {
-      SVN_ERR_ASSERT(! fb->new_text_base_sha1_checksum);
-      new_text_base_md5_checksum = fb->copied_text_base_md5_checksum;
-      new_text_base_sha1_checksum = fb->copied_text_base_sha1_checksum;
-      SVN_ERR_ASSERT(new_text_base_md5_checksum &&
-                     new_text_base_sha1_checksum);
-    }
+    SVN_ERR_ASSERT(fb->new_text_base_sha1_checksum
+                   && fb->new_text_base_md5_checksum);
   else
-    {
-      SVN_ERR_ASSERT(! fb->new_text_base_sha1_checksum
-                     && ! fb->copied_text_base_sha1_checksum);
-      new_text_base_md5_checksum = NULL;
-      new_text_base_sha1_checksum = NULL;
-    }
+    SVN_ERR_ASSERT(! fb->new_text_base_sha1_checksum
+                   && ! fb->new_text_base_md5_checksum);
 
-  if (new_text_base_md5_checksum && expected_md5_checksum
-      && !svn_checksum_match(expected_md5_checksum, 
new_text_base_md5_checksum))
+  if (fb->new_text_base_md5_checksum && expected_md5_checksum
+      && !svn_checksum_match(expected_md5_checksum,
+                             fb->new_text_base_md5_checksum))
     return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
             _("Checksum mismatch for '%s':\n"
               "   expected:  %s\n"
               "     actual:  %s\n"),
             svn_dirent_local_style(fb->local_abspath, pool),
             expected_md5_digest,
-            svn_checksum_to_cstring_display(new_text_base_md5_checksum, pool));
+            svn_checksum_to_cstring_display(fb->new_text_base_md5_checksum,
+                                            pool));
 
   SVN_ERR(svn_wc_read_kind(&kind, eb->wc_ctx, fb->local_abspath, TRUE, pool));
   if (kind == svn_node_none && ! fb->adding_file)
@@ -4226,15 +4148,7 @@ close_file(void *file_baton,
     local_actual_props = apr_hash_make(pool);
 
 
-  if (fb->copied_base_props)
-    {
-      /* The BASE props are given by the source of the copy. We may also
-         have some ACTUAL props if the server directed us to copy a path
-         located in our WC which had some ACTUAL changes.  */
-      current_base_props = fb->copied_base_props;
-      current_actual_props = fb->copied_working_props;
-    }
-  else if (kind != svn_node_none)
+  if (kind != svn_node_none)
     {
       /* This node already exists. Grab its properties. */
       SVN_ERR(svn_wc__get_pristine_props(&current_base_props,
@@ -4268,30 +4182,20 @@ close_file(void *file_baton,
                                 SVN_PROP_SPECIAL,
                                 APR_HASH_KEY_STRING) != NULL;
 
-      /* Jump through hoops to get the proper props in case of
-       * a copy. (see the fb->copied_base_props condition above) */
-      if (fb->copied_base_props)
-        {
-          incoming_is_link = fb->copied_working_props
-                             && apr_hash_get(fb->copied_working_props,
-                                             SVN_PROP_SPECIAL,
-                                             APR_HASH_KEY_STRING) != NULL;
-        }
-      else
-        {
-          int i;
+      {
+        int i;
 
-          for (i = 0; i < regular_props->nelts; ++i)
-            {
-              const svn_prop_t *prop = &APR_ARRAY_IDX(regular_props, i,
-                                                      svn_prop_t);
+        for (i = 0; i < regular_props->nelts; ++i)
+          {
+            const svn_prop_t *prop = &APR_ARRAY_IDX(regular_props, i,
+                                                    svn_prop_t);
 
-              if (strcmp(prop->name, SVN_PROP_SPECIAL) == 0)
-                {
-                  incoming_is_link = TRUE;
-                }
-            }
-        }
+            if (strcmp(prop->name, SVN_PROP_SPECIAL) == 0)
+              {
+                incoming_is_link = TRUE;
+              }
+          }
+      }
 
 
       if (local_is_link != incoming_is_link)
@@ -4348,7 +4252,7 @@ close_file(void *file_baton,
 
       /* Merge the text. This will queue some additional work.  */
       SVN_ERR(merge_file(&all_work_items, &install_pristine, &install_from,
-                         &content_state, fb, new_text_base_sha1_checksum,
+                         &content_state, fb, fb->new_text_base_sha1_checksum,
                          pool, scratch_pool));
 
       if (install_pristine)
@@ -4377,15 +4281,9 @@ close_file(void *file_baton,
       /* Adding a BASE node under a locally added node.
        * The incoming add becomes the revert-base! */
       svn_wc_notify_state_t no_prop_state;
-      apr_hash_t *copied_base_props;
       apr_hash_t *no_new_actual_props = NULL;
       apr_hash_t *no_working_props = apr_hash_make(pool);
 
-      copied_base_props = fb->copied_base_props;
-      if (! copied_base_props)
-        copied_base_props = apr_hash_make(pool);
-
-
       /* Store the incoming props (sent as propchanges) in new_base_props.
        * Keep the actual props unchanged. */
       SVN_ERR(svn_wc__merge_props(&no_prop_state,
@@ -4397,7 +4295,7 @@ close_file(void *file_baton,
                                   NULL /* left_version */,
                                   NULL /* right_version */,
                                   NULL /* server_baseprops (update, not merge) 
 */,
-                                  copied_base_props,
+                                  apr_hash_make(pool),
                                   no_working_props,
                                   regular_props, /* propchanges */
                                   TRUE /* base_merge */,
@@ -4414,7 +4312,7 @@ close_file(void *file_baton,
   /* Now that all the state has settled, should we update the readonly
      status of the working file? The LOCK_STATE will signal what we should
      do for this node.  */
-  if (new_text_base_sha1_checksum == NULL
+  if (fb->new_text_base_sha1_checksum == NULL
       && lock_state == svn_wc_notify_lock_state_unlocked)
     {
       /* If a lock was removed and we didn't update the text contents, we
@@ -4439,18 +4337,6 @@ close_file(void *file_baton,
       all_work_items = svn_wc__wq_merge(all_work_items, work_item, pool);
     }
 
-  /* Remove the copied text base file if we're no longer using it. */
-  if (fb->copied_text_base_sha1_checksum)
-    {
-      /* ### TODO: Add a WQ item to remove this pristine if unreferenced:
-         svn_wc__wq_build_pristine_remove(&work_item,
-                                          eb->db, fb->local_abspath,
-                                          fb->copied_text_base_sha1_checksum,
-                                          pool);
-         all_work_items = svn_wc__wq_merge(all_work_items, work_item, pool);
-      */
-    }
-
   /* ### NOTE: from this point onwards, we make several changes to the
      ### database in a non-transactional way. we also queue additional
      ### work after these changes. some revamps need to be performed to
@@ -4462,7 +4348,7 @@ close_file(void *file_baton,
       /* Set the 'checksum' column of the file's BASE_NODE row to
        * NEW_TEXT_BASE_SHA1_CHECKSUM.  The pristine text identified by that
        * checksum is already in the pristine store. */
-    const svn_checksum_t *new_checksum = new_text_base_sha1_checksum;
+    const svn_checksum_t *new_checksum = fb->new_text_base_sha1_checksum;
     const char *serialised;
 
     /* If we don't have a NEW checksum, then the base must not have changed.

Modified: 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c 
(original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c 
Wed Dec 29 00:10:25 2010
@@ -622,15 +622,6 @@ ensure_repos_info(svn_wc_entry_t *entry,
 }
 
 
-/* */
-static svn_error_t *
-bump_to_13(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_13));
-
-  return SVN_NO_ERROR;
-}
-
 /*
  * Read tree conflict descriptions from @a conflict_data.  Set @a *conflicts
  * to a hash of pointers to svn_wc_conflict_description2_t objects indexed by
@@ -804,68 +795,10 @@ migrate_tree_conflict_data(svn_sqlite__d
 }
 
 
-/* */
-static svn_error_t *
-migrate_locks(const char *wcroot_abspath,
-              svn_sqlite__db_t *sdb,
-              apr_pool_t *scratch_pool)
-{
-  const char *lockfile_abspath = build_lockfile_path(wcroot_abspath,
-                                                     scratch_pool);
-  svn_node_kind_t kind;
-
-  SVN_ERR(svn_io_check_path(lockfile_abspath, &kind, scratch_pool));
-  if (kind != svn_node_none)
-    {
-      svn_sqlite__stmt_t *stmt;
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_WC_LOCK));
-      /* ### These values are magic, and will need to be updated when we
-         ### go to a centralized system. */
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", (apr_int64_t)1, ""));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
-
-  return SVN_NO_ERROR;
-}
-
 struct bump_baton {
   const char *wcroot_abspath;
 };
 
-/* */
-static svn_error_t *
-bump_to_14(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
-
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_14));
-
-  SVN_ERR(migrate_locks(wcroot_abspath, sdb, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-
-/* */
-static svn_error_t *
-bump_to_15(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_15));
-
-  return SVN_NO_ERROR;
-}
-
-
-/* */
-static svn_error_t *
-bump_to_16(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_16));
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Migrate the properties for one node (LOCAL_ABSPATH).  */
 static svn_error_t *
 migrate_node_props(const char *dir_abspath,
@@ -1004,36 +937,36 @@ migrate_props(const char *dir_abspath,
 }
 
 
-/* */
-struct bump_to_18_baton
+/* If STR ends with SUFFIX and is longer than SUFFIX, return the part of
+ * STR that comes before SUFFIX; else return NULL. */
+static char *
+remove_suffix(const char *str, const char *suffix, apr_pool_t *result_pool)
 {
-  const char *wcroot_abspath;
-  int original_format;
-};
-
-
-static svn_error_t *
-bump_to_18(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  struct bump_to_18_baton *b18 = baton;
-
-  /* ### no schema changes (yet)... */
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_18));
+  int str_len = strlen(str);
+  int suffix_len = strlen(suffix);
 
-  SVN_ERR(migrate_props(b18->wcroot_abspath, b18->wcroot_abspath, sdb,
-                        b18->original_format, scratch_pool));
+  if (str_len > suffix_len
+      && strcmp(str + str_len - suffix_len, suffix) == 0)
+    {
+      return apr_pstrmemdup(result_pool, str, str_len - suffix_len);
+    }
 
-  return SVN_NO_ERROR;
+  return NULL;
 }
 
-/* If DIR_RELPATH is set then any .svn-revert files will trigger an
-   attempt to update the checksum in a NODES row below the top WORKING
-   node. */
+/* Copy all the text-base files from the administrative area of WC directory
+   DIR_ABSPATH into the pristine store of SDB which is located in directory
+   NEW_WCROOT_ABSPATH.
+
+   Set *TEXT_BASES_INFO to a new hash, allocated in RESULT_POOL, that maps
+   (const char *) name of the versioned file to (svn_wc__text_base_info_t *)
+   information about the pristine text. */
 static svn_error_t *
-migrate_text_bases(const char *dir_abspath,
+migrate_text_bases(apr_hash_t **text_bases_info,
+                   const char *dir_abspath,
                    const char *new_wcroot_abspath,
-                   const char *dir_relpath,
                    svn_sqlite__db_t *sdb,
+                   apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
   apr_hash_t *dirents;
@@ -1043,110 +976,108 @@ migrate_text_bases(const char *dir_abspa
                                                 TEXT_BASE_SUBDIR,
                                                 scratch_pool);
 
+  *text_bases_info = apr_hash_make(result_pool);
+
+  /* Iterate over the text-base files */
   SVN_ERR(svn_io_get_dirents3(&dirents, text_base_dir, TRUE,
                               scratch_pool, scratch_pool));
   for (hi = apr_hash_first(scratch_pool, dirents); hi;
-            hi = apr_hash_next(hi))
+       hi = apr_hash_next(hi))
     {
       const char *text_base_basename = svn__apr_hash_index_key(hi);
-      const char *pristine_path;
-      const char *text_base_path;
       svn_checksum_t *md5_checksum;
       svn_checksum_t *sha1_checksum;
-      svn_sqlite__stmt_t *stmt;
-      apr_finfo_t finfo;
 
       svn_pool_clear(iterpool);
-      text_base_path = svn_dirent_join(text_base_dir, text_base_basename,
-                                       iterpool);
 
-      /* ### This code could be a bit smarter: we could chain checksum
-             streams instead of reading the file twice; we could check to
-             see if a pristine row exists before attempting to insert one;
-             we could check and see if a pristine file exists before
-             attempting to copy a new one over it.
-             
-             However, I think simplicity is the big win here, especially since
-             this is code that runs exactly once on a user's machine: when
-             doing the upgrade.  If you disagree, feel free to add the
-             complexity. :)  */
-
-      /* Gather the two checksums. */
-      SVN_ERR(svn_io_file_checksum2(&md5_checksum, text_base_path,
-                                    svn_checksum_md5, iterpool));
-      SVN_ERR(svn_io_file_checksum2(&sha1_checksum, text_base_path,
-                                    svn_checksum_sha1, iterpool));
-
-      SVN_ERR(svn_io_stat(&finfo, text_base_path, APR_FINFO_SIZE, iterpool));
-
-      /* Insert a row into the pristine table. */
-      SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_PRISTINE));
-      SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, iterpool));
-      SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, iterpool));
-      SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
-      SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
-      SVN_ERR(svn_wc__db_pristine_get_future_path(&pristine_path,
-                                                  new_wcroot_abspath,
-                                                  sha1_checksum,
-                                                  iterpool, iterpool));
-
-      /* Ensure any sharding directories exist. */
-      SVN_ERR(svn_wc__ensure_directory(svn_dirent_dirname(pristine_path,
-                                                          iterpool),
-                                       iterpool));
-
-      /* Copy, rather than move, so that the upgrade can be restarted.
-         It could be moved if upgrades scanned for files in the
-         pristine directory as well as the text-base directory. */
-      SVN_ERR(svn_io_copy_file(text_base_path, pristine_path, TRUE,
-                               iterpool));
+      /* Calculate its checksums and copy it to the pristine store */
+      {
+        const char *pristine_path;
+        const char *text_base_path;
+        svn_sqlite__stmt_t *stmt;
+        apr_finfo_t finfo;
 
-      if (dir_relpath)
-        {
-          apr_size_t len = strlen(text_base_basename);
-          if (len >= sizeof(SVN_WC__REVERT_EXT)
-              && strcmp(text_base_basename
-                        + len - sizeof(SVN_WC__REVERT_EXT) - 1,
-                        SVN_WC__REVERT_EXT))
-            {
-              /* Assumming this revert-base is not an orphan, the
-                 upgrade process will have inserted a NODES row with a
-                 null checksum below the top-level working node.
-                 Update that checksum now. */
-              apr_int64_t op_depth = -1, wc_id = 1;
-              const char *name
-                = apr_pstrndup(iterpool, text_base_basename,
-                               len - sizeof(SVN_WC__REVERT_EXT) + 1);
-              const char *local_relpath = svn_relpath_join(dir_relpath, name,
-                                                           iterpool);
-              svn_boolean_t have_row;
-
-              SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                                STMT_SELECT_NODE_INFO));
-              SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
-              SVN_ERR(svn_sqlite__step(&have_row, stmt));
-              if (have_row)
-                {
-                  SVN_ERR(svn_sqlite__step(&have_row, stmt));
-                  if (have_row && svn_sqlite__column_is_null(stmt, 6)
-                      && !strcmp(svn_sqlite__column_text(stmt, 4, NULL),
-                                 "file"))
-                    op_depth = svn_sqlite__column_int64(stmt, 0);
-                }
-              SVN_ERR(svn_sqlite__reset(stmt));
-              if (op_depth != -1)
-                {
-                  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                                    STMT_UPDATE_CHECKSUM));
-                  SVN_ERR(svn_sqlite__bindf(stmt, "isi", wc_id, local_relpath,
-                                            op_depth));
-                  SVN_ERR(svn_sqlite__bind_checksum(stmt, 4, sha1_checksum,
-                                                    iterpool));
-                  SVN_ERR(svn_sqlite__update(NULL, stmt));
-                }
-            }
-        }
+        text_base_path = svn_dirent_join(text_base_dir, text_base_basename,
+                                         iterpool);
+
+        /* ### This code could be a bit smarter: we could chain checksum
+               streams instead of reading the file twice; we could check to
+               see if a pristine row exists before attempting to insert one;
+               we could check and see if a pristine file exists before
+               attempting to copy a new one over it.
+
+               However, I think simplicity is the big win here, especially 
since
+               this is code that runs exactly once on a user's machine: when
+               doing the upgrade.  If you disagree, feel free to add the
+               complexity. :)  */
+
+        /* Gather the two checksums. */
+        SVN_ERR(svn_io_file_checksum2(&md5_checksum, text_base_path,
+                                      svn_checksum_md5, iterpool));
+        SVN_ERR(svn_io_file_checksum2(&sha1_checksum, text_base_path,
+                                      svn_checksum_sha1, iterpool));
+
+        SVN_ERR(svn_io_stat(&finfo, text_base_path, APR_FINFO_SIZE, iterpool));
+
+        /* Insert a row into the pristine table. */
+        SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_PRISTINE));
+        SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, iterpool));
+        SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, iterpool));
+        SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
+        SVN_ERR(svn_sqlite__insert(NULL, stmt));
+
+        SVN_ERR(svn_wc__db_pristine_get_future_path(&pristine_path,
+                                                    new_wcroot_abspath,
+                                                    sha1_checksum,
+                                                    iterpool, iterpool));
+
+        /* Ensure any sharding directories exist. */
+        SVN_ERR(svn_wc__ensure_directory(svn_dirent_dirname(pristine_path,
+                                                            iterpool),
+                                         iterpool));
+
+        /* Copy, rather than move, so that the upgrade can be restarted.
+           It could be moved if upgrades scanned for files in the
+           pristine directory as well as the text-base directory. */
+        SVN_ERR(svn_io_copy_file(text_base_path, pristine_path, TRUE,
+                                 iterpool));
+      }
+
+      /* Add the checksums for this text-base to *TEXT_BASES_INFO. */
+      {
+        const char *versioned_file_name;
+        svn_boolean_t is_revert_base;
+        svn_wc__text_base_info_t *info;
+        svn_wc__text_base_file_info_t *file_info;
+
+        /* Determine the versioned file name and whether this is a normal base
+         * or a revert base. */
+        versioned_file_name = remove_suffix(text_base_basename,
+                                            SVN_WC__REVERT_EXT, result_pool);
+        if (versioned_file_name)
+          {
+            is_revert_base = TRUE;
+          }
+        else
+          {
+            versioned_file_name = remove_suffix(text_base_basename,
+                                                SVN_WC__BASE_EXT, result_pool);
+            is_revert_base = FALSE;
+          }
+
+        /* Create a new info struct for this versioned file, or fill in the
+         * existing one if this is the second text-base we've found for it. */
+        info = apr_hash_get(*text_bases_info, versioned_file_name,
+                            APR_HASH_KEY_STRING);
+        if (info == NULL)
+          info = apr_pcalloc(result_pool, sizeof (*info));
+        file_info = (is_revert_base ? &info->revert_base : &info->normal_base);
+
+        file_info->sha1_checksum = svn_checksum_dup(sha1_checksum, 
result_pool);
+        file_info->md5_checksum = svn_checksum_dup(md5_checksum, result_pool);
+        apr_hash_set(*text_bases_info, versioned_file_name, 
APR_HASH_KEY_STRING,
+                     info);
+      }
     }
 
   svn_pool_destroy(iterpool);
@@ -1154,19 +1085,6 @@ migrate_text_bases(const char *dir_abspa
   return SVN_NO_ERROR;
 }
 
-
-static svn_error_t *
-bump_to_17(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
-{
-  const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
-
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_17));
-  SVN_ERR(migrate_text_bases(wcroot_abspath, wcroot_abspath, NULL, sdb,
-                             scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
 static svn_error_t *
 bump_to_20(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
 {
@@ -1190,7 +1108,6 @@ bump_to_22(void *baton, svn_sqlite__db_t
   return SVN_NO_ERROR;
 }
 
-#if SVN_WC__VERSION >= 23
 static svn_error_t *
 bump_to_23(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
 {
@@ -1211,7 +1128,6 @@ bump_to_23(void *baton, svn_sqlite__db_t
   SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_23));
   return SVN_NO_ERROR;
 }
-#endif
 
 
 struct upgrade_data_t {
@@ -1253,6 +1169,7 @@ upgrade_to_wcng(void **dir_baton,
   apr_hash_t *entries;
   svn_wc_entry_t *this_dir;
   const char *old_wcroot_abspath, *dir_relpath;
+  apr_hash_t *text_bases_info;
 
   /* Don't try to mess with the WC if there are old log files left. */
 
@@ -1274,18 +1191,21 @@ upgrade_to_wcng(void **dir_baton,
    * The semantics and storage mechanisms between the two are vastly different,
    * so it's going to be a bit painful.  Here's a plan for the operation:
    *
-   * 1) The 'entries' file needs to be moved to the new format. We read it
-   *    using the old-format reader, and then use our compatibility code
-   *    for writing entries to fill out the (new) wc_db state.
+   * 1) Read the old 'entries' using the old-format reader.
+   *
+   * 2) Create the new DB if it hasn't already been created.
    *
-   * 2) Convert wcprop to the wc-ng format
+   * 3) Use our compatibility code for writing entries to fill out the (new)
+   *    DB state.  Use the remembered checksums, since an entry has only the
+   *    MD5 not the SHA1 checksum, and in the case of a revert-base doesn't
+   *    even have that.
    *
-   * 3) Trash old, unused files and subdirs
+   * 4) Convert wcprop to the wc-ng format
    *
-   * ### (fill in other bits as they are implemented)
+   * 5) Migrate regular properties to the WC-NG DB.
    */
 
-  /***** ENTRIES *****/
+  /***** ENTRIES - READ *****/
   SVN_ERR(svn_wc__read_entries_old(&entries, dir_abspath,
                                    scratch_pool, scratch_pool));
 
@@ -1306,6 +1226,7 @@ upgrade_to_wcng(void **dir_baton,
                    apr_pstrdup(hash_pool, this_dir->uuid));
     }
 
+  /* Create the new DB if it hasn't already been created. */
   if (!data->sdb)
     {
       const char *root_adm_abspath;
@@ -1339,20 +1260,25 @@ upgrade_to_wcng(void **dir_baton,
       SVN_ERR(svn_wc__db_wclock_obtain(db, data->root_abspath, 0, FALSE,
                                        scratch_pool));
     }
- 
+
+  old_wcroot_abspath = svn_dirent_get_longest_ancestor(dir_abspath,
+                                                       data->root_abspath,
+                                                       scratch_pool);
+  dir_relpath = svn_dirent_skip_ancestor(old_wcroot_abspath, dir_abspath);
+
+  /***** TEXT BASES *****/
+  SVN_ERR(migrate_text_bases(&text_bases_info, dir_abspath, data->root_abspath,
+                             data->sdb, scratch_pool, scratch_pool));
+
+  /***** ENTRIES - WRITE *****/
   SVN_ERR(svn_wc__write_upgraded_entries(dir_baton, parent_baton, db, 
data->sdb,
                                          data->repos_id, data->wc_id,
                                          dir_abspath, data->root_abspath,
-                                         entries,
+                                         entries, text_bases_info,
                                          result_pool, scratch_pool));
 
   /***** WC PROPS *****/
-
-  /* Ugh. We don't know precisely where the wcprops are. Ignore them.  */
-  old_wcroot_abspath = svn_dirent_get_longest_ancestor(dir_abspath,
-                                                       data->root_abspath,
-                                                       scratch_pool);
-  dir_relpath = svn_dirent_skip_ancestor(old_wcroot_abspath, dir_abspath);
+  /* If we don't know precisely where the wcprops are, ignore them.  */
   if (old_format != SVN_WC__WCPROPS_LOST)
     {
       apr_hash_t *all_wcprops;
@@ -1368,9 +1294,6 @@ upgrade_to_wcng(void **dir_baton,
                                                  all_wcprops, scratch_pool));
     }
 
-  SVN_ERR(migrate_text_bases(dir_abspath, data->root_abspath, dir_relpath,
-                             data->sdb, scratch_pool));
-
   /* Upgrade all the properties (including "this dir").
 
      Note: this must come AFTER the entries have been migrated into the
@@ -1386,6 +1309,25 @@ upgrade_to_wcng(void **dir_baton,
 }
 
 
+/* Return a string indicating the released version (or versions) of
+ * Subversion that used WC format number WC_FORMAT, or some other
+ * suitable string if no released version used WC_FORMAT.
+ *
+ * ### It's not ideal to encode this sort of knowledge in this low-level
+ * library.  On the other hand, it doesn't need to be updated often and
+ * should be easily found when it does need to be updated.  */
+static const char *
+version_string_from_format(int wc_format)
+{
+  switch (wc_format)
+    {
+      case 4: return "<=1.3";
+      case 8: return "1.4";
+      case 9: return "1.5";
+      case 10: return "1.6";
+    }
+  return _("(unreleased development version)");
+}
 
 svn_error_t *
 svn_wc__upgrade_sdb(int *result_format,
@@ -1398,8 +1340,21 @@ svn_wc__upgrade_sdb(int *result_format,
 
   if (start_format < SVN_WC__WC_NG_VERSION /* 12 */)
     return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
-                             _("Working copy format of '%s' is too old (%d); "
-                               "please run 'svn upgrade'"),
+                             _("Working copy '%s' is too old (format %d, "
+                               "created by Subversion %s)"),
+                             svn_dirent_local_style(wcroot_abspath,
+                                                    scratch_pool),
+                             start_format,
+                             version_string_from_format(start_format));
+
+  /* Early WCNG formats no longer supported. */
+  if (start_format < 19)
+    return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
+                             _("Working copy '%s' is an old development "
+                               "version (format %d); to upgrade it, "
+                               "use a format 18 client, then "
+                               "use 'tools/dev/wc-ng/bump-to-19.py', then "
+                               "use the current client"),
                              svn_dirent_local_style(wcroot_abspath,
                                                     scratch_pool),
                              start_format);
@@ -1411,86 +1366,6 @@ svn_wc__upgrade_sdb(int *result_format,
      intentional. */
   switch (start_format)
     {
-      case 12:
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_13, &bb,
-                                             scratch_pool));
-        /* If the transaction succeeded, then we don't need the wcprops
-           files. We stopped writing them partway through format 12, but
-           we may be upgrading from an "early 12" and need to toss those
-           files. We aren't going to migrate them because it is *also*
-           possible that current/real data is sitting within the database.
-           This is why STMT_UPGRADE_TO_13 just clears the 'dav_cache'
-           column -- we cannot definitely state that the column values
-           are Proper.
-
-           They're removed by wipe_obsolete_files(), below.  */
-
-        *result_format = 13;
-        /* FALLTHROUGH  */
-
-      case 13:
-        /* Build WCLOCKS and migrate any physical lock.  */
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_14, &bb,
-                                             scratch_pool));
-        /* If the transaction succeeded, then any lock has been migrated,
-           and we can toss the physical file (below).  */
-
-        *result_format = 14;
-        /* FALLTHROUGH  */
-
-      case 14:
-        /* Revamp the recording of 'excluded' nodes.  */
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_15, &bb,
-                                             scratch_pool));
-        *result_format = 15;
-        /* FALLTHROUGH  */
-
-      case 15:
-        /* Perform some minor changes to the schema.  */
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_16, &bb,
-                                             scratch_pool));
-        *result_format = 16;
-        /* FALLTHROUGH  */
-
-      case 16:
-        {
-          const char *pristine_dir;
-
-          /* Create the '.svn/pristine' directory.  */
-          pristine_dir = svn_wc__adm_child(wcroot_abspath,
-                                           SVN_WC__ADM_PRISTINE,
-                                           scratch_pool);
-          SVN_ERR(svn_wc__ensure_directory(pristine_dir, scratch_pool));
-
-          /* Move text bases into the pristine directory, and update the db */
-          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_17, &bb,
-                                               scratch_pool));
-        }
-
-        *result_format = 17;
-        /* FALLTHROUGH  */
-
-      case 17:
-        {
-          struct bump_to_18_baton b18;
-
-          b18.wcroot_abspath = wcroot_abspath;
-          b18.original_format = start_format;
-
-          /* Move the properties into the database.  */
-          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_18, &b18,
-                                               scratch_pool));
-        }
-
-        *result_format = 18;
-        /* FALLTHROUGH  */
-
-      case 18:
-        return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-                                 _("The working copy '%s' is at format 18; "
-                                   "use 'tools/dev/wc-ng/bump-to-19.py' to "
-                                   "upgrade it"), wcroot_abspath);
-
       case 19:
         SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_20, &bb,
                                              scratch_pool));
@@ -1509,13 +1384,11 @@ svn_wc__upgrade_sdb(int *result_format,
         *result_format = 22;
         /* FALLTHROUGH  */
 
-#if SVN_WC__VERSION >= 23
       case 22:
         SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_23, &bb,
                                              scratch_pool));
         *result_format = 23;
         /* FALLTHROUGH  */
-#endif
 
       /* ### future bumps go here.  */
 #if 0

Modified: 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql
 (original)
+++ 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql
 Wed Dec 29 00:10:25 2010
@@ -167,9 +167,9 @@ CREATE TABLE ACTUAL_NODE (
            conflicts? Why do we need these in a column to refer to the
            pristine store? Can't we just parse the checksums from
            conflict_data as well? */
-  older_checksum  TEXT,
-  left_checksum  TEXT,
-  right_checksum  TEXT,
+  older_checksum  TEXT REFERENCES PRISTINE (checksum),
+  left_checksum  TEXT REFERENCES PRISTINE (checksum),
+  right_checksum  TEXT REFERENCES PRISTINE (checksum),
 
   PRIMARY KEY (wc_id, local_relpath)
   );
@@ -327,8 +327,6 @@ CREATE TABLE NODES (
 
   /* The tree state of the node.
 
-     ### This applies to SVN_WC__OP_DEPTH, the intended final code!
-
      In case 'op_depth' is equal to 0, this node is part of the 'BASE'
      tree.  The 'BASE' represents pristine nodes that are in the
      repository; it is obtained and modified by commands such as
@@ -417,7 +415,7 @@ CREATE TABLE NODES (
 
   /* The SHA-1 checksum of the pristine text, if this node is a file and was
      moved here or copied here, else NULL. */
-  checksum  TEXT,
+  checksum  TEXT REFERENCES PRISTINE (checksum),
 
   /* for kind==symlink, this specifies the target. */
   symlink_target  TEXT,
@@ -483,126 +481,6 @@ CREATE INDEX I_NODES_PARENT ON NODES (wc
 
 
 
-/* ------------------------------------------------------------------------- */
-
-/* Format 13 introduces the work queue, and erases a few columns from the
-   original schema.  */
--- STMT_UPGRADE_TO_13
-
-CREATE TABLE WORK_QUEUE (
-  /* Work items are identified by this value.  */
-  id  INTEGER PRIMARY KEY AUTOINCREMENT,
-
-  /* A serialized skel specifying the work item.  */
-  work  BLOB NOT NULL
-  );
-
-/* The contents of dav_cache are suspect in format 12, so it is best to just
-   erase anything there.  */
-UPDATE BASE_NODE SET incomplete_children=null, dav_cache=null;
-
-PRAGMA user_version = 13;
-
-
-/* ------------------------------------------------------------------------- */
-
-/* Format 14 introduces a table for storing wc locks, and additional columns
-   for storing conflict data in ACTUAL. */
--- STMT_UPGRADE_TO_14
-
-/* The existence of a row in this table implies a write lock. */
-CREATE TABLE WC_LOCK (
-  /* specifies the location of this node in the local filesystem */
-  wc_id  INTEGER NOT NULL  REFERENCES WCROOT (id),
-  local_dir_relpath  TEXT NOT NULL,
- 
-  PRIMARY KEY (wc_id, local_dir_relpath)
- );
-
-/* A skel containing the conflict details. */
-ALTER TABLE ACTUAL_NODE
-ADD COLUMN conflict_data  BLOB;
-
-/* Three columns containing the checksums of older, left and right conflict
-   texts.  Stored in a column to allow storing them in the pristine store */
-ALTER TABLE ACTUAL_NODE
-ADD COLUMN older_checksum  TEXT;
-
-ALTER TABLE ACTUAL_NODE
-ADD COLUMN left_checksum  TEXT;
-
-ALTER TABLE ACTUAL_NODE
-ADD COLUMN right_checksum  TEXT;
-
-PRAGMA user_version = 14;
-
-
-/* ------------------------------------------------------------------------- */
-
-/* Format 15 introduces new handling for excluded nodes.  */
--- STMT_UPGRADE_TO_15
-
-UPDATE base_node
-SET
-  presence = 'excluded',
-  checksum = NULL, translated_size = NULL, changed_rev = NULL,
-  changed_date = NULL, changed_author = NULL, depth = NULL,
-  symlink_target = NULL, last_mod_time = NULL, properties = NULL,
-  incomplete_children = NULL, file_external = NULL
-WHERE depth = 'exclude';
-
-/* We don't support cropping working nodes, but we might see them
-   via a copy from a sparse tree. Convert them anyway to make sure
-   we never see depth exclude in our database */
-UPDATE working_node
-SET
-  presence = 'excluded',
-  checksum = NULL, translated_size = NULL, changed_rev = NULL,
-  changed_date = NULL, changed_author = NULL, depth = NULL,
-  symlink_target = NULL, copyfrom_repos_id = NULL, copyfrom_repos_path = NULL,
-  copyfrom_revnum = NULL, moved_here = NULL, moved_to = NULL,
-  last_mod_time = NULL, properties = NULL, keep_local = NULL
-WHERE depth = 'exclude';
-
-PRAGMA user_version = 15;
-
-
-/* ------------------------------------------------------------------------- */
-
-/* Format 16 introduces some new columns for pristines and locks.  */
--- STMT_UPGRADE_TO_16
-
-/* An md5 column for the pristine table. */
-ALTER TABLE PRISTINE
-ADD COLUMN md5_checksum  TEXT;
-
-/* Add the locked_levels column to record the depth of a lock. */
-ALTER TABLE WC_LOCK
-ADD COLUMN locked_levels  INTEGER NOT NULL DEFAULT -1;
-
-/* Default the depth of existing locks to 0. */
-UPDATE wc_lock
-SET locked_levels = 0;
-
-PRAGMA user_version = 16;
-
-/* ------------------------------------------------------------------------- */
-
-/* Format 17 involves no schema changes, it moves the pristine files
-   from .svn/text-base to .svn/pristine */
-
--- STMT_UPGRADE_TO_17
-PRAGMA user_version = 17;
-
-/* ------------------------------------------------------------------------- */
-
-/* Format 18 involves no schema changes, it moves the property data from files
-   into the database. */
-
--- STMT_UPGRADE_TO_18
-PRAGMA user_version = 18;
-
-
 /* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */
 
 -- STMT_UPGRADE_TO_20
@@ -732,8 +610,15 @@ FROM ACTUAL_NODE_BACKUP;
 
 DROP TABLE ACTUAL_NODE_BACKUP;
 
-/* Note: One difference remains between the schemas of an upgraded and a
- * fresh WC.  While format 22 was current, "NOT NULL" was added to the
+/* Note: Other differences between the schemas of an upgraded and a
+ * fresh WC.
+ *
+ * While format 22 was current, "NOT NULL" was added to the
  * columns PRISTINE.size and PRISTINE.md5_checksum.  The format was not
- * bumped because it is a forward- and backward-compatible change. */
+ * bumped because it is a forward- and backward-compatible change.
+ *
+ * While format 23 was current, "REFERENCES PRISTINE" was added to the
+ * columns ACTUAL_NODE.older_checksum, ACTUAL_NODE.left_checksum,
+ * ACTUAL_NODE.right_checksum, NODES.checksum.
+ */
 

Modified: 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-queries.sql?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-queries.sql
 (original)
+++ 
subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-queries.sql
 Wed Dec 29 00:10:25 2010
@@ -104,6 +104,15 @@ LEFT OUTER JOIN lock ON nodes.repos_id =
   AND nodes.repos_path = lock.repos_relpath
 WHERE wc_id = ?1 AND parent_relpath = ?2;
 
+-- STMT_SELECT_NODE_CHILDREN_WALKER_INFO
+/* ### See comment at STMT_SELECT_NODE_CHILDREN_INFO.
+   ### Should C code handle GROUP BY local_relpath ORDER BY op_depths DESC? */
+SELECT local_relpath, op_depth, presence, kind
+FROM nodes
+WHERE wc_id = ?1 AND parent_relpath = ?2
+GROUP BY local_relpath
+ORDER BY op_depth DESC;
+
 -- STMT_SELECT_ACTUAL_CHILDREN_INFO
 SELECT prop_reject, changelist, conflict_old, conflict_new,
 conflict_working, tree_conflict_data, properties, local_relpath,
@@ -224,15 +233,11 @@ WHERE repos_id = ?1 AND
   (repos_relpath = ?2 OR
    repos_relpath LIKE ?3 ESCAPE '#');
 
--- STMT_UPDATE_BASE_NODE_FILEINFO
-UPDATE nodes SET translated_size = ?3, last_mod_time = ?4
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
-
--- STMT_UPDATE_WORKING_NODE_FILEINFO
+-- STMT_UPDATE_NODE_FILEINFO
 UPDATE nodes SET translated_size = ?3, last_mod_time = ?4
 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);
+                  WHERE wc_id = ?1 AND local_relpath = ?2);
 
 -- STMT_UPDATE_ACTUAL_TREE_CONFLICTS
 UPDATE actual_node SET tree_conflict_data = ?3
@@ -716,14 +721,15 @@ UPDATE actual_node SET tree_conflict_dat
 SELECT DISTINCT local_relpath FROM nodes
 WHERE kind = 'file' AND parent_relpath = ?1;
 
--- STMT_PLAN_PROP_UPGRADE
-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);
+-- STMT_SELECT_NODE_UPGRADE
+SELECT op_depth, presence, wc_id
+FROM nodes
+WHERE local_relpath = ?1
+ORDER BY op_depth DESC;
+
+-- STMT_UPDATE_NODE_PROPS
+UPDATE nodes SET properties = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3;
 
 -- STMT_HAS_WORKING_NODES
 SELECT 1 FROM nodes WHERE op_depth > 0;

Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc.h?rev=1053489&r1=1053488&r2=1053489&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc.h 
(original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc.h Wed 
Dec 29 00:10:25 2010
@@ -140,9 +140,6 @@ extern "C" {
 
 #define SVN_WC__VERSION 23
 
-#if SVN_WC__VERSION >= 23
-#define SVN_WC__OP_DEPTH
-#endif
 
 /* Formats <= this have no concept of "revert text-base/props".  */
 #define SVN_WC__NO_REVERT_FILES 4


Reply via email to