Author: brane
Date: Tue Sep 12 14:10:16 2017
New Revision: 1808118

URL: http://svn.apache.org/viewvc?rev=1808118&view=rev
Log:
On the better-pristines branch: Inject some sanity into the new
svn_client_upgrade2() funcction. To whit, use our existing svn_version_t
struct as the target WC version parameter instead of a string.

* subversion/include/svn_client.h
  (svn_client_upgrade2): Change type of wc_format_version to svn_version_t*.
  (svn_client_supported_wc_version): Return svn_version_t* instead of a string.
* subversion/libsvn_client/upgrade.c: Include svn_version.h.
  (svn_client_upgrade2): Update implementation.
  (svn_client_supported_wc_version): Likewise.

* subversion/include/private/svn_wc_private.h
  (svn_wc__format_from_version): Renamed from svn_wc__format_from_version_string
   and takes a svn_version_t* parameter instead of a string.
* subversion/libsvn_wc/upgrade.c
  (svn_wc__format_from_version): Update implementation.

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

Modified:
    
subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
    subversion/branches/better-pristines/subversion/include/svn_client.h
    subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c
    subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c
    subversion/branches/better-pristines/subversion/svn/svn.c

Modified: 
subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h?rev=1808118&r1=1808117&r2=1808118&view=diff
==============================================================================
--- 
subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
 (original)
+++ 
subversion/branches/better-pristines/subversion/include/private/svn_wc_private.h
 Tue Sep 12 14:10:16 2017
@@ -2075,17 +2075,17 @@ svn_wc__translated_stream(svn_stream_t *
 
 
 /**
- * Convert @a version, a string representation of a version number, to
- * that version's characteristic working copy format, returned in @a
- * format.
+ * Convert @a version to that version's characteristic working copy
+ * format, returned in @a format.
  *
  * Use @a scratch_pool for temporary allocations.
  *
  * @since New in 1.10.
  */
 svn_error_t *
-svn_wc__format_from_version_string(int *format, const char* version,
-                                   apr_pool_t *scratch_pool);
+svn_wc__format_from_version(int *format,
+                            const svn_version_t* version,
+                            apr_pool_t *scratch_pool);
 
 /**
  * Upgrade the working copy at @a local_abspath to the metadata

Modified: subversion/branches/better-pristines/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/svn_client.h?rev=1808118&r1=1808117&r2=1808118&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/svn_client.h 
(original)
+++ subversion/branches/better-pristines/subversion/include/svn_client.h Tue 
Sep 12 14:10:16 2017
@@ -4218,7 +4218,7 @@ svn_client_cleanup(const char *dir,
  */
 svn_error_t *
 svn_client_upgrade2(const char *wcroot_dir,
-                    const char* wc_format_version,
+                    const svn_version_t *wc_format_version,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *scratch_pool);
 
@@ -4239,7 +4239,7 @@ svn_client_upgrade(const char *wcroot_di
  * Returns the version string related to the earliest supported
  * working copy metadata format.
  */
-const char *
+const svn_version_t *
 svn_client_supported_wc_version(void);
 
 /** @} */

Modified: 
subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c?rev=1808118&r1=1808117&r2=1808118&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c 
(original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c Tue 
Sep 12 14:10:16 2017
@@ -34,8 +34,10 @@
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 #include "svn_pools.h"
-#include "client.h"
 #include "svn_props.h"
+#include "svn_version.h"
+
+#include "client.h"
 
 #include "svn_private_config.h"
 #include "private/svn_wc_private.h"
@@ -184,25 +186,26 @@ upgrade_internal(const char *path,
 
 svn_error_t *
 svn_client_upgrade2(const char *path,
-                    const char *wc_format_version,
+                    const svn_version_t *wc_format_version,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *scratch_pool)
 {
   int wc_format;
 
-  SVN_ERR(svn_wc__format_from_version_string(&wc_format,
-                                             wc_format_version,
-                                             scratch_pool));
+  SVN_ERR(svn_wc__format_from_version(&wc_format,
+                                      wc_format_version,
+                                      scratch_pool));
   SVN_ERR(upgrade_internal(path, wc_format, ctx, scratch_pool));
   return SVN_NO_ERROR;
 }
 
-const char *
+const svn_version_t *
 svn_client_supported_wc_version(void)
 {
   /* NOTE: For consistency, always return the version of the client
      that first introduced the earliest supported format. */
-  return "1.8";
+  static const svn_version_t version = { 1, 8, 0, NULL };
+  return &version;
 }
 
 /* Helper for upgrade_externals_from_properties: upgrades one external ITEM

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c?rev=1808118&r1=1808117&r2=1808118&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c 
(original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c Tue Sep 
12 14:10:16 2017
@@ -1642,11 +1642,11 @@ svn_wc__version_string_from_format(int w
 }
 
 svn_error_t *
-svn_wc__format_from_version_string(int *format,
-                                   const char *version_string,
-                                   apr_pool_t *scratch_pool)
+svn_wc__format_from_version(int *format,
+                            const svn_version_t* version,
+                            apr_pool_t *scratch_pool)
 {
-  /* TODO: Parse VERSION_STRING to get *FORMAT */
+  /* TODO: Convert VERSION to *FORMAT */
   *format = SVN_WC__VERSION;
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/better-pristines/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/svn/svn.c?rev=1808118&r1=1808117&r2=1808118&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/svn/svn.c (original)
+++ subversion/branches/better-pristines/subversion/svn/svn.c Tue Sep 12 
14:10:16 2017
@@ -1939,21 +1939,18 @@ parse_compatible_version(svn_cl__opt_sta
                          apr_pool_t *result_pool)
 {
   const char *utf8_opt_arg;
-  svn_version_t *supported;
   svn_version_t *target;
 
-  /* Compute the the latest supported version from the current
-     libsvn_client version. WC formats are always defined by a
-     X.Y.0 release. */
+  /* Get the the latest and oldest supported version from the current
+     libsvn_client versions. WC formats are always defined by a X.Y.0
+     release, and svn_client_supported_wc_version() should return such
+     a value. */
+  const svn_version_t *supported = svn_client_supported_wc_version();
   const svn_version_t *current = svn_client_version();
   const svn_version_t latest = {current->major, current->minor, 0, NULL};
 
-  /* Parse the earliest supported version.
-     Double check that the numbers ars sane. */
-  SVN_ERR(svn_version__parse_version_string(
-              &supported,
-              svn_client_supported_wc_version(),
-              result_pool));
+  /* 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,


Reply via email to