You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2018/10/07 11:21:42 UTC

svn commit: r1843059 - in /subversion/branches/better-pristines/subversion: include/ include/private/ libsvn_client/ libsvn_wc/

Author: brane
Date: Sun Oct  7 11:21:42 2018
New Revision: 1843059

URL: http://svn.apache.org/viewvc?rev=1843059&view=rev
Log:
On the better-pristines branch: Make the --compatible-veersion option actually
do something during 'svn checkout' and 'svn upgrade'.

* subversion/include/svn_wc.h (svn_wc_ensure_adm4): Deprecate.
* subversion/include/private/svn_wc_private.h
  (svn_wc__ensure_adm): New, replaces svn_wc_ensure_adm4.

* subversion/libsvn_client/client.h
  (svn_client__checkout_internal): Add parameter wc_format_version.

* subversion/libsvn_client/checkout.c
  (initialize_area): Add parameter target_format.
  (svn_client__checkout_internal): Add parameter wc_format_version,
   created the new working copy with the desired format.

* subversion/libsvn_client/conflicts.c (merge_incoming_added_dir_replace),
* subversion/libsvn_client/copy.c (repos_to_wc_copy_single),
* subversion/libsvn_client/externals.c (switch_dir_external):
   Add a note that the correct WC format has not been determined.

* subversion/libsvn_wc/wc.h
  (svn_wc__internal_ensure_adm): Add parameter target_format.
* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_init): Add parameter target_format.

* subversion/libsvn_wc/adm_files.c: Include svn_version.h for SVN_VER_NUM.
  (init_adm): Add parameter target_format and use it for svn_wc__db_init.
  (svn_wc__internal_ensure_adm): Add parameter target_format.
   Rename local variable 'format' to 'present_format'.
  (svn_wc__ensure_adm): Renamed from svn_wc_ensure_adm4.
   Add parameter target_format.
* subversion/libsvn_wc/upgrade.c
  (svn_wc__upgrade): Use the target_format for upgrades.
* subversion/libsvn_wc/wc_db.c
  (init_db): Add parameter target_format. Use it for the schema update.
  (create_db): Add parameter target_format.
  (svn_wc__db_init): Add parameter target_format.
  (svn_wc__db_upgrade_begin): Add parameter target_format.
* subversion/libsvn_wc/deprecated.c
  (svn_wc_ensure_adm4): Moved from adm_files.c and changed to wrapper
   for svn_wc__ensure_adm, using SVN_WC__VERSION as the target_format.

Modified:
    subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
    subversion/branches/better-pristines/subversion/include/svn_wc.h
    subversion/branches/better-pristines/subversion/libsvn_client/checkout.c
    subversion/branches/better-pristines/subversion/libsvn_client/client.h
    subversion/branches/better-pristines/subversion/libsvn_client/conflicts.c
    subversion/branches/better-pristines/subversion/libsvn_client/copy.c
    subversion/branches/better-pristines/subversion/libsvn_client/externals.c
    subversion/branches/better-pristines/subversion/libsvn_wc/adm_files.c
    subversion/branches/better-pristines/subversion/libsvn_wc/deprecated.c
    subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c
    subversion/branches/better-pristines/subversion/libsvn_wc/wc.h
    subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.c
    subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.h

Modified: subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h Sun Oct  7 11:21:42 2018
@@ -2110,7 +2110,6 @@ svn_wc__translated_stream(svn_stream_t *
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool);
 
-
 /**
  * Convert @a version to that version's characteristic working copy
  * format, returned in @a format.
@@ -2125,6 +2124,43 @@ svn_wc__format_from_version(int *format,
                             apr_pool_t *scratch_pool);
 
 /**
+ * Ensure that an administrative area exists for @a local_abspath, so that @a
+ * local_abspath is a working copy subdir with schema version @a target_format
+ * based on @a url at @a revision, with depth @a depth, and with repository UUID
+ * @a repos_uuid and repository root URL @a repos_root_url.
+ *
+ * @a depth must be a definite depth, it cannot be #svn_depth_unknown.
+ * @a repos_uuid and @a repos_root_url MUST NOT be @c NULL, and
+ * @a repos_root_url must be a prefix of @a url.
+ *
+ * If the administrative area does not exist, then create it and
+ * initialize it to an unlocked state.
+ *
+ * If the administrative area already exists then the given @a url
+ * must match the URL in the administrative area and the given
+ * @a revision must match the BASE of the working copy dir unless
+ * the admin directory is scheduled for deletion or the
+ * #SVN_ERR_WC_OBSTRUCTED_UPDATE error will be returned.
+ *
+ * Do not ensure existence of @a local_abspath itself; if @a local_abspath
+ * does not exist, return error.
+ *
+ * Use @a scratch_pool for temporary allocations.
+ *
+ * @since New in 1.12.
+ */
+svn_error_t *
+svn_wc__ensure_adm(svn_wc_context_t *wc_ctx,
+                   int target_format,
+                   const char *local_abspath,
+                   const char *url,
+                   const char *repos_root_url,
+                   const char *repos_uuid,
+                   svn_revnum_t revision,
+                   svn_depth_t depth,
+                   apr_pool_t *scratch_pool);
+
+/**
  * Upgrade the working copy at @a local_abspath to the metadata
  * storage format indicated by @a target_format.  @a local_abspath
  * should be an absolute path to the root of the working copy.

Modified: subversion/branches/better-pristines/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/svn_wc.h?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/svn_wc.h (original)
+++ subversion/branches/better-pristines/subversion/include/svn_wc.h Sun Oct  7 11:21:42 2018
@@ -3522,7 +3522,8 @@ svn_wc_mark_missing_deleted(const char *
                             apr_pool_t *pool);
 
 
-/** Ensure that an administrative area exists for @a local_abspath, so
+/**
+ * Ensure that an administrative area exists for @a local_abspath, so
  * that @a local_abspath is a working copy subdir based on @a url at @a
  * revision, with depth @a depth, and with repository UUID @a repos_uuid
  * and repository root URL @a repos_root_url.
@@ -3532,7 +3533,8 @@ svn_wc_mark_missing_deleted(const char *
  * @a repos_root_url must be a prefix of @a url.
  *
  * If the administrative area does not exist, then create it and
- * initialize it to an unlocked state.
+ * initialize it to an unlocked state. The format of the new
+ * administrative area will always be the newset supported format.
  *
  * If the administrative area already exists then the given @a url
  * must match the URL in the administrative area and the given
@@ -3546,7 +3548,9 @@ svn_wc_mark_missing_deleted(const char *
  * Use @a scratch_pool for temporary allocations.
  *
  * @since New in 1.7.
+ * @deprecated Provided for backwards compatibility with the 1.11 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_wc_ensure_adm4(svn_wc_context_t *wc_ctx,
                    const char *local_abspath,

Modified: subversion/branches/better-pristines/subversion/libsvn_client/checkout.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/checkout.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/checkout.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/checkout.c Sun Oct  7 11:21:42 2018
@@ -48,7 +48,8 @@
 /*** Public Interfaces. ***/
 
 static svn_error_t *
-initialize_area(const char *local_abspath,
+initialize_area(int target_format,
+                const char *local_abspath,
                 const svn_client__pathrev_t *pathrev,
                 svn_depth_t depth,
                 svn_client_ctx_t *ctx,
@@ -58,7 +59,8 @@ initialize_area(const char *local_abspat
     depth = svn_depth_infinity;
 
   /* Make the unversioned directory into a versioned one.  */
-  SVN_ERR(svn_wc_ensure_adm4(ctx->wc_ctx, local_abspath, pathrev->url,
+  SVN_ERR(svn_wc__ensure_adm(ctx->wc_ctx,
+                             target_format, local_abspath, pathrev->url,
                              pathrev->repos_root_url, pathrev->repos_uuid,
                              pathrev->rev, depth, pool));
   return SVN_NO_ERROR;
@@ -75,10 +77,12 @@ svn_client__checkout_internal(svn_revnum
                               svn_depth_t depth,
                               svn_boolean_t ignore_externals,
                               svn_boolean_t allow_unver_obstructions,
+                              const svn_version_t *wc_format_version,
                               svn_ra_session_t *ra_session,
                               svn_client_ctx_t *ctx,
                               apr_pool_t *scratch_pool)
 {
+  int target_format;
   svn_node_kind_t kind;
   svn_client__pathrev_t *pathrev;
   svn_opt_revision_t resolved_rev = { svn_opt_revision_number };
@@ -94,6 +98,9 @@ svn_client__checkout_internal(svn_revnum
       && (revision->kind != svn_opt_revision_head))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
+  SVN_ERR(svn_wc__format_from_version(&target_format, wc_format_version,
+                                      scratch_pool));
+
   /* Get the RA connection, if needed. */
   if (ra_session)
     {
@@ -144,21 +151,21 @@ svn_client__checkout_internal(svn_revnum
          entries file should only have an entry for THIS_DIR with a
          URL, revnum, and an 'incomplete' flag.  */
       SVN_ERR(svn_io_make_dir_recursively(local_abspath, scratch_pool));
-      SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx,
-                              scratch_pool));
+      SVN_ERR(initialize_area(target_format, local_abspath, pathrev, depth,
+                              ctx, scratch_pool));
     }
   else if (kind == svn_node_dir)
     {
-      int wc_format;
+      int present_format;
       const char *entry_url;
 
-      SVN_ERR(svn_wc_check_wc2(&wc_format, ctx->wc_ctx, local_abspath,
+      SVN_ERR(svn_wc_check_wc2(&present_format, ctx->wc_ctx, local_abspath,
                                scratch_pool));
 
-      if (! wc_format)
+      if (! present_format)
         {
-          SVN_ERR(initialize_area(local_abspath, pathrev, depth, ctx,
-                                  scratch_pool));
+          SVN_ERR(initialize_area(target_format, local_abspath, pathrev, depth,
+                                  ctx, scratch_pool));
         }
       else
         {
@@ -171,10 +178,18 @@ svn_client__checkout_internal(svn_revnum
              interrupted checkout.  Otherwise bail out. */
           if (strcmp(entry_url, pathrev->url) != 0)
             return svn_error_createf(
-                          SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
-                          _("'%s' is already a working copy for a"
-                            " different URL"),
-                          svn_dirent_local_style(local_abspath, scratch_pool));
+                SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+                _("'%s' is already a working copy for a different URL"),
+                svn_dirent_local_style(local_abspath, scratch_pool));
+
+          /* Warn if the existing WC's format is different than requested. */
+          if (present_format != target_format)
+            return svn_error_createf(
+                SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+                _("'%s' is already a working copy for the same URL"
+                  " but its format is %d instead of the expected %d"),
+                svn_dirent_local_style(local_abspath, scratch_pool),
+                present_format, target_format);
         }
     }
   else
@@ -221,6 +236,7 @@ svn_client_checkout4(svn_revnum_t *resul
                                       peg_revision, revision, depth,
                                       ignore_externals,
                                       allow_unver_obstructions,
+                                      wc_format_version,
                                       NULL /* ra_session */,
                                       ctx, pool);
   if (sleep_here)

Modified: subversion/branches/better-pristines/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/client.h?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/client.h (original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/client.h Sun Oct  7 11:21:42 2018
@@ -539,6 +539,10 @@ svn_client__update_internal(svn_revnum_t
    the repos are tolerated; if FALSE, these obstructions cause the checkout
    to fail.
 
+   A new working copy, if needed, will be created in the format corresponding
+   to the WC_FORMAT_VERSION of the client, where NULL means the current version
+   number. The format of any existing working copy will remain unchanged.
+
    If RA_SESSION is NOT NULL, it may be used to avoid creating a new
    session. The session may point to a different URL after returning.
    */
@@ -552,6 +556,7 @@ svn_client__checkout_internal(svn_revnum
                               svn_depth_t depth,
                               svn_boolean_t ignore_externals,
                               svn_boolean_t allow_unver_obstructions,
+                              const svn_version_t *wc_format_version,
                               svn_ra_session_t *ra_session,
                               svn_client_ctx_t *ctx,
                               apr_pool_t *pool);

Modified: subversion/branches/better-pristines/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/conflicts.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/conflicts.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/conflicts.c Sun Oct  7 11:21:42 2018
@@ -8053,6 +8053,7 @@ merge_incoming_added_dir_replace(svn_cli
                                       svn_depth_infinity,
                                       TRUE, /* we want to ignore externals */
                                       FALSE, /* we don't allow obstructions */
+                                      /* FIXME: WC FORMAT! */NULL,
                                       ra_session, ctx, scratch_pool);
 
   ctx->notify_func2 = old_notify_func2;

Modified: subversion/branches/better-pristines/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/copy.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/copy.c Sun Oct  7 11:21:42 2018
@@ -2419,6 +2419,7 @@ repos_to_wc_copy_single(svn_boolean_t *t
                                                 &pair->src_op_revision,
                                                 svn_depth_infinity,
                                                 ignore_externals, FALSE,
+                                                /* FIXME: WC FORMAT! */NULL,
                                                 ra_session, ctx, pool);
 
             ctx->notify_func2 = old_notify_func2;

Modified: subversion/branches/better-pristines/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/externals.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/externals.c Sun Oct  7 11:21:42 2018
@@ -412,6 +412,7 @@ switch_dir_external(const char *local_ab
                                         url, local_abspath, peg_revision,
                                         revision, svn_depth_infinity,
                                         FALSE, FALSE,
+                                        /* FIXME: WC FORMAT! */NULL,
                                         ra_session,
                                         ctx, pool));
 

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/adm_files.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/adm_files.c Sun Oct  7 11:21:42 2018
@@ -38,6 +38,7 @@
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 #include "svn_hash.h"
+#include "svn_version.h"
 
 #include "wc.h"
 #include "adm_files.h"
@@ -315,6 +316,7 @@ init_adm_tmp_area(const char *path, apr_
    unlock it when done. */
 static svn_error_t *
 init_adm(svn_wc__db_t *db,
+         int target_format,
          const char *local_abspath,
          const char *repos_relpath,
          const char *repos_root_url,
@@ -340,10 +342,9 @@ init_adm(svn_wc__db_t *db,
   SVN_ERR(init_adm_tmp_area(local_abspath, pool));
 
   /* Create the SDB. */
-  SVN_ERR(svn_wc__db_init(db, local_abspath,
+  SVN_ERR(svn_wc__db_init(db, target_format, local_abspath,
                           repos_relpath, repos_root_url, repos_uuid,
-                          initial_rev, depth,
-                          pool));
+                          initial_rev, depth, pool));
 
   /* Stamp ENTRIES and FORMAT files for old clients.  */
   SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath,
@@ -362,6 +363,7 @@ init_adm(svn_wc__db_t *db,
 
 svn_error_t *
 svn_wc__internal_ensure_adm(svn_wc__db_t *db,
+                            int target_format,
                             const char *local_abspath,
                             const char *url,
                             const char *repos_root_url,
@@ -370,7 +372,7 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                             svn_depth_t depth,
                             apr_pool_t *scratch_pool)
 {
-  int format;
+  int present_format;
   const char *original_repos_relpath;
   const char *original_root_url;
   svn_boolean_t is_op_root;
@@ -386,15 +388,30 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
   SVN_ERR_ASSERT(repos_uuid != NULL);
   SVN_ERR_ASSERT(repos_relpath != NULL);
 
-  SVN_ERR(svn_wc__internal_check_wc(&format, db, local_abspath, TRUE,
+  SVN_ERR(svn_wc__internal_check_wc(&present_format, db, local_abspath, TRUE,
                                     scratch_pool));
 
   /* Early out: we know we're not dealing with an existing wc, so
      just create one. */
-  if (format == 0)
-    return svn_error_trace(init_adm(db, local_abspath,
-                                    repos_relpath, repos_root_url, repos_uuid,
-                                    revision, depth, scratch_pool));
+  if (present_format == 0)
+    {
+
+      if (target_format < SVN_WC__SUPPORTED_VERSION)
+        return svn_error_createf(
+            SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+            _("Working copy format %d is not supported by client version %s."),
+            target_format, SVN_VER_NUM);
+
+      if (target_format > SVN_WC__VERSION)
+        return svn_error_createf(
+            SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+            _("Working copy format %d can't be created by client version %s."),
+            target_format, SVN_VER_NUM);
+
+      return svn_error_trace(init_adm(db, target_format, local_abspath,
+                                      repos_relpath, repos_root_url, repos_uuid,
+                                      revision, depth, scratch_pool));
+    }
 
   SVN_ERR(svn_wc__db_read_info(&status, NULL,
                                &db_revision, &db_repos_relpath,
@@ -413,6 +430,13 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
   if (status != svn_wc__db_status_deleted
       && status != svn_wc__db_status_not_present)
     {
+      /* Check that the existing format matches the requested format. */
+      if (present_format != target_format)
+        return svn_error_createf(
+            SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+            _("Format %d doesn't match existing format %d in '%s'"),
+            target_format, present_format, db_revision, local_abspath);
+
       /* ### Should we match copyfrom_revision? */
       if (db_revision != revision)
         return
@@ -473,7 +497,8 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
 }
 
 svn_error_t *
-svn_wc_ensure_adm4(svn_wc_context_t *wc_ctx,
+svn_wc__ensure_adm(svn_wc_context_t *wc_ctx,
+                   int target_format,
                    const char *local_abspath,
                    const char *url,
                    const char *repos_root_url,
@@ -483,8 +508,9 @@ svn_wc_ensure_adm4(svn_wc_context_t *wc_
                    apr_pool_t *scratch_pool)
 {
   return svn_error_trace(
-    svn_wc__internal_ensure_adm(wc_ctx->db, local_abspath, url, repos_root_url,
-                                repos_uuid, revision, depth, scratch_pool));
+    svn_wc__internal_ensure_adm(wc_ctx->db, target_format, local_abspath,
+                                url, repos_root_url, repos_uuid, revision,
+                                depth, scratch_pool));
 }
 
 svn_error_t *

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/deprecated.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/deprecated.c Sun Oct  7 11:21:42 2018
@@ -570,6 +570,22 @@ svn_wc_transmit_prop_deltas(const char *
 
 /*** From adm_files.c ***/
 svn_error_t *
+svn_wc_ensure_adm4(svn_wc_context_t *wc_ctx,
+                   const char *local_abspath,
+                   const char *url,
+                   const char *repos_root_url,
+                   const char *repos_uuid,
+                   svn_revnum_t revision,
+                   svn_depth_t depth,
+                   apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(
+      svn_wc__ensure_adm(wc_ctx, SVN_WC__VERSION, local_abspath,
+                         url, repos_root_url, repos_uuid, revision, depth,
+                         scratch_pool));
+}
+
+svn_error_t *
 svn_wc_ensure_adm3(const char *path,
                    const char *uuid,
                    const char *url,

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c Sun Oct  7 11:21:42 2018
@@ -2026,7 +2026,7 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
       /* Auto-upgrade worked! */
       SVN_ERR(svn_wc__db_close(db));
 
-      SVN_ERR_ASSERT(result_format == SVN_WC__VERSION);
+      SVN_ERR_ASSERT(result_format == target_format);
 
       if (bumped_format && notify_func)
         {
@@ -2080,7 +2080,7 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
   /* Create an empty sqlite database for this directory and store it in DB. */
   SVN_ERR(svn_wc__db_upgrade_begin(&data.sdb,
                                    &data.repos_id, &data.wc_id,
-                                   db, data.root_abspath,
+                                   db, target_format, data.root_abspath,
                                    this_dir->repos, this_dir->uuid,
                                    scratch_pool));
 

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/wc.h?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/wc.h Sun Oct  7 11:21:42 2018
@@ -516,6 +516,7 @@ svn_wc__internal_transmit_prop_deltas(sv
 /* Library-internal version of svn_wc_ensure_adm4(). */
 svn_error_t *
 svn_wc__internal_ensure_adm(svn_wc__db_t *db,
+                            int target_format,
                             const char *local_abspath,
                             const char *url,
                             const char *repos_root_url,

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.c?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.c Sun Oct  7 11:21:42 2018
@@ -1360,6 +1360,7 @@ init_db(/* output values */
         apr_int64_t *wc_id,
         /* input values */
         svn_sqlite__db_t *db,
+        int target_format,
         const char *repos_root_url,
         const char *repos_uuid,
         const char *root_node_repos_relpath,
@@ -1373,10 +1374,8 @@ init_db(/* output values */
 
   /* Create the database's schema.  */
   SVN_ERR(svn_sqlite__exec_statements(db, STMT_CREATE_SCHEMA));
-
-  /* TODO: Parametrize the target format here. */
   SVN_ERR(svn_wc__update_schema(&result_format, wcroot_abspath, db,
-                                SVN_WC__SUPPORTED_VERSION, SVN_WC__VERSION,
+                                SVN_WC__SUPPORTED_VERSION, target_format,
                                 scratch_pool));
 
   SVN_ERR(svn_wc__db_install_schema_statistics(db, scratch_pool));
@@ -1417,10 +1416,9 @@ init_db(/* output values */
   return SVN_NO_ERROR;
 }
 
-/* Create an sqlite database at DIR_ABSPATH/SDB_FNAME and insert
-   records for REPOS_ID (using REPOS_ROOT_URL and REPOS_UUID) into
-   REPOSITORY and for WC_ID into WCROOT.  Return the DB connection
-   in *SDB.
+/* Create an sqlite database with schema TARGET_FORMAT at DIR_ABSPATH/SDB_FNAME
+   and insert records for REPOS_ID (using REPOS_ROOT_URL and REPOS_UUID) into
+   REPOSITORY and for WC_ID into WCROOT. Return the DB connection in *SDB.
 
    If ROOT_NODE_REPOS_RELPATH is not NULL, insert a BASE node at
    the working copy root with repository relpath ROOT_NODE_REPOS_RELPATH,
@@ -1430,6 +1428,7 @@ static svn_error_t *
 create_db(svn_sqlite__db_t **sdb,
           apr_int64_t *repos_id,
           apr_int64_t *wc_id,
+          int target_format,
           const char *dir_abspath,
           const char *repos_root_url,
           const char *repos_uuid,
@@ -1449,7 +1448,7 @@ create_db(svn_sqlite__db_t **sdb,
                                   result_pool, scratch_pool));
 
   SVN_SQLITE__WITH_LOCK(init_db(repos_id, wc_id,
-                                *sdb, repos_root_url, repos_uuid,
+                                *sdb, target_format, repos_root_url, repos_uuid,
                                 root_node_repos_relpath, root_node_revision,
                                 root_node_depth, dir_abspath, scratch_pool),
                         *sdb);
@@ -1460,6 +1459,7 @@ create_db(svn_sqlite__db_t **sdb,
 
 svn_error_t *
 svn_wc__db_init(svn_wc__db_t *db,
+                int target_format,
                 const char *local_abspath,
                 const char *repos_relpath,
                 const char *repos_root_url,
@@ -1476,6 +1476,8 @@ svn_wc__db_init(svn_wc__db_t *db,
   apr_int32_t sqlite_timeout = 0; /* default timeout */
   apr_hash_index_t *hi;
 
+  SVN_ERR_ASSERT(SVN_WC__SUPPORTED_VERSION <= target_format
+                 && target_format <= SVN_WC__VERSION);
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(repos_relpath != NULL);
   SVN_ERR_ASSERT(depth == svn_depth_empty
@@ -1491,10 +1493,10 @@ svn_wc__db_init(svn_wc__db_t *db,
                               FALSE));
 
   /* Create the SDB and insert the basic rows.  */
-  SVN_ERR(create_db(&sdb, &repos_id, &wc_id, local_abspath, repos_root_url,
-                    repos_uuid, SDB_FILE,
-                    repos_relpath, initial_rev, depth, sqlite_exclusive,
-                    sqlite_timeout,
+  SVN_ERR(create_db(&sdb, &repos_id, &wc_id, target_format, local_abspath,
+                    repos_root_url, repos_uuid, SDB_FILE,
+                    repos_relpath, initial_rev, depth,
+                    sqlite_exclusive, sqlite_timeout,
                     db->state_pool, scratch_pool));
 
   /* Create the WCROOT for this directory.  */
@@ -13327,6 +13329,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
                          svn_wc__db_t *wc_db,
+                         int target_format,
                          const char *dir_abspath,
                          const char *repos_root_url,
                          const char *repos_uuid,
@@ -13335,8 +13338,8 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
   svn_wc__db_wcroot_t *wcroot;
 
   /* Upgrade is inherently exclusive so specify exclusive locking. */
-  SVN_ERR(create_db(sdb, repos_id, wc_id, dir_abspath,
-                    repos_root_url, repos_uuid,
+  SVN_ERR(create_db(sdb, repos_id, wc_id, target_format,
+                    dir_abspath, repos_root_url, repos_uuid,
                     SDB_FILE,
                     NULL, SVN_INVALID_REVNUM, svn_depth_unknown,
                     TRUE /* exclusive */,

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.h?rev=1843059&r1=1843058&r2=1843059&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/wc_db.h Sun Oct  7 11:21:42 2018
@@ -269,7 +269,8 @@ svn_error_t *
 svn_wc__db_close(svn_wc__db_t *db);
 
 
-/* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path.
+/* Initialize the SDB with format TARGET_FORMAT for LOCAL_ABSPATH, which should
+   be a working copy path.
 
    A REPOSITORY row will be constructed for the repository identified by
    REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL.
@@ -287,10 +288,13 @@ svn_wc__db_close(svn_wc__db_t *db);
    DEPTH is the initial depth of the working copy; it must be a definite
    depth, not svn_depth_unknown.
 
+   Create the working copy with the given TARGET_FORMAT.
+
    Use SCRATCH_POOL for temporary allocations.
 */
 svn_error_t *
 svn_wc__db_init(svn_wc__db_t *db,
+                int target_format,
                 const char *local_abspath,
                 const char *repos_relpath,
                 const char *repos_root_url,
@@ -2935,6 +2939,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
                          svn_wc__db_t *wc_db,
+                         int target_format,
                          const char *local_dir_abspath,
                          const char *repos_root_url,
                          const char *repos_uuid,