You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2022/03/02 12:48:05 UTC

svn commit: r1898526 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/upgrade.c svn/svn.c

Author: julianfoad
Date: Wed Mar  2 12:48:05 2022
New Revision: 1898526

URL: http://svn.apache.org/viewvc?rev=1898526&view=rev
Log:
Multi-WC-format: simplify client APIs.

* subversion/include/svn_client.h,
  subversion/libsvn_client/upgrade.c
  (svn_client_oldest_wc_version): New.

* subversion/svn/svn.c
  (parse_compatible_version): Use it.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/upgrade.c
    subversion/trunk/subversion/svn/svn.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1898526&r1=1898525&r2=1898526&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Mar  2 12:48:05 2022
@@ -4428,6 +4428,15 @@ svn_client_upgrade(const char *wcroot_di
                    apr_pool_t *scratch_pool);
 
 /**
+ * Returns the first version that supported the library's oldest
+ * working copy metadata format.
+ *
+ * @since New in 1.15.
+ */
+const svn_version_t *
+svn_client_oldest_wc_version(apr_pool_t *result_pool);
+
+/**
  * Returns the first version that supported the library's default
  * working copy metadata format.
  *

Modified: subversion/trunk/subversion/libsvn_client/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/upgrade.c?rev=1898526&r1=1898525&r2=1898526&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_client/upgrade.c Wed Mar  2 12:48:05 2022
@@ -239,6 +239,15 @@ 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_version_t *
 svn_client_default_wc_version(apr_pool_t *result_pool)
 {
   /* NOTE: For consistency, always return the version of the client

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1898526&r1=1898525&r2=1898526&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Wed Mar  2 12:48:05 2022
@@ -2039,19 +2039,14 @@ parse_compatible_version(svn_cl__opt_sta
   const char *utf8_opt_arg;
   svn_version_t *target;
 
-  const int *formats_supported
-    = svn_client_get_wc_formats_supported(result_pool);
-  const svn_version_t *supported
-    = svn_client_wc_version_from_format(formats_supported[0], result_pool);
-  const svn_version_t *current = svn_client_version();
-  const svn_version_t latest = {current->major, current->minor, 0, NULL};
-
-  /* Double check that the oldest supported version is sane. */
-  SVN_ERR_ASSERT(supported->patch == 0);
-  SVN_ERR_ASSERT(svn_version__at_least(&latest,
-                                       supported->major,
-                                       supported->minor,
-                                       supported->patch));
+  const svn_version_t *oldest = svn_client_oldest_wc_version(result_pool);
+  const svn_version_t *latest = svn_client_latest_wc_version(result_pool);
+
+  /* Double check that the oldest and latest versions are sane. */
+  SVN_ERR_ASSERT(oldest->patch == 0);
+  SVN_ERR_ASSERT(latest->patch == 0);
+  SVN_ERR_ASSERT(svn_version__at_least(latest,
+                                       oldest->major, oldest->minor, 0));
 
   /* Parse the requested version. */
   SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, result_pool));
@@ -2061,30 +2056,28 @@ parse_compatible_version(svn_cl__opt_sta
   target->patch = 0;
   target->tag = NULL;
 
-  /* Check the earliest supported version. */
+  /* Check the oldest supported version. */
   if (!svn_version__at_least(target,
-                             supported->major,
-                             supported->minor,
-                             supported->patch))
+                             oldest->major, oldest->minor, 0))
     {
       return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                                _("Cannot make working copies compatible "
                                  "with the requested version %d.%d; "
                                  "the oldest supported version is %d.%d"),
                                target->major, target->minor,
-                               supported->major, supported->minor);
+                               oldest->major, oldest->minor);
     }
 
   /* Check the latest supported version. */
-  if (!svn_version__at_least(&latest,
-                             target->major, target->minor, target->patch))
+  if (!svn_version__at_least(latest,
+                             target->major, target->minor, 0))
     {
       return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                                _("Cannot guarantee working copy compatibility "
                                  "with the requested version %d.%d; "
                                  "the latest supported version is %d.%d"),
                                target->major, target->minor,
-                               latest.major, latest.minor);
+                               latest->major, latest->minor);
     }
 
   opt_state->compatible_version = target;