Re: svn commit: r1898378 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_wc/ svn/ tests/cmdline/getopt_tests_data/

2022-02-25 Thread Daniel Shahaf
julianf...@apache.org wrote on Thu, Feb 24, 2022 at 15:58:11 -:
> Multi-WC-format: Clarify the supported versions display.
> 
> This patch:
> 
>   - Changes the APIs for querying the default WC format and the supported WC
> formats;
>   - clarifies the display of supported WC formats in 'svn --version'.
> 
> API changes:
> 
>   - Remove svn_client_supported_wc_version().
>   - Add svn_client_default_wc_version().
>   - Add svn_client_supported_wc_formats() and a type it returns.
> 

Looks good.  Just a few comments:

> CLI changes:
> 
>   Old display in 'svn --version':
> 
>   | Supported working copy (WC) versions: from 1.8 to 1.15
> 
>   New display in 'svn --version':
> 
>   | Supported working copy (WC) versions:
>   |
>   | * compatible with Subversion v1.8 to v1.15 (WC format 31)
>   | * compatible with Subversion v1.15 (WC format 32)

Nice!

> The list style, along with inclusion of the WC format number, helps show
> that each line describes a distinct format. Users sometimes also need to
> know about WC format numbers, and the 'version' command is an appropriate
> place to show these. The presentation style matches that used for the lists
> of RA modules and credential caches.
> 
> * subversion/include/svn_client.h,
>   subversion/libsvn_client/upgrade.c
>   (svn_client_checkout4,
>svn_client_upgrade2): Update doc string.
>   (svn_client_supported_wc_version): Remove.
>   (svn_client_default_wc_version,
>svn_client_wc_format_t,
>svn_client_supported_wc_formats): New.
> 
> * subversion/libsvn_client/checkout.c
>   (svn_client_checkout4): Update caller: use svn_client_default_wc_version().
> 
> * subversion/libsvn_wc/wc.h
>   (SVN_WC__SUPPORTED_VERSION): Update doc string.
> 
> * subversion/svn/help-cmd.c
>   (print_supported_wc_formats): New.
>   (svn_cl__help): Use it to display supported WC formats as a list.
> 
> * subversion/svn/svn.c
>   (parse_compatible_version): Update caller: use
> svn_client_supported_wc_formats().
> 
> * subversion/tests/cmdline/getopt_tests_data/svn--version_stdout,
>   subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout
> Update expected output.

> +++ subversion/trunk/subversion/include/svn_client.h Thu Feb 24 15:58:10 2022
> @@ -4428,13 +4428,40 @@ svn_client_upgrade(const char *wcroot_di
> apr_pool_t *scratch_pool);
>  
>  /**
> - * Returns the version related to the earliest supported
> + * Returns the version related to the library's default
>   * working copy metadata format.
>   *
>   * @since New in 1.15.
>   */
>  const svn_version_t *
> -svn_client_supported_wc_version(void);
> +svn_client_default_wc_version(apr_pool_t *result_pool);
> +
> +/**
> + * Information about a WC version.
> + *
> + * 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".

Missing @since.

Missing warning not to manually allocate structs of this type since
fields may be added in the future.

> + */
> +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;
> +
> +/**
> + * 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.

Missing @since.

> + */
> +const svn_client_wc_format_t *
> +svn_client_supported_wc_formats(apr_pool_t *result_pool,
> +apr_pool_t *scratch_pool);

> +++ subversion/trunk/subversion/libsvn_client/upgrade.c Thu Feb 24 15:58:10 
> 2022
> @@ -41,6 +41,7 @@
>  
>  #include "svn_private_config.h"
>  #include "private/svn_wc_private.h"
> +#include "../libsvn_wc/wc.h"

I don't think libsvn_client is allowed to use this header.

libsvn_foo/bar.h headers are for internal use by libsvn_foo, not for
interlibrary use; that would be include/private/.  We generally follow
this, too:

% grep -R 'include.*[.][.]/libsvn' subversion/lib* | grep -Eo '[<"].*[">]' | 
sort | uniq -c 
 14 "../../libsvn_fs/fs-loader.h"
  2 "../libsvn_delta/delta.h"
 53 "../libsvn_fs/fs-loader.h"
  1 "../libsvn_fs_base/fs_init.h"
  1 "../libsvn_fs_fs/fs_init.h"
  1 "../libsvn_fs_x/fs_init.h"
 24 "../libsvn_ra/ra_loader.h"
  3 "../libsvn_ra/wrapper_template.h"
% 

The RA/FS ones are presumably related to the pluggable design of those
layers.  (Sorry, I haven't got time to confirm this in detail.)

The delta.h one is in FSFS/FSX, which, as the comment there claims, use
SVN_DELTA_WINDOW_SIZE and nothing else declared or #define'd in that

svn commit: r1898378 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_wc/ svn/ tests/cmdline/getopt_tests_data/

2022-02-24 Thread julianfoad
Author: julianfoad
Date: Thu Feb 24 15:58:10 2022
New Revision: 1898378

URL: http://svn.apache.org/viewvc?rev=1898378=rev
Log:
Multi-WC-format: Clarify the supported versions display.

This patch:

  - Changes the APIs for querying the default WC format and the supported WC
formats;
  - clarifies the display of supported WC formats in 'svn --version'.

API changes:

  - Remove svn_client_supported_wc_version().
  - Add svn_client_default_wc_version().
  - Add svn_client_supported_wc_formats() and a type it returns.

CLI changes:

  Old display in 'svn --version':

  | Supported working copy (WC) versions: from 1.8 to 1.15

  New display in 'svn --version':

  | Supported working copy (WC) versions:
  |
  | * compatible with Subversion v1.8 to v1.15 (WC format 31)
  | * compatible with Subversion v1.15 (WC format 32)

The list style, along with inclusion of the WC format number, helps show
that each line describes a distinct format. Users sometimes also need to
know about WC format numbers, and the 'version' command is an appropriate
place to show these. The presentation style matches that used for the lists
of RA modules and credential caches.

* subversion/include/svn_client.h,
  subversion/libsvn_client/upgrade.c
  (svn_client_checkout4,
   svn_client_upgrade2): Update doc string.
  (svn_client_supported_wc_version): Remove.
  (svn_client_default_wc_version,
   svn_client_wc_format_t,
   svn_client_supported_wc_formats): New.

* subversion/libsvn_client/checkout.c
  (svn_client_checkout4): Update caller: use svn_client_default_wc_version().

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

* subversion/svn/help-cmd.c
  (print_supported_wc_formats): New.
  (svn_cl__help): Use it to display supported WC formats as a list.

* subversion/svn/svn.c
  (parse_compatible_version): Update caller: use
svn_client_supported_wc_formats().

* subversion/tests/cmdline/getopt_tests_data/svn--version_stdout,
  subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout
Update expected output.

Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_client/checkout.c
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/svn.c

subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout

subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--version_stdout

Modified: subversion/trunk/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1898378=1898377=1898378=diff
==
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Feb 24 15:58:10 2022
@@ -1243,8 +1243,8 @@ svn_client_args_to_target_array(apr_arra
  * @param[in] wc_format_version is the version number of the Subversion
  *  client that supports the metadata format of the
  *  created working copy; @c NULL means the library's default
- *  format. The earliest supported version is returned by
- *  svn_client_supported_wc_version().
+ *  format. See svn_client_default_wc_version(),
+ *  svn_client_supported_wc_formats().
  * @param[in] ctx   The standard client context, used for authentication and
  *  notification.
  * @param[in] pool  Used for any temporary allocation.
@@ -4401,8 +4401,8 @@ 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. The earliest supported version is returned by
- * svn_client_supported_wc_version().
+ * default format. See svn_client_default_wc_version(),
+ * svn_client_supported_wc_formats().
  *
  * Use @a scratch_pool for any temporary allocations.
  *
@@ -4428,13 +4428,40 @@ svn_client_upgrade(const char *wcroot_di
apr_pool_t *scratch_pool);
 
 /**
- * Returns the version related to the earliest supported
+ * Returns the version related to the library's default
  * working copy metadata format.
  *
  * @since New in 1.15.
  */
 const svn_version_t *
-svn_client_supported_wc_version(void);
+svn_client_default_wc_version(apr_pool_t *result_pool);
+
+/**
+ * Information about a WC version.
+ *
+ * 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".
+ */
+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;
+