You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/08/11 00:07:31 UTC

svn commit: r984234 [14/20] - in /subversion/branches/ignore-mergeinfo: ./ build/ build/ac-macros/ build/generator/ notes/ notes/api-errata/ notes/obliterate/ notes/obliterate/fspec-cc1/ notes/rename-tracking/ notes/svnpatch/ notes/tree-conflicts/ note...

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/upgrade.c?rev=984234&r1=984233&r2=984234&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/upgrade.c Tue Aug 10 22:07:24 2010
@@ -73,11 +73,10 @@
 
 /* Forward declare until we decide to shift/reorder functions.  */
 static svn_error_t *
-migrate_node_props(const char *wcroot_abspath,
-                   const char *name,
-                   svn_sqlite__db_t *sdb,
-                   int original_format,
-                   apr_pool_t *scratch_pool);
+migrate_props(const char *wcroot_abspath,
+              svn_sqlite__db_t *sdb,
+              int original_format,
+              apr_pool_t *scratch_pool);
 
 
 /* Read the properties from the file at PROPFILE_ABSPATH, returning them
@@ -339,6 +338,52 @@ get_versioned_subdirs(apr_array_header_t
 }
 
 
+/* Return in CHILDREN, the list of all versioned *files* in SDB.
+   These files' existence on disk is not tested.
+
+   This set of children is intended for props/text-base upgrades.
+   Subdirectory's properties exist in the subdirs. Non-files have no
+   text bases.
+
+   Note that this uses just the SDB to locate children, which means
+   that the children must have been upgraded to wc-ng format. Also note
+   that this returns *all* files found in SDB. Typically, this is just
+   one directory's worth since it won't be run on a single-db.  */
+static svn_error_t *
+get_versioned_files(const apr_array_header_t **children,
+                    svn_sqlite__db_t *sdb,
+                    apr_pool_t *result_pool,
+                    apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  apr_array_header_t *child_relpaths;
+  svn_boolean_t have_row;
+
+  /* ### just select 'file' children. do we need 'symlink' in the future?  */
+  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ALL_FILES));
+
+  /* ### 10 is based on Subversion's average of 8.5 files per versioned
+     ### directory in its repository. maybe use a different value? or
+     ### count rows first?  */
+  child_relpaths = apr_array_make(result_pool, 10, sizeof(const char *));
+
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  while (have_row)
+    {
+      const char *local_relpath = svn_sqlite__column_text(stmt, 0,
+                                                          result_pool);
+
+      APR_ARRAY_PUSH(child_relpaths, const char *) = local_relpath;
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    }
+
+  *children = child_relpaths;
+
+  return svn_error_return(svn_sqlite__reset(stmt));
+}
+
+
 /* */
 static const char *
 build_lockfile_path(const char *local_dir_abspath,
@@ -422,6 +467,15 @@ wipe_obsolete_files(const char *wcroot_a
                                       scratch_pool),
                     TRUE, scratch_pool));
 
+#if (SVN_WC__VERSION >= 17)
+  /* Remove the old text-base directory and the old text-base files. */
+  svn_error_clear(svn_io_remove_dir2(
+                    svn_wc__adm_child(wcroot_abspath,
+                                      TEXT_BASE_SUBDIR,
+                                      scratch_pool),
+                    FALSE, NULL, NULL, scratch_pool));
+#endif
+
 #if 0  /* ### NOT READY TO WIPE THESE FILES!!  */
   /* Remove the old properties files... whole directories at a time.  */
   svn_error_clear(svn_io_remove_dir2(
@@ -436,13 +490,10 @@ wipe_obsolete_files(const char *wcroot_a
                     FALSE, NULL, NULL, scratch_pool));
 #endif
 
-#if 0  /* Conditional upon upgrading to format 18 */
-  /* Remove the old text-base directory. */
-  svn_error_clear(svn_io_remove_dir2(
-                    svn_wc__adm_child(wcroot_abspath,
-                                      TEXT_BASE_SUBDIR,
-                                      scratch_pool),
-                    FALSE, NULL, NULL, scratch_pool));
+#if 0
+  /* ### this checks for a write-lock, and we are not (always) taking out
+     ### a write lock in all callers.  */
+  SVN_ERR(svn_wc__adm_cleanup_tmp_area(db, wcroot_abspath, iterpool));
 #endif
 
   /* Remove the old-style lock file LAST.  */
@@ -457,7 +508,8 @@ wipe_obsolete_files(const char *wcroot_a
    used within the upgraded entries as they are written into the database.
 
    If one or both are not available, then it attempts to retrieve this
-   information from REPOS_INFO_FUNC, passing REPOS_INFO_BATON.
+   information from REPOS_CACHE. And if that fails from REPOS_INFO_FUNC,
+   passing REPOS_INFO_BATON.
    Returns a user understandable error using LOCAL_ABSPATH if the
    information cannot be obtained.  */
 static svn_error_t *
@@ -465,6 +517,7 @@ ensure_repos_info(svn_wc_entry_t *entry,
                   const char *local_abspath,
                   svn_wc_upgrade_get_repos_info_t repos_info_func,
                   void *repos_info_baton,
+                  apr_hash_t *repos_cache,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
 {
@@ -472,6 +525,28 @@ ensure_repos_info(svn_wc_entry_t *entry,
   if (entry->repos != NULL && entry->uuid != NULL)
     return SVN_NO_ERROR;
 
+  if ((entry->repos == NULL || entry->uuid == NULL)
+      && entry->url)
+    {
+      apr_hash_index_t *hi;
+
+      for (hi = apr_hash_first(scratch_pool, repos_cache);
+           hi; hi = apr_hash_next(hi))
+        {
+          if (svn_uri_is_child(svn__apr_hash_index_key(hi),
+                               entry->url, NULL))
+            {
+              if (!entry->repos)
+                entry->repos = svn__apr_hash_index_key(hi);
+
+              if (!entry->uuid)
+                entry->uuid = svn__apr_hash_index_val(hi);
+
+              return SVN_NO_ERROR;
+            }
+        }
+    }
+
   if (entry->repos == NULL && repos_info_func == NULL)
     return svn_error_createf(
         SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
@@ -499,142 +574,6 @@ ensure_repos_info(svn_wc_entry_t *entry,
 }
 
 
-/* Upgrade the working copy directory represented by DB/DIR_ABSPATH
-   from OLD_FORMAT to the wc-ng format (SVN_WC__WC_NG_VERSION)'.
-
-   Uses SCRATCH_POOL for all temporary allocation.  */
-static svn_error_t *
-upgrade_to_wcng(svn_wc__db_t *db,
-                const char *dir_abspath,
-                int old_format,
-                svn_wc_upgrade_get_repos_info_t repos_info_func,
-                void *repos_info_baton,
-                apr_pool_t *scratch_pool)
-{
-  const char *logfile_path = svn_wc__adm_child(dir_abspath, ADM_LOG,
-                                               scratch_pool);
-  svn_node_kind_t logfile_on_disk;
-  apr_hash_t *entries;
-  svn_wc_entry_t *this_dir;
-  svn_sqlite__db_t *sdb;
-  apr_int64_t repos_id;
-  apr_int64_t wc_id;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-  apr_hash_index_t *hi;
-
-  /* Don't try to mess with the WC if there are old log files left. */
-
-  /* Is the (first) log file present?  */
-  SVN_ERR(svn_io_check_path(logfile_path, &logfile_on_disk, iterpool));
-  if (logfile_on_disk == svn_node_file)
-    return svn_error_create(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
-                            _("Cannot upgrade with existing logs; please "
-                              "run 'svn cleanup' with Subversion 1.6"));
-
-  /* Lock this working copy directory, or steal an existing lock. Do this
-     BEFORE we read the entries. We don't want another process to modify the
-     entries after we've read them into memory.  */
-  SVN_ERR(create_physical_lock(dir_abspath, iterpool));
-
-  /* What's going on here?
-   *
-   * We're attempting to upgrade an older working copy to the new wc-ng format.
-   * 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.
-   *
-   * 2) Convert wcprop to the wc-ng format
-   *
-   * 3) Trash old, unused files and subdirs
-   *
-   * ### (fill in other bits as they are implemented)
-   */
-
-  /***** ENTRIES *****/
-  SVN_ERR(svn_wc__read_entries_old(&entries, dir_abspath,
-                                   scratch_pool, iterpool));
-
-  this_dir = apr_hash_get(entries, SVN_WC_ENTRY_THIS_DIR, APR_HASH_KEY_STRING);
-  SVN_ERR(ensure_repos_info(this_dir, dir_abspath,
-                            repos_info_func, repos_info_baton,
-                            scratch_pool, iterpool));
-
-  /* Create an empty sqlite database for this directory. */
-  SVN_ERR(svn_wc__db_upgrade_begin(&sdb, &repos_id, &wc_id, dir_abspath,
-                                   this_dir->repos, this_dir->uuid,
-                                   scratch_pool, iterpool));
-
-  /* Migrate the entries over to the new database.
-     ### We need to think about atomicity here.
-
-     entries_write_new() writes in current format rather than f12. Thus, this
-     function bumps a working copy all the way to current.  */
-  SVN_ERR(svn_wc__db_temp_reset_format(SVN_WC__VERSION, db, dir_abspath,
-                                       iterpool));
-  SVN_ERR(svn_wc__db_wclock_set(db, dir_abspath, 0, iterpool));
-  SVN_ERR(svn_wc__write_upgraded_entries(db, sdb, repos_id, wc_id,
-                                         dir_abspath, entries,
-                                         iterpool));
-
-  /***** WC PROPS *****/
-
-  /* Ugh. We don't know precisely where the wcprops are. Ignore them.  */
-  if (old_format != SVN_WC__WCPROPS_LOST)
-    {
-      apr_hash_t *all_wcprops;
-
-      if (old_format <= SVN_WC__WCPROPS_MANY_FILES_VERSION)
-        SVN_ERR(read_many_wcprops(&all_wcprops, dir_abspath,
-                                  iterpool, iterpool));
-      else
-        SVN_ERR(read_wcprops(&all_wcprops, dir_abspath,
-                             iterpool, iterpool));
-
-      SVN_ERR(svn_wc__db_upgrade_apply_dav_cache(sdb, all_wcprops, iterpool));
-    }
-
-  /* Upgrade all the properties (including "this dir").
-
-     Note: this must come AFTER the entries have been migrated into the
-     database. The upgrade process needs to examine the WORKING state.  */
-  for (hi = apr_hash_first(scratch_pool, entries);
-       hi != NULL;
-       hi = apr_hash_next(hi))
-    {
-      const char *name = svn__apr_hash_index_key(hi);
-
-      svn_pool_clear(iterpool);
-
-#if 0
-      /* ### need to skip subdir stub entries.  */
-      /* ### not ready for this yet.  */
-      SVN_ERR(migrate_node_props(dir_abspath, name, sdb, old_format,
-                                 iterpool));
-#endif
-    }
-
-  SVN_ERR(svn_wc__db_upgrade_finish(dir_abspath, sdb, iterpool));
-
-  /* All subdir access batons (and locks!) will be closed. Of course, they
-     should have been closed/unlocked just after their own upgrade process
-     has run.  */
-  /* ### well, actually.... we don't recursively delete subdir locks here,
-     ### we rely upon their own upgrade processes to do it. */
-  SVN_ERR(svn_wc__db_wclock_remove(db, dir_abspath, iterpool));
-
-  /* Zap all the obsolete files. This removes the old-style lock file.  */
-  wipe_obsolete_files(dir_abspath, iterpool);
-
-  /* ### need to (eventually) delete the .svn subdir.  */
-
-  svn_pool_destroy(iterpool);
-  return SVN_NO_ERROR;
-}
-
-
 /* */
 static svn_error_t *
 bump_to_13(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
@@ -919,12 +858,15 @@ migrate_locks(const char *wcroot_abspath
   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 = baton;
+  const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
 
   SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_14));
 
@@ -1054,25 +996,14 @@ migrate_props(const char *wcroot_abspath
   */
   const apr_array_header_t *children;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-  svn_wc__db_t *db;
   int i;
 
-  /* ### the use of DB within this function must go away.  */
-
-  /* *sigh*  We actually want to use wc_db APIs to read data, but we aren't
-     provided a wc_db, so open one. */
-  SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_default, NULL, FALSE, TRUE,
-                          scratch_pool, scratch_pool));
-
   /* Migrate the props for "this dir".  */
   SVN_ERR(migrate_node_props(wcroot_abspath, "", sdb, original_format,
-                             scratch_pool));
-
-  /* Go find all the children of the wcroot. */
-  SVN_ERR(svn_wc__db_read_children(&children, db, wcroot_abspath,
-                                   scratch_pool, scratch_pool));
+                             iterpool));
 
-  /* Iterate over the children, as described above */
+  /* Iterate over all the files in this SDB.  */
+  SVN_ERR(get_versioned_files(&children, sdb, scratch_pool, iterpool));
   for (i = 0; i < children->nelts; i++)
     {
       const char *name = APR_ARRAY_IDX(children, i, const char *);
@@ -1083,12 +1014,6 @@ migrate_props(const char *wcroot_abspath
                                  iterpool));
     }
 
-#if 0
-  /* ### we are not (yet) taking out a write lock  */
-  SVN_ERR(svn_wc__adm_cleanup_tmp_area(db, wcroot_abspath, iterpool));
-#endif
-
-  SVN_ERR(svn_wc__db_close(db));
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
@@ -1096,7 +1021,7 @@ migrate_props(const char *wcroot_abspath
 
 
 /* */
-struct bump_to_17_baton
+struct bump_to_18_baton
 {
   const char *wcroot_abspath;
   int original_format;
@@ -1104,16 +1029,16 @@ struct bump_to_17_baton
 
 
 static svn_error_t *
-bump_to_17(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+bump_to_18(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
 {
-  struct bump_to_17_baton *b17 = baton;
+  struct bump_to_18_baton *b18 = baton;
 
 #if 0
   /* ### no schema changes (yet)... */
-  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_17));
+  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_18));
 #endif
 
-  SVN_ERR(migrate_props(b17->wcroot_abspath, sdb, b17->original_format,
+  SVN_ERR(migrate_props(b18->wcroot_abspath, sdb, b18->original_format,
                         scratch_pool));
 
   return SVN_NO_ERROR;
@@ -1174,16 +1099,19 @@ migrate_text_bases(const char *wcroot_ab
       SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
       SVN_ERR(svn_sqlite__insert(NULL, stmt));
 
-      /* Compute the path of the pristine.
-         Note: in format 18, pristines are not yet sharded, so don't include
-         that in the path computation. */
-      pristine_path = svn_dirent_join_many(iterpool,
-                                           wcroot_abspath,
-                                           svn_wc_get_adm_dir(iterpool),
-                                           PRISTINE_STORAGE_RELPATH,
-                                           NULL);
+      SVN_ERR(svn_wc__db_pristine_get_future_path(&pristine_path,
+                                                  wcroot_abspath,
+                                                  sha1_checksum,
+                                                  iterpool, iterpool));
+
+      /* Ensure any sharding directories exist. */
+      SVN_ERR(svn_wc__ensure_directory(svn_dirent_dirname(pristine_path,
+                                                          iterpool),
+                                       iterpool));
 
-      /* Finally, copy the file over. */
+      /* 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));
     }
@@ -1195,10 +1123,11 @@ migrate_text_bases(const char *wcroot_ab
 
 
 static svn_error_t *
-bump_to_18(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+bump_to_17(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
 {
-  const char *wcroot_abspath = baton;
+  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, sdb, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -1211,7 +1140,7 @@ bump_to_18(void *baton, svn_sqlite__db_t
 static svn_error_t *
 bump_to_XXX(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
 {
-  const char *wcroot_abspath = baton;
+  const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
 
   SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_XXX));
 
@@ -1222,6 +1151,154 @@ bump_to_XXX(void *baton, svn_sqlite__db_
 
 #endif /* ### no tree conflict migration yet */
 
+/* Upgrade the working copy directory represented by DB/DIR_ABSPATH
+   from OLD_FORMAT to the wc-ng format (SVN_WC__WC_NG_VERSION)'.
+
+   Pass REPOS_INFO_FUNC, REPOS_INFO_BATON and REPOS_CACHE to
+   ensure_repos_info. Add the found repository root and UUID to
+   REPOS_CACHE if it doesn't have a cached entry for this
+   repository.
+
+   Uses SCRATCH_POOL for all temporary allocation.  */
+static svn_error_t *
+upgrade_to_wcng(svn_wc__db_t *db,
+                const char *dir_abspath,
+                int old_format,
+                svn_wc_upgrade_get_repos_info_t repos_info_func,
+                void *repos_info_baton,
+                apr_hash_t *repos_cache,
+                apr_pool_t *scratch_pool)
+{
+  const char *logfile_path = svn_wc__adm_child(dir_abspath, ADM_LOG,
+                                               scratch_pool);
+  svn_node_kind_t logfile_on_disk;
+  apr_hash_t *entries;
+  svn_wc_entry_t *this_dir;
+  svn_sqlite__db_t *sdb;
+  apr_int64_t repos_id;
+  apr_int64_t wc_id;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+  /* Don't try to mess with the WC if there are old log files left. */
+
+  /* Is the (first) log file present?  */
+  SVN_ERR(svn_io_check_path(logfile_path, &logfile_on_disk, iterpool));
+  if (logfile_on_disk == svn_node_file)
+    return svn_error_create(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+                            _("Cannot upgrade with existing logs; please "
+                              "run 'svn cleanup' with Subversion 1.6"));
+
+  /* Lock this working copy directory, or steal an existing lock. Do this
+     BEFORE we read the entries. We don't want another process to modify the
+     entries after we've read them into memory.  */
+  SVN_ERR(create_physical_lock(dir_abspath, iterpool));
+
+  /* What's going on here?
+   *
+   * We're attempting to upgrade an older working copy to the new wc-ng format.
+   * 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.
+   *
+   * 2) Convert wcprop to the wc-ng format
+   *
+   * 3) Trash old, unused files and subdirs
+   *
+   * ### (fill in other bits as they are implemented)
+   */
+
+  /***** ENTRIES *****/
+  SVN_ERR(svn_wc__read_entries_old(&entries, dir_abspath,
+                                   scratch_pool, iterpool));
+
+  this_dir = apr_hash_get(entries, SVN_WC_ENTRY_THIS_DIR, APR_HASH_KEY_STRING);
+  SVN_ERR(ensure_repos_info(this_dir, dir_abspath,
+                            repos_info_func, repos_info_baton,
+                            repos_cache,
+                            scratch_pool, iterpool));
+
+  /* Cache repos UUID pairs for when a subdir doesn't have this information */
+  if (!apr_hash_get(repos_cache, this_dir->repos, APR_HASH_KEY_STRING))
+    {
+      apr_pool_t *hash_pool = apr_hash_pool_get(repos_cache);
+
+      apr_hash_set(repos_cache,
+                   apr_pstrdup(hash_pool, this_dir->repos),
+                   APR_HASH_KEY_STRING,
+                   apr_pstrdup(hash_pool, this_dir->uuid));
+    }
+
+  /* Create an empty sqlite database for this directory. */
+  SVN_ERR(svn_wc__db_upgrade_begin(&sdb, &repos_id, &wc_id, dir_abspath,
+                                   this_dir->repos, this_dir->uuid,
+                                   scratch_pool, iterpool));
+
+  /* Migrate the entries over to the new database.
+     ### We need to think about atomicity here.
+
+     entries_write_new() writes in current format rather than f12. Thus, this
+     function bumps a working copy all the way to current.  */
+  SVN_ERR(svn_wc__db_temp_reset_format(SVN_WC__VERSION, db, dir_abspath,
+                                       iterpool));
+  SVN_ERR(svn_wc__db_wclock_set(db, dir_abspath, 0, iterpool));
+  SVN_ERR(svn_wc__write_upgraded_entries(db, sdb, repos_id, wc_id,
+                                         dir_abspath, entries,
+                                         iterpool));
+
+  /***** WC PROPS *****/
+
+  /* Ugh. We don't know precisely where the wcprops are. Ignore them.  */
+  if (old_format != SVN_WC__WCPROPS_LOST)
+    {
+      apr_hash_t *all_wcprops;
+
+      if (old_format <= SVN_WC__WCPROPS_MANY_FILES_VERSION)
+        SVN_ERR(read_many_wcprops(&all_wcprops, dir_abspath,
+                                  iterpool, iterpool));
+      else
+        SVN_ERR(read_wcprops(&all_wcprops, dir_abspath,
+                             iterpool, iterpool));
+
+      SVN_ERR(svn_wc__db_upgrade_apply_dav_cache(sdb, all_wcprops, iterpool));
+    }
+
+  /* Upgrade all the properties (including "this dir").
+
+     Note: this must come AFTER the entries have been migrated into the
+     database. The upgrade process needs the children in BASE_NODE and
+     WORKING_NODE, and to examine the resultant WORKING state.  */
+#if 0
+  /* ### not quite yet  */
+  SVN_ERR(migrate_props(dir_abspath, sdb, old_format, iterpool));
+#endif
+
+#if (SVN_WC__VERSION >= 17)
+  SVN_ERR(migrate_text_bases(dir_abspath, sdb, iterpool));
+#endif
+
+  /* All done. DB should finalize the upgrade process now.  */
+  SVN_ERR(svn_wc__db_upgrade_finish(dir_abspath, sdb, iterpool));
+
+  /* All subdir access batons (and locks!) will be closed. Of course, they
+     should have been closed/unlocked just after their own upgrade process
+     has run.  */
+  /* ### well, actually.... we don't recursively delete subdir locks here,
+     ### we rely upon their own upgrade processes to do it. */
+  SVN_ERR(svn_wc__db_wclock_remove(db, dir_abspath, iterpool));
+
+  /* Zap all the obsolete files. This removes the old-style lock file.  */
+  wipe_obsolete_files(dir_abspath, iterpool);
+
+  /* ### need to (eventually) delete the .svn subdir.  */
+
+  svn_pool_destroy(iterpool);
+  return SVN_NO_ERROR;
+}
+
+
 
 svn_error_t *
 svn_wc__upgrade_sdb(int *result_format,
@@ -1230,6 +1307,8 @@ svn_wc__upgrade_sdb(int *result_format,
                     int start_format,
                     apr_pool_t *scratch_pool)
 {
+  struct bump_baton bb = { wcroot_abspath };
+
   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); "
@@ -1246,8 +1325,7 @@ svn_wc__upgrade_sdb(int *result_format,
   switch (start_format)
     {
       case 12:
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_13,
-                                             (void *)wcroot_abspath,
+        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
@@ -1265,8 +1343,7 @@ svn_wc__upgrade_sdb(int *result_format,
 
       case 13:
         /* Build WCLOCKS and migrate any physical lock.  */
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_14,
-                                             (void *)wcroot_abspath,
+        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).  */
@@ -1276,16 +1353,14 @@ svn_wc__upgrade_sdb(int *result_format,
 
       case 14:
         /* Revamp the recording of 'excluded' nodes.  */
-        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_15,
-                                             (void *)wcroot_abspath,
+        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,
-                                             (void *)wcroot_abspath,
+        SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_16, &bb,
                                              scratch_pool));
         *result_format = 16;
         /* FALLTHROUGH  */
@@ -1293,13 +1368,16 @@ svn_wc__upgrade_sdb(int *result_format,
 #if (SVN_WC__VERSION > 16)
       case 16:
         {
-          struct bump_to_17_baton b17;
+          const char *pristine_dir;
 
-          b17.wcroot_abspath = wcroot_abspath;
-          b17.original_format = start_format;
+          /* 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 the properties into the database.  */
-          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_17, &b17,
+          /* Move text bases into the pristine directory, and update the db */
+          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_17, &bb,
                                                scratch_pool));
         }
 
@@ -1307,19 +1385,16 @@ svn_wc__upgrade_sdb(int *result_format,
         /* FALLTHROUGH  */
 #endif
 
-#if 0
+#if (SVN_WC__VERSION > 17)
       case 17:
         {
-          const char *pristine_dir;
+          struct bump_to_18_baton b18;
 
-          /* Create the '.svn/pristine' directory.  */
-          pristine_dir = svn_wc__adm_child(wcroot_abspath,
-                                           SVN_WC__ADM_PRISTINE,
-                                           scratch_pool);
-          SVN_ERR(svn_io_dir_make(pristine_dir, APR_OS_DEFAULT, scratch_pool));
+          b18.wcroot_abspath = wcroot_abspath;
+          b18.original_format = start_format;
 
-          /* Move text bases into the pristine directory, and update the db */
-          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_18, wcroot_abspath,
+          /* Move the properties into the database.  */
+          SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_18, &b18,
                                                scratch_pool));
         }
 
@@ -1351,6 +1426,7 @@ upgrade_working_copy(svn_wc__db_t *db,
                      const char *dir_abspath,
                      svn_wc_upgrade_get_repos_info_t repos_info_func,
                      void *repos_info_baton,
+                     apr_hash_t *repos_cache,
                      svn_cancel_func_t cancel_func,
                      void *cancel_baton,
                      svn_wc_notify_func2_t notify_func,
@@ -1376,7 +1452,7 @@ upgrade_working_copy(svn_wc__db_t *db,
   if (old_format < SVN_WC__WC_NG_VERSION)
     SVN_ERR(upgrade_to_wcng(db, dir_abspath, old_format,
                             repos_info_func, repos_info_baton,
-                            iterpool));
+                            repos_cache, iterpool));
 
   if (notify_func)
     notify_func(notify_baton,
@@ -1393,6 +1469,7 @@ upgrade_working_copy(svn_wc__db_t *db,
 
       SVN_ERR(upgrade_working_copy(db, child_abspath,
                                    repos_info_func, repos_info_baton,
+                                   repos_cache,
                                    cancel_func, cancel_baton,
                                    notify_func, notify_baton,
                                    iterpool));
@@ -1439,6 +1516,7 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
   /* Upgrade this directory and/or its subdirectories.  */
   SVN_ERR(upgrade_working_copy(db, local_abspath,
                                repos_info_func, repos_info_baton,
+                               apr_hash_make(scratch_pool),
                                cancel_func, cancel_baton,
                                notify_func, notify_baton,
                                scratch_pool));

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/util.c?rev=984234&r1=984233&r2=984234&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/util.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/util.c Tue Aug 10 22:07:24 2010
@@ -85,7 +85,7 @@ svn_wc__ensure_directory(const char *pat
           if (shorter[0] == '\0')
             {
               /* A weird and probably rare situation. */
-              return svn_error_create(0, NULL,
+              return svn_error_create(APR_EGENERAL, NULL,
                                       _("Unable to make any directories"));
             }
           else  /* We have a valid path, so recursively ensure it. */
@@ -546,15 +546,13 @@ svn_wc__cd_to_cd2(const svn_wc_conflict_
 
 svn_error_t *
 svn_wc__status2_from_3(svn_wc_status2_t **status,
-                       const svn_wc_status3_t *old_status, 
+                       const svn_wc_status3_t *old_status,
                        svn_wc_context_t *wc_ctx,
                        const char *local_abspath,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
-  const svn_wc_entry_t *entry;
-  const svn_wc_conflict_description2_t *tree_conflict;
-  svn_wc_conflict_description_t *old_tree_conflict;
+  const svn_wc_entry_t *entry = NULL;
 
   if (old_status == NULL)
     {
@@ -564,33 +562,141 @@ svn_wc__status2_from_3(svn_wc_status2_t 
 
   *status = apr_pcalloc(result_pool, sizeof(**status));
 
-  SVN_ERR(svn_wc__get_entry(&entry, wc_ctx->db, local_abspath, TRUE,
-                            svn_node_unknown, FALSE, result_pool,
-                            scratch_pool));
-
-  SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, wc_ctx->db,
-                                           local_abspath, scratch_pool,
-                                           scratch_pool));
-  old_tree_conflict = svn_wc__cd2_to_cd(tree_conflict, result_pool);
+  if (old_status->versioned)
+    {
+      svn_error_t *err;
+      err= svn_wc__get_entry(&entry, wc_ctx->db, local_abspath, FALSE,
+                             svn_node_unknown, FALSE, result_pool,
+                             scratch_pool);
+
+      if (err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND)
+        svn_error_clear(err);
+      else
+        SVN_ERR(err);
+    }
 
   (*status)->entry = entry;
-  (*status)->text_status = old_status->text_status;
-  (*status)->prop_status = old_status->prop_status;
-  (*status)->locked = old_status->locked;
   (*status)->copied = old_status->copied;
-  (*status)->switched = old_status->switched;
-  (*status)->repos_text_status = old_status->repos_text_status;
-  (*status)->repos_prop_status = old_status->repos_prop_status;
   (*status)->repos_lock = svn_lock_dup(old_status->repos_lock, result_pool);
-  (*status)->url = apr_pstrdup(result_pool, old_status->url);
-  (*status)->ood_last_cmt_rev = old_status->ood_last_cmt_rev;
-  (*status)->ood_last_cmt_date = old_status->ood_last_cmt_date;
+
+  if (old_status->repos_relpath)
+    (*status)->url = svn_path_url_add_component2(old_status->repos_root_url,
+                                                 old_status->repos_relpath,
+                                                 result_pool);
+  (*status)->ood_last_cmt_rev = old_status->ood_changed_rev;
+  (*status)->ood_last_cmt_date = old_status->ood_changed_date;
   (*status)->ood_kind = old_status->ood_kind;
-  (*status)->ood_last_cmt_author = old_status->ood_last_cmt_author;
-  (*status)->tree_conflict = old_tree_conflict;
-  (*status)->file_external = old_status->file_external;
-  (*status)->pristine_text_status = old_status->pristine_text_status;
-  (*status)->pristine_prop_status = old_status->pristine_prop_status;
+  (*status)->ood_last_cmt_author = old_status->ood_changed_author;
+
+  if (old_status->conflicted)
+    {
+      const svn_wc_conflict_description2_t *tree_conflict;
+      SVN_ERR(svn_wc__db_op_read_tree_conflict(&tree_conflict, wc_ctx->db,
+                                               local_abspath, scratch_pool,
+                                               scratch_pool));
+      (*status)->tree_conflict = svn_wc__cd2_to_cd(tree_conflict, result_pool);
+    }
+
+  (*status)->switched = old_status->switched;
+
+  if (old_status->versioned
+      && old_status->switched
+      && old_status->kind == svn_node_file)
+    {
+      svn_boolean_t file_external;
+
+      SVN_ERR(svn_wc__internal_is_file_external(&file_external,
+                                            wc_ctx->db, local_abspath,
+                                            scratch_pool));
+
+      if (file_external)
+        {
+          (*status)->switched = FALSE;
+          (*status)->file_external = TRUE;
+        }
+    }
+
+  (*status)->text_status = old_status->node_status;
+  (*status)->prop_status = old_status->prop_status;
+
+  (*status)->repos_text_status = old_status->repos_node_status;
+  (*status)->repos_prop_status = old_status->repos_prop_status;
+
+  /* Some values might be inherited from properties */
+  if (old_status->node_status == svn_wc_status_modified
+      || old_status->node_status == svn_wc_status_conflicted)
+    (*status)->text_status = old_status->text_status;
+
+  /* (Currently a no-op, but just make sure it is ok) */
+  if (old_status->repos_node_status == svn_wc_status_modified
+      || old_status->repos_node_status == svn_wc_status_conflicted)
+    (*status)->text_status = old_status->repos_text_status;
+
+  if (old_status->node_status == svn_wc_status_added)
+    (*status)->prop_status = svn_wc_status_none; /* No separate info */
+
+  /* Find pristine_text_status value */
+  switch (old_status->text_status)
+    {
+      case svn_wc_status_none:
+      case svn_wc_status_normal:
+      case svn_wc_status_modified:
+        (*status)->pristine_text_status = old_status->text_status;
+        break;
+      case svn_wc_status_conflicted:
+      default:
+        /* ### Fetch compare data, or fall back to the documented
+               not retrieved behavior? */
+        (*status)->pristine_text_status = svn_wc_status_none;
+        break;
+    }
+
+  /* Find pristine_prop_status value */
+  switch (old_status->prop_status)
+    {
+      case svn_wc_status_none:
+      case svn_wc_status_normal:
+      case svn_wc_status_modified:
+        if (old_status->node_status != svn_wc_status_added
+            && old_status->node_status != svn_wc_status_deleted
+            && old_status->node_status != svn_wc_status_replaced)
+          {
+            (*status)->pristine_prop_status = old_status->prop_status;
+          }
+        else
+          (*status)->pristine_prop_status = svn_wc_status_none;
+        break;
+      case svn_wc_status_conflicted:
+      default:
+        /* ### Fetch compare data, or fall back to the documented
+               not retrieved behavior? */
+        (*status)->pristine_prop_status = svn_wc_status_none;
+        break;
+    }
+
+  if (old_status->versioned
+      && old_status->conflicted
+      && old_status->node_status != svn_wc_status_obstructed
+      && (old_status->kind == svn_node_file 
+          || old_status->node_status != svn_wc_status_missing))
+    {
+      svn_boolean_t text_conflict_p, prop_conflict_p;
+
+      /* The entry says there was a conflict, but the user might have
+         marked it as resolved by deleting the artifact files, so check
+         for that. */
+      SVN_ERR(svn_wc__internal_conflicted_p(&text_conflict_p,
+                                            &prop_conflict_p,
+                                            NULL,
+                                            wc_ctx->db, local_abspath,
+                                            scratch_pool));
+
+      if (text_conflict_p)
+        (*status)->text_status = svn_wc_status_conflicted;
+
+      if (prop_conflict_p)
+        (*status)->prop_status = svn_wc_status_conflicted;
+    }
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-metadata.sql?rev=984234&r1=984233&r2=984234&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-metadata.sql Tue Aug 10 22:07:24 2010
@@ -475,7 +475,9 @@ CREATE TABLE WC_LOCK (
  );
 
 
-PRAGMA user_version = 16;
+PRAGMA user_version =
+-- define: SVN_WC__VERSION
+;
 
 
 /* ------------------------------------------------------------------------- */
@@ -581,6 +583,13 @@ 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;
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-queries.sql?rev=984234&r1=984233&r2=984234&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc-queries.sql Tue Aug 10 22:07:24 2010
@@ -80,23 +80,34 @@ values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, 
 -- STMT_INSERT_BASE_NODE_INCOMPLETE
 insert or ignore into base_node (
   wc_id, local_relpath, parent_relpath, presence, kind, revnum)
-values (?1, ?2, ?3, 'incomplete', 'unknown', ?5);
+values (?1, ?2, ?3, 'incomplete', 'unknown', ?4);
+
+-- STMT_INSERT_BASE_NODE_INCOMPLETE_DIR
+insert or ignore into base_node (
+  wc_id, local_relpath, repos_id, repos_relpath, parent_relpath, presence,
+  kind, revnum)
+values (?1, ?2, ?3, ?4, ?5, 'incomplete', 'dir', ?6);
 
 -- STMT_INSERT_WORKING_NODE_INCOMPLETE
-INSERT OR IGNORE INTO BASE_NODE (
+INSERT OR IGNORE INTO WORKING_NODE (
   wc_id, local_relpath, parent_relpath, presence, kind)
 VALUES (?1, ?2, ?3, 'incomplete', 'unknown');
 
+-- STMT_COUNT_BASE_NODE_CHILDREN
+SELECT COUNT(*) FROM BASE_NODE
+WHERE wc_id = ?1 AND parent_relpath = ?2;
+
+-- STMT_COUNT_WORKING_NODE_CHILDREN
+SELECT COUNT(*) FROM WORKING_NODE
+WHERE wc_id = ?1 AND parent_relpath = ?2;
+
 -- STMT_SELECT_BASE_NODE_CHILDREN
 select local_relpath from base_node
 where wc_id = ?1 and parent_relpath = ?2;
 
--- STMT_SELECT_WORKING_CHILDREN
-select local_relpath from base_node
-where wc_id = ?1 and parent_relpath = ?2
-union
-select local_relpath from working_node
-where wc_id = ?1 and parent_relpath = ?2;
+-- STMT_SELECT_WORKING_NODE_CHILDREN
+SELECT local_relpath FROM WORKING_NODE
+WHERE wc_id = ?1 AND parent_relpath = ?2;
 
 -- STMT_SELECT_WORKING_IS_FILE
 select kind == 'file' from working_node
@@ -210,6 +221,26 @@ insert into actual_node (
   wc_id, local_relpath, tree_conflict_data)
 values (?1, ?2, ?3);
 
+-- STMT_UPDATE_ACTUAL_TEXT_CONFLICTS
+update actual_node set conflict_old = ?3, conflict_new = ?4,
+conflict_working = ?5
+where wc_id = ?1 and local_relpath = ?2;
+
+-- STMT_INSERT_ACTUAL_TEXT_CONFLICTS
+insert into actual_node (
+  wc_id, local_relpath, conflict_old, conflict_new, conflict_working,
+  parent_relpath)
+values (?1, ?2, ?3, ?4, ?5, ?6);
+
+-- STMT_UPDATE_ACTUAL_PROPERTY_CONFLICTS
+update actual_node set prop_reject = ?3
+where wc_id = ?1 and local_relpath = ?2;
+
+-- STMT_INSERT_ACTUAL_PROPERTY_CONFLICTS
+insert into actual_node (
+  wc_id, local_relpath, prop_reject, parent_relpath)
+values (?1, ?2, ?3, ?4);
+
 -- STMT_UPDATE_ACTUAL_CHANGELIST
 update actual_node set changelist = ?3
 where wc_id = ?1 and local_relpath = ?2;
@@ -256,6 +287,10 @@ WHERE wc_id = ?1 AND local_relpath = ?2;
 update base_node set presence= ?3
 where wc_id = ?1 and local_relpath = ?2;
 
+-- STMT_UPDATE_BASE_PRESENCE_KIND
+update base_node set presence = ?3, kind = ?4
+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;
@@ -294,6 +329,10 @@ SELECT checksum
 FROM pristine
 WHERE md5_checksum = ?1
 
+-- STMT_SELECT_PRISTINE_ROWS
+SELECT checksum
+FROM pristine
+
 -- STMT_SELECT_ANY_PRISTINE_REFERENCE
 SELECT 1 FROM base_node
   WHERE checksum = ?1 OR checksum = ?2
@@ -446,6 +485,19 @@ SELECT wc_id, ?3 AS local_relpath, ?4 AS
      prop_reject, changelist, text_mod, tree_conflict_data FROM ACTUAL_NODE
 WHERE wc_id = ?1 AND local_relpath = ?2;
 
+-- STMT_SELECT_SUBDIR
+SELECT 1 FROM BASE_NODE WHERE wc_id = ?1 and local_relpath = ?2 and kind = 'subdir'
+UNION
+SELECT 0 FROM WORKING_NODE WHERE wc_id = ?1 and local_relpath = ?2 and kind = 'subdir';
+
+-- STMT_UPDATE_BASE_REVISION
+UPDATE BASE_NODE SET revnum=?3
+WHERE wc_id = ?1 AND local_relpath = ?2;
+
+-- STMT_UPDATE_BASE_REPOS
+UPDATE BASE_NODE SET repos_id = ?3, repos_relpath = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2;
+
 /* ------------------------------------------------------------------------- */
 
 /* these are used in entries.c  */
@@ -497,11 +549,6 @@ where wc_id = ?1 and local_relpath = ?2;
 update base_node set file_external = ?3
 where wc_id = ?1 and local_relpath = ?2;
 
--- STMT_UPDATE_WORKING_CHECKSUM
-update working_node set checksum = ?3
-where wc_id = ?1 and local_relpath = ?2;
-
-
 /* ------------------------------------------------------------------------- */
 
 /* these are used in upgrade.c  */
@@ -523,6 +570,18 @@ values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, 
 -- STMT_ERASE_OLD_CONFLICTS
 update actual_node set tree_conflict_data = null;
 
+-- STMT_SELECT_ALL_FILES
+SELECT local_relpath FROM BASE_NODE
+WHERE kind = 'file'
+UNION
+SELECT local_relpath FROM WORKING_NODE
+WHERE kind = 'file';
+
+-- STMT_PLAN_PROP_UPGRADE
+SELECT 0, null, wc_id FROM BASE_NODE WHERE local_relpath = ?1
+UNION
+SELECT 1, presence, wc_id FROM WORKING_NODE WHERE local_relpath = ?1;
+
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc.h?rev=984234&r1=984233&r2=984234&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/wc.h Tue Aug 10 22:07:24 2010
@@ -123,7 +123,8 @@ extern "C" {
  * Please document any further format changes here.
  */
 
-#define SVN_WC__VERSION 16
+#define SVN_WC__VERSION 17
+#define SVN_EXPERIMENTAL_PRISTINE
 
 
 /* Formats <= this have no concept of "revert text-base/props".  */
@@ -157,7 +158,15 @@ extern "C" {
 #define SVN_WC__USES_DAV_CACHE 13
 
 /* A version < this does not store properties in wc.db.  */
-#define SVN_WC__PROPS_IN_DB 17
+#define SVN_WC__PROPS_IN_DB 18
+
+/* Return true iff error E indicates an "is not a working copy" type
+   of error, either because something wasn't a working copy at all, or
+   because it's a working copy from a previous version (in need of
+   upgrade). */
+#define SVN_WC__ERR_IS_NOT_CURRENT_WC(e) \
+            ((e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) || \
+             (e->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED))
 
 
 
@@ -520,15 +529,6 @@ svn_wc__internal_transmit_prop_deltas(sv
                                      void *baton,
                                      apr_pool_t *scratch_pool);
 
-/* Internal version of svn_wc_get_ancestry(). */
-svn_error_t *
-svn_wc__internal_get_ancestry(const char **url,
-                              svn_revnum_t *rev,
-                              svn_wc__db_t *db,
-                              const char *local_abspath,
-                              apr_pool_t *result_pool,
-                              apr_pool_t *scratch_pool);
-
 /* Library-internal version of svn_wc_ensure_adm4(). */
 svn_error_t *
 svn_wc__internal_ensure_adm(svn_wc__db_t *db,
@@ -573,6 +573,7 @@ svn_wc__internal_remove_from_revision_co
                                               apr_pool_t *scratch_pool);
 
 
+/* Library-internal version of svn_wc__node_is_replaced(). */
 svn_error_t *
 svn_wc__internal_is_replaced(svn_boolean_t *replaced,
                              svn_wc__db_t *db,
@@ -580,6 +581,7 @@ svn_wc__internal_is_replaced(svn_boolean
                              apr_pool_t *scratch_pool);
 
 
+/* Library-internal version of svn_wc__node_get_url(). */
 svn_error_t *
 svn_wc__internal_node_get_url(const char **url,
                               svn_wc__db_t *db,
@@ -588,12 +590,22 @@ svn_wc__internal_node_get_url(const char
                               apr_pool_t *scratch_pool);
 
 
+/* Library-internal version of svn_wc__node_is_file_external(). */
 svn_error_t *
 svn_wc__internal_is_file_external(svn_boolean_t *file_external,
                                   svn_wc__db_t *db,
                                   const char *local_abspath,
                                   apr_pool_t *scratch_pool);
 
+/* Library-internal version of svn_wc__node_get_schedule(). */
+svn_error_t *
+svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
+                                   svn_boolean_t *copied,
+                                   svn_wc__db_t *db,
+                                   const char *local_abspath,
+                                   apr_pool_t *scratch_pool);
+
+
 
 /* Upgrade the wc sqlite database given in SDB for the wc located at
    WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.