Author: julianfoad
Date: Wed Mar  2 12:24:40 2022
New Revision: 1898525

URL: http://svn.apache.org/viewvc?rev=1898525&view=rev
Log:
Multi-WC-format: clean up some client APIs.

* subversion/include/svn_client.h,
  subversion/libsvn_client/upgrade.c
  (svn_client_wc_format_t): Delete.
  (svn_client_get_wc_formats_supported): New, simpler replacement for...
  (svn_client_supported_wc_formats): ... this, now removed.
  (svn_client_wc_version_from_format): Rename from
    'svn_client__wc_version_from_format' to be a public API; remove a
    scratch-pool argument that was likely to be of net negative value.

* subversion/libsvn_wc/wc.h
  (SVN_WC__SUPPORTED_VERSION): Update comment.

* subversion/svn/help-cmd.c
  (print_supported_wc_formats): Update callers.

* subversion/svn/info-cmd.c
  (print_info_item): Update callers.

* subversion/svn/svn.c
  (parse_compatible_version): Update callers.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/upgrade.c
    subversion/trunk/subversion/libsvn_wc/wc.h
    subversion/trunk/subversion/svn/help-cmd.c
    subversion/trunk/subversion/svn/info-cmd.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=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Mar  2 12:24:40 2022
@@ -1244,7 +1244,7 @@ svn_client_args_to_target_array(apr_arra
  *              client that supports the metadata format of the
  *              created working copy; @c NULL means the library's default
  *              format. See svn_client_default_wc_version(),
- *              svn_client_supported_wc_formats().
+ *              svn_client_get_wc_formats_supported().
  * @param[in] ctx   The standard client context, used for authentication and
  *              notification.
  * @param[in] pool  Used for any temporary allocation.
@@ -4402,7 +4402,7 @@ svn_client_cleanup(const char *dir,
  * @a wc_format_version is the version number of the Subversion client
  * that supports a given WC metadata format; @c NULL means the library's
  * default format. See svn_client_default_wc_version(),
- * svn_client_supported_wc_formats().
+ * svn_client_get_wc_formats_supported().
  *
  * Use @a scratch_pool for any temporary allocations.
  *
@@ -4446,24 +4446,16 @@ const svn_version_t *
 svn_client_latest_wc_version(apr_pool_t *result_pool);
 
 /**
- * Information about a WC version.
+ * Returns a list of the WC formats supported by the client library.
  *
- * Only the @c .major and @c .minor version fields are significant: so a
- * version_max value of 1.15.0 for example means "up to 1.15.x".
+ * The list is sorted from oldest to newest, and terminated by a zero entry.
  *
- * @warning Do not manually allocate structs of this type, as fields may
- * be added in the future.
+ * The result is allocated in @a result_pool and/or statically.
  *
  * @since New in 1.15.
  */
-typedef struct svn_client_wc_format_t {
-    /* Oldest version of svn libraries known to support this WC version */
-    const svn_version_t *version_min;
-    /* Newest version of svn libraries known to support this WC version. */
-    const svn_version_t *version_max;
-    /* The WC format number of this format, as defined by libsvn_wc. */
-    int wc_format;
-} svn_client_wc_format_t;
+const int *
+svn_client_get_wc_formats_supported(apr_pool_t *result_pool);
 
 /** Return the version of the Subversion library that first supported
  * the given WC format, @a wc_format.
@@ -4471,23 +4463,8 @@ typedef struct svn_client_wc_format_t {
  * @since New in 1.15.
  */
 const svn_version_t *
-svn_client__wc_version_from_format(int wc_format,
-                                   apr_pool_t *result_pool,
-                                   apr_pool_t *scratch_pool);
-
-/**
- * Returns a list of the WC formats supported by the client library.
- *
- * The list is sorted from oldest to newest, and terminated by an entry
- * containing all null/zero fields.
- *
- * The returned data are allocated in @a result_pool and/or statically.
- *
- * @since New in 1.15.
- */
-const svn_client_wc_format_t *
-svn_client_supported_wc_formats(apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool);
+svn_client_wc_version_from_format(int wc_format,
+                                  apr_pool_t *result_pool);
 
 /** @} */
 

Modified: subversion/trunk/subversion/libsvn_client/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/upgrade.c?rev=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_client/upgrade.c Wed Mar  2 12:24:40 2022
@@ -201,9 +201,8 @@ svn_client_upgrade2(const char *path,
 }
 
 const svn_version_t *
-svn_client__wc_version_from_format(int wc_format,
-                                   apr_pool_t *result_pool,
-                                   apr_pool_t *scratch_pool)
+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 },
@@ -227,17 +226,15 @@ svn_client__wc_version_from_format(int w
   return NULL;
 }
 
-const svn_client_wc_format_t *
-svn_client_supported_wc_formats(apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool)
+const int *
+svn_client_get_wc_formats_supported(apr_pool_t *result_pool)
 {
-  static const svn_version_t version_1_8 = { 1, 8, 0, NULL };
-  static const svn_version_t version_1_15 = { 1, 15, 0, NULL };
-  static const svn_client_wc_format_t versions[] = {
-    { &version_1_8,   &version_1_15,  SVN_WC__SUPPORTED_VERSION },
-    { &version_1_15,  &version_1_15,  SVN_WC__VERSION           },
-    { NULL,           NULL,           0 }
+  static const int versions[] = {
+    SVN_WC__SUPPORTED_VERSION,
+    SVN_WC__VERSION,
+    0
   };
+
   return versions;
 }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Wed Mar  2 12:24:40 2022
@@ -170,7 +170,7 @@ extern "C" {
 
 /* The minimum WC version supported by the client.
    IMPORTANT: Update the implementation of svn_client_default_wc_version()
-              and svn_client_supported_wc_formats()
+              and svn_client_get_wc_formats_supported()
               whenever you change this value! */
 #define SVN_WC__SUPPORTED_VERSION 31
 

Modified: subversion/trunk/subversion/svn/help-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/help-cmd.c?rev=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/help-cmd.c (original)
+++ subversion/trunk/subversion/svn/help-cmd.c Wed Mar  2 12:24:40 2022
@@ -47,19 +47,18 @@ print_supported_wc_formats(svn_stringbuf
                            const char *prefix,
                            apr_pool_t *pool)
 {
-  const svn_client_wc_format_t *wc_formats
-    = svn_client_supported_wc_formats(pool, pool);
+  const int *wc_formats = svn_client_get_wc_formats_supported(pool);
   int i;
 
-  for (i = 0; wc_formats[i].version_min; i++)
+  for (i = 0; wc_formats[i]; i++)
     {
-      const svn_client_wc_format_t *v = &wc_formats[i];
-      const svn_version_t *ver = v->version_min;
+      const svn_version_t *ver
+        = svn_client_wc_version_from_format(wc_formats[i], pool);
       const char *s
         = apr_psprintf(
             pool,
             _("%sWC format %d, compatible with Subversion v%d.%d and newer\n"),
-            prefix, v->wc_format, ver->major, ver->minor);
+            prefix, wc_formats[i], ver->major, ver->minor);
 
       svn_stringbuf_appendcstr(output, s);
     }

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Wed Mar  2 12:24:40 2022
@@ -1254,8 +1254,7 @@ print_info_item(void *baton,
     case info_item_wc_compatible_version:
       {
         const svn_version_t *wc_ver
-          = svn_client__wc_version_from_format(info->wc_info->wc_format,
-                                               pool, pool);
+          = svn_client_wc_version_from_format(info->wc_info->wc_format, pool);
         const char *s = apr_psprintf(pool, "%d.%d",
                                      wc_ver->major,
                                      wc_ver->minor);

Modified: subversion/trunk/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1898525&r1=1898524&r2=1898525&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Wed Mar  2 12:24:40 2022
@@ -2039,12 +2039,10 @@ parse_compatible_version(svn_cl__opt_sta
   const char *utf8_opt_arg;
   svn_version_t *target;
 
-  /* Get the supported WC formats.  WC formats are always defined by a X.Y.0
-     release, and svn_client_supported_wc_formats() should return such
-     a value. */
-  const svn_client_wc_format_t *formats_supported
-    = svn_client_supported_wc_formats(result_pool, result_pool);
-  const svn_version_t *supported = formats_supported[0].version_min;
+  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};
 


Reply via email to