On the 'multi-wc-format' branch: fix and clarify use of default WC version.
Fix up some places where we were still using the latest version and should
be using the default version.
Introduce an explicit definition 'SVN_WC__DEFAULT_VERSION' and use it where
this is the intended meaning.
Move the defaulting down a layer, into 'svn_wc__format_from_version', except
where the client layer needs to care or do something different.
* subversion/include/private/svn_wc_private.h,
subversion/libsvn_wc/upgrade.c,
subversion/libsvn_wc/wc_db_wcroot.c
(svn_wc__format_from_version,
svn_wc__format_from_context): Use default version rather than latest.
* subversion/libsvn_client/checkout.c
(svn_client__checkout_internal): Add a comment.
* subversion/libsvn_client/upgrade.c
(svn_client_upgrade2): Don't handle the defaulting here; let
'svn_wc__format_from_version' handle it.
* subversion/libsvn_wc/deprecated.c
(svn_wc_ensure_adm4,
svn_wc_upgrade): Use default version rather than latest.
* subversion/libsvn_wc/wc.h
(SVN_WC__DEFAULT_VERSION): New.
* subversion/tests/libsvn_wc/entries-compat.c
(test_access_baton_like_locking): Don't handle the defaulting here; let
'svn_wc__format_from_version' handle it.
* subversion/tests/libsvn_wc/utils.c
(svn_test__create_fake_wc): Don't handle the defaulting here; let
'svn_wc__format_from_version' handle it.
* subversion/tests/libsvn_wc/wc-queries-test.c
(create_memory_db): Don't handle the defaulting here; let
'svn_wc__format_from_version' handle it.
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/multi-wc-format@1897967 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/include/private/svn_wc_private.h b/subversion/include/private/svn_wc_private.h
index d06a167..c467204 100644
--- a/subversion/include/private/svn_wc_private.h
+++ b/subversion/include/private/svn_wc_private.h
@@ -2183,6 +2183,8 @@
* Convert @a version to that version's characteristic working copy
* format, returned in @a format.
*
+ * A NULL @a version translates to the library's default version.
+ *
* Use @a scratch_pool for temporary allocations.
*
* @since New in 1.15.
@@ -2231,7 +2233,7 @@
/**
* Set @a format to the format of the nearest parent working copy root of
* @a local_abspath in @a wc_ctx, or to the oldest format of any root stored
- * there. If @a wc_ctx is empty, return the newset supported format.
+ * there. If @a wc_ctx is empty, return the library's default format.
*
* Use @a scratch_pool for temporary allocations.
*
diff --git a/subversion/libsvn_client/checkout.c b/subversion/libsvn_client/checkout.c
index 537d7b6..af045a0 100644
--- a/subversion/libsvn_client/checkout.c
+++ b/subversion/libsvn_client/checkout.c
@@ -98,6 +98,8 @@
&& (revision->kind != svn_opt_revision_head))
return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
+ /* Here the default for wc_format_version is determined from WC context,
+ * rather than the library's default version. */
if (wc_format_version)
SVN_ERR(svn_wc__format_from_version(&target_format, wc_format_version,
scratch_pool));
diff --git a/subversion/libsvn_client/client.h b/subversion/libsvn_client/client.h
index ef6fcc9..1a94ae1 100644
--- a/subversion/libsvn_client/client.h
+++ b/subversion/libsvn_client/client.h
@@ -541,9 +541,8 @@
A new working copy, if needed, will be created in the format corresponding
to the WC_FORMAT_VERSION of the client. If this parameter is NULL, the
- format from CTX->WC_CTX will be and an error will be returned if the format
- cannot be determined. The format of any existing working copy will remain
- unchanged.
+ format will be determined from context (see svn_wc__format_from_context).
+ 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.
diff --git a/subversion/libsvn_client/upgrade.c b/subversion/libsvn_client/upgrade.c
index f160ce9..a3ad8ab 100644
--- a/subversion/libsvn_client/upgrade.c
+++ b/subversion/libsvn_client/upgrade.c
@@ -192,10 +192,6 @@
{
int wc_format;
- /* A NULL wc_format_version translates to the default version. */
- if (!wc_format_version)
- wc_format_version = svn_client_supported_wc_version();
-
SVN_ERR(svn_wc__format_from_version(&wc_format,
wc_format_version,
scratch_pool));
diff --git a/subversion/libsvn_wc/deprecated.c b/subversion/libsvn_wc/deprecated.c
index 70a48c0..7fba81d 100644
--- a/subversion/libsvn_wc/deprecated.c
+++ b/subversion/libsvn_wc/deprecated.c
@@ -580,7 +580,7 @@
apr_pool_t *scratch_pool)
{
return svn_error_trace(
- svn_wc__ensure_adm(wc_ctx, SVN_WC__VERSION, local_abspath,
+ svn_wc__ensure_adm(wc_ctx, SVN_WC__DEFAULT_VERSION, local_abspath,
url, repos_root_url, repos_uuid, revision, depth,
scratch_pool));
}
@@ -4900,7 +4900,7 @@
void *notify_baton,
apr_pool_t *scratch_pool)
{
- return svn_wc__upgrade(wc_ctx, local_abspath, SVN_WC__VERSION,
+ return svn_wc__upgrade(wc_ctx, local_abspath, SVN_WC__DEFAULT_VERSION,
repos_info_func, repos_info_baton,
cancel_func, cancel_baton,
notify_func, notify_baton,
diff --git a/subversion/libsvn_wc/upgrade.c b/subversion/libsvn_wc/upgrade.c
index 5df6355..cfb8b36 100644
--- a/subversion/libsvn_wc/upgrade.c
+++ b/subversion/libsvn_wc/upgrade.c
@@ -1646,7 +1646,11 @@
const svn_version_t* version,
apr_pool_t *scratch_pool)
{
- SVN_ERR_ASSERT(version != NULL);
+ if (!version)
+ {
+ *format = SVN_WC__DEFAULT_VERSION;
+ return SVN_NO_ERROR;
+ }
if (version->major != SVN_VER_MAJOR || version->minor > SVN_VER_MINOR)
return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
diff --git a/subversion/libsvn_wc/wc.h b/subversion/libsvn_wc/wc.h
index 06181ca..e294486 100644
--- a/subversion/libsvn_wc/wc.h
+++ b/subversion/libsvn_wc/wc.h
@@ -173,6 +173,10 @@
whenever you change this value! */
#define SVN_WC__SUPPORTED_VERSION 31
+/* The default WC version that the Subversion library should create
+ * (or upgrade to) when not otherwise specified. */
+#define SVN_WC__DEFAULT_VERSION SVN_WC__SUPPORTED_VERSION
+
/* Formats <= this have no concept of "revert text-base/props". */
#define SVN_WC__NO_REVERT_FILES 4
diff --git a/subversion/libsvn_wc/wc_db_wcroot.c b/subversion/libsvn_wc/wc_db_wcroot.c
index 891578e..d092b58 100644
--- a/subversion/libsvn_wc/wc_db_wcroot.c
+++ b/subversion/libsvn_wc/wc_db_wcroot.c
@@ -1050,11 +1050,11 @@
apr_array_header_t *keys;
int index;
- /* Thsi is what we return if we don't find a concrete format version. */
+ /* This is what we return if we don't find a concrete format version. */
SVN_ERR(svn_hash_keys(&keys, dir_data, scratch_pool));
if (0 == keys->nelts)
{
- *format = SVN_WC__VERSION;
+ *format = SVN_WC__DEFAULT_VERSION;
return SVN_NO_ERROR;
}
diff --git a/subversion/tests/libsvn_wc/entries-compat.c b/subversion/tests/libsvn_wc/entries-compat.c
index 511f85d..b5d1bdc 100644
--- a/subversion/tests/libsvn_wc/entries-compat.c
+++ b/subversion/tests/libsvn_wc/entries-compat.c
@@ -602,7 +602,7 @@
{
const char *url, *repos_root_url, *repos_uuid;
const char *subdir = svn_dirent_join(local_abspath, "sub-wc", pool);
- int target_format = SVN_WC__VERSION;
+ int target_format;
const char *repos_relpath;
svn_boolean_t is_root;
@@ -613,9 +613,8 @@
url = svn_path_url_add_component2(repos_root_url, repos_relpath, pool);
SVN_ERR(svn_io_make_dir_recursively(subdir, pool));
- if (opts->wc_format_version)
- SVN_ERR(svn_wc__format_from_version(&target_format, opts->wc_format_version,
- pool));
+ SVN_ERR(svn_wc__format_from_version(&target_format, opts->wc_format_version,
+ pool));
SVN_ERR(svn_wc__ensure_adm(wc_ctx, target_format,
subdir,
svn_path_url_add_component2(url, "sub-wc", pool),
diff --git a/subversion/tests/libsvn_wc/utils.c b/subversion/tests/libsvn_wc/utils.c
index e2957b2..733f5c0 100644
--- a/subversion/tests/libsvn_wc/utils.c
+++ b/subversion/tests/libsvn_wc/utils.c
@@ -135,11 +135,10 @@
int i;
svn_sqlite__stmt_t *stmt;
const apr_int64_t wc_id = 1;
- int target_format = SVN_WC__VERSION;
+ int target_format;
- if (wc_format_version)
- SVN_ERR(svn_wc__format_from_version(&target_format, wc_format_version,
- scratch_pool));
+ SVN_ERR(svn_wc__format_from_version(&target_format, wc_format_version,
+ scratch_pool));
/* Allocate MY_STATEMENTS in RESULT_POOL because the SDB will continue to
* refer to it over its lifetime. */
diff --git a/subversion/tests/libsvn_wc/wc-queries-test.c b/subversion/tests/libsvn_wc/wc-queries-test.c
index 920ac58..7542a4d 100644
--- a/subversion/tests/libsvn_wc/wc-queries-test.c
+++ b/subversion/tests/libsvn_wc/wc-queries-test.c
@@ -158,11 +158,10 @@
{
sqlite3 *sdb;
int i;
- int target_format = SVN_WC__VERSION;
+ int target_format;
- if (opts->wc_format_version)
- SVN_ERR(svn_wc__format_from_version(&target_format, opts->wc_format_version,
- pool));
+ SVN_ERR(svn_wc__format_from_version(&target_format, opts->wc_format_version,
+ pool));
/* Create an in-memory raw database */
SVN_TEST_ASSERT(sqlite3_initialize() == SQLITE_OK);