Author: brane
Date: Wed Jan 14 19:42:39 2026
New Revision: 1931325
Log:
Cherry-pick r1931314 from the better-pristines branch, removing the parts
dealing with WC format 33 that don't belong on trunk.
Original log message:
> On the better-pristines branch: Move all knowledge of mapping between
> working copy formats and Subversion versions into libsvn_wc. Having them
> in two places was slightly unmaintainable if the format numberw changed.
* subversion/include/private/svn_wc_private.h: Include svn_version.h.
(svn_wc__version_string_from_format): Update the docstring.
(svn_wc__version_info_t,
svn_wc__version_info_from_format): New.
* subversion/libsvn_wc/wc.h
(SVN_WC__VERSION): Note dependents in the docstring.
(SVN_WC__SUPPORTED_VERSION): Likewise.
* subversion/libsvn_wc/upgrade.c
(version_info_null..version_info_1_15): New constants with version
strings and related version numbers.
(svn_wc__version_info_from_format): This is the single format->version
mapping, using the new version_info_* static data.
(svn_wc__version_string_from_format): Use the info returned by
svn_wc__version_info_from_format().
* subversion/libsvn_client/upgrade.c
(svn_client_wc_version_from_format): Delete the local version mapping
and use svn_wc__version_info_from_format() instead.
(svn_client_oldest_wc_version,
svn_client_default_wc_version,
svn_client_latest_wc_version,
svn_client__compatible_wc_version_optional_pristine): Use the data
returned by svn_wc__version_info_from_format(), instead of hard-
coded, copy-pasted versions. This eliminates the need to update
these functions when supported format numbers change.
Modified:
subversion/trunk/ (props changed)
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/upgrade.c
subversion/trunk/subversion/libsvn_wc/upgrade.c
subversion/trunk/subversion/libsvn_wc/wc.h
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h Wed Jan 14 18:40:36 2026 (r1931324)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Jan 14 19:42:39 2026 (r1931325)
@@ -39,6 +39,7 @@
#include "svn_subst.h"
#include "svn_types.h"
+#include "svn_version.h"
#include "svn_wc.h"
#include "private/svn_diff_tree.h"
@@ -2200,10 +2201,27 @@ svn_wc__format_from_version(int *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. */
+ * should be easily found when it does need to be updated.
+ *
+ * ### However, it's even less ideal to have this sort of knowledge
+ * in two places, both libsvn_wc and libsvn_client. Therefores, since
+ * libsvn_wc needs this info, we'll keep it there.
+ */
const char *
svn_wc__version_string_from_format(int wc_format);
+/* As above, but return a tuple containing the string and an
+ svn_version_t. If the returned tuple has a NULL string, the
+ format is not known. */
+typedef struct svn_wc__version_info svn_wc__version_info_t;
+struct svn_wc__version_info
+{
+ const char *text;
+ svn_version_t version;
+};
+const svn_wc__version_info_t *
+svn_wc__version_info_from_format(int wc_format);
+
/**
* Return true iff @a format is a supported format.
*/
Modified: subversion/trunk/subversion/libsvn_client/upgrade.c
==============================================================================
--- subversion/trunk/subversion/libsvn_client/upgrade.c Wed Jan 14 18:40:36 2026 (r1931324)
+++ subversion/trunk/subversion/libsvn_client/upgrade.c Wed Jan 14 19:42:39 2026 (r1931325)
@@ -251,26 +251,14 @@ const svn_version_t *
svn_client_wc_version_from_format(int wc_format,
apr_pool_t *result_pool)
{
- static const svn_version_t
- version_1_0 = { 1, 0, 0, NULL },
- version_1_4 = { 1, 4, 0, NULL },
- version_1_5 = { 1, 5, 0, NULL },
- version_1_6 = { 1, 6, 0, NULL },
- version_1_7 = { 1, 7, 0, NULL },
- version_1_8 = { 1, 8, 0, NULL },
- version_1_15 = { 1, 15, 0, NULL };
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(wc_format);
- switch (wc_format)
- {
- case 4: return &version_1_0;
- case 8: return &version_1_4;
- case 9: return &version_1_5;
- case 10: return &version_1_6;
- case 29: return &version_1_7;
- case 31: return &version_1_8;
- case 32: return &version_1_15;
- }
- return NULL;
+ /* NOTE: This can be the "null" version "0.0.0" and that's an
+ unrecoverable programming error. */
+ SVN_ERR_ASSERT_NO_RETURN(version_info->text != NULL);
+
+ return &version_info->version;
}
const int *
@@ -288,10 +276,13 @@ svn_client_get_wc_formats_supported(apr_
const svn_version_t *
svn_client_oldest_wc_version(apr_pool_t *result_pool)
{
- /* NOTE: For consistency, always return the version of the client
- that first introduced the format. */
- static const svn_version_t version = { 1, 8, 0, NULL };
- return &version;
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(SVN_WC__SUPPORTED_VERSION);
+
+ /* See note in svn_client_wc_version_from_format(), above. */
+ SVN_ERR_ASSERT_NO_RETURN(version_info->text != NULL);
+
+ return &version_info->version;
}
svn_error_t *
@@ -302,7 +293,7 @@ svn_client_default_wc_version(const svn_
{
svn_config_t *config;
const char *value;
- svn_version_t *version;
+ const svn_version_t *version;
if (ctx->config)
config = svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_CONFIG);
@@ -315,17 +306,19 @@ svn_client_default_wc_version(const svn_
NULL);
if (value)
{
- SVN_ERR(svn_version__parse_version_string(&version, value, result_pool));
+ svn_version_t *mutable;
+ SVN_ERR(svn_version__parse_version_string(&mutable, value, result_pool));
+ version = mutable;
}
else
{
- /* NOTE: For consistency, always return the version of the client
- that first introduced the format. */
- version = apr_pcalloc(result_pool, sizeof(*version));
- version->major = 1;
- version->minor = 8;
- version->patch = 0;
- version->tag = NULL;
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(SVN_WC__SUPPORTED_VERSION);
+
+ /* See note in svn_client_wc_version_from_format(), above. */
+ SVN_ERR_ASSERT(version_info->text != NULL);
+
+ version = &version_info->version;
}
*version_p = version;
@@ -335,19 +328,25 @@ svn_client_default_wc_version(const svn_
const svn_version_t *
svn_client_latest_wc_version(apr_pool_t *result_pool)
{
- /* NOTE: For consistency, always return the version of the client
- that first introduced the format. */
- static const svn_version_t version = { 1, 15, 0, NULL };
- return &version;
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(SVN_WC__VERSION);
+
+ /* See note in svn_client_wc_version_from_format(), above. */
+ SVN_ERR_ASSERT_NO_RETURN(version_info->text != NULL);
+
+ return &version_info->version;
}
const svn_version_t *
svn_client__compatible_wc_version_optional_pristine(apr_pool_t *result_pool)
{
- /* NOTE: For consistency, always return the version of the client
- that first introduced the format. */
- static const svn_version_t version = { 1, 15, 0, NULL };
- return &version;
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(SVN_WC__HAS_OPTIONAL_PRISTINE);
+
+ /* See note in svn_client_wc_version_from_format(), above. */
+ SVN_ERR_ASSERT_NO_RETURN(version_info->text != NULL);
+
+ return &version_info->version;
}
/* Helper for upgrade_externals_from_properties: upgrades one external ITEM
Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c Wed Jan 14 18:40:36 2026 (r1931324)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Wed Jan 14 19:42:39 2026 (r1931325)
@@ -1624,23 +1624,47 @@ upgrade_to_wcng(void **dir_baton,
return SVN_NO_ERROR;
}
-const char *
-svn_wc__version_string_from_format(int wc_format)
+static const svn_wc__version_info_t
+ version_info_null = { NULL , { 0, 0, 0, NULL }},
+ version_info_1_0 = {"<=1.3", { 1, 0, 0, NULL }},
+ version_info_1_4 = { "1.4", { 1, 4, 0, NULL }},
+ version_info_1_5 = { "1.5", { 1, 5, 0, NULL }},
+ version_info_1_6 = { "1.6", { 1, 6, 0, NULL }},
+ version_info_1_7 = { "1.7", { 1, 7, 0, NULL }},
+ version_info_1_8 = { "1.8", { 1, 8, 0, NULL }},
+ version_info_1_15 = { "1.15", { 1, 15, 0, NULL }};
+
+const svn_wc__version_info_t *
+svn_wc__version_info_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";
- case SVN_WC__WC_NG_VERSION: return "1.7";
- case 29: return "1.7";
- case 31: return "1.8";
- case 32: return "1.15";
+ case 4: return &version_info_1_0;
+ case 8: return &version_info_1_4;
+ case 9: return &version_info_1_5;
+ case 10: return &version_info_1_6;
+ case SVN_WC__WC_NG_VERSION: return &version_info_1_7;
+ case 29: return &version_info_1_7;
+ case 31: return &version_info_1_8;
+ case 32: return &version_info_1_15;
}
+ return &version_info_null;
+}
+
+const char *
+svn_wc__version_string_from_format(int wc_format)
+{
+ const svn_wc__version_info_t *const version_info =
+ svn_wc__version_info_from_format(wc_format);
+
+ if (version_info->text != NULL)
+ return version_info->text;
+
return _("(unreleased development version)");
}
+
svn_error_t *
svn_wc__format_from_version(int *format,
const svn_version_t* version,
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h Wed Jan 14 18:40:36 2026 (r1931324)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Wed Jan 14 19:42:39 2026 (r1931325)
@@ -174,16 +174,16 @@ extern "C" {
*
* @see svn_wc__max_supported_format()
*/
+/* IMPORTANT: Update SVN_WC__VERSIONS_ALSO_RAN (below)
+ and svntest.main.wc_format()
+ whenever you change this value! */
#define SVN_WC__VERSION 32
/* The minimum WC version supported by the client.
*
* @see svn_wc__min_supported_format()
*/
-/* IMPORTANT: Update the implementation of svn_client_default_wc_version()
- and svn_client_get_wc_formats_supported()
- and svntest.main.wc_format()
- whenever you change this value! */
+/* IMPORTANT: See IMPORTANT at SVN_WC__VERSION (above). */
#define SVN_WC__SUPPORTED_VERSION 31
/* The default WC version that the Subversion library should create
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.