Author: brane
Date: Thu Sep  7 09:53:56 2017
New Revision: 1807576

URL: http://svn.apache.org/viewvc?rev=1807576&view=rev
Log:
On the better-pristines branch: Minor improvements to docs and API.

* subversion/include/svn_version.h
  (SVN_VERSION_SUPPORTED_WC_FORMAT): Remove.
* subversion/include/svn_client.h
  (svn_client_upgrade2): Update docstring.
  (svn_client_upgrade): Return the @since tag and update the deprecation tag.
  (svn_client_supported_wc_version): New prototype.
* subversion/include/svn_wc.h
  (svn_wc_upgrade): Return the @since tag and update the deprecation tag.
* subversion/libsvn_client/upgrade.c
  (svn_client_upgrade2): Wrap call to upgrade_internal into SVN_ERR().
  (svn_client_supported_wc_version): Implement.
* subversion/libsvn_wc/upgrade.c
  (svn_wc__update_schema): Use a temporary macro for the upgrade cases.
   Verify that the working copy was upgraded to the target_format.

* subversion/libsvn_wc/wc.h
  (SVN_WC__SUPPORTED_VERSION): Add link to svn_client_supported_wc_version().

Suggested by: danielsh

Modified:
    subversion/branches/better-pristines/subversion/include/svn_client.h
    subversion/branches/better-pristines/subversion/include/svn_version.h
    subversion/branches/better-pristines/subversion/include/svn_wc.h
    subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c
    subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c
    subversion/branches/better-pristines/subversion/libsvn_wc/wc.h

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=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/svn_client.h 
(original)
+++ subversion/branches/better-pristines/subversion/include/svn_client.h Thu 
Sep  7 09:53:56 2017
@@ -4202,15 +4202,15 @@ svn_client_cleanup(const char *dir,
  */
 
 /**
- * Recursively upgrade a working copy from any older format to the
- * given WC metadata storage format.  @a wcroot_dir is the path to the
- * WC root.
+ * Recursively upgrade a working copy and nested externals working
+ * copies from any older format to the given WC metadata storage
+ * format.  @a wcroot_dir is the path to the WC root.
  *
  * @a wc_format_version is version number of the Subversion client
  * that supports a given WC metadata format; @c NULL means the newest
  * supported format. Any other value must be a string representing a
  * version number, e.g., "1.8" or "1.9.3". The earliest supported
- * version is defined by #SVN_VERSION_SUPPORTED_WC_FORMAT.
+ * version is returned by svn_client_supported_wc_version().
  *
  * Use @a scratch_pool for any temporary allocations.
  *
@@ -4226,7 +4226,8 @@ svn_client_upgrade2(const char *wcroot_d
  * Like svn_client_upgrade2(), but always upgrades to the newest
  * supported format.
  *
- * @deprecated Provided for backward compatibility with the 1.7 API.
+ * @since New in 1.7
+ * @deprecated Provided for backward compatibility with the 1.9 API.
  */
 SVN_DEPRECATED
 svn_error_t *
@@ -4234,6 +4235,12 @@ svn_client_upgrade(const char *wcroot_di
                    svn_client_ctx_t *ctx,
                    apr_pool_t *scratch_pool);
 
+/**
+ * Returns the version string related to the earliest supported
+ * working copy metadata format.
+ */
+const char *
+svn_client_supported_wc_version(void);
 
 /** @} */
 

Modified: subversion/branches/better-pristines/subversion/include/svn_version.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/svn_version.h?rev=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/svn_version.h 
(original)
+++ subversion/branches/better-pristines/subversion/include/svn_version.h Thu 
Sep  7 09:53:56 2017
@@ -133,13 +133,6 @@ extern "C" {
 /** Complete version string */
 #define SVN_VERSION        SVN_VER_NUMBER SVN_VER_TAG
 
-
-/**
- * Earliest supported working copy version.
- * @since New in 1.10.
- */
-#define SVN_VERSION_SUPPORTED_WC_FORMAT "1.8.0"
-
 
 /* Version queries and compatibility checks */
 

Modified: subversion/branches/better-pristines/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/include/svn_wc.h?rev=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/include/svn_wc.h (original)
+++ subversion/branches/better-pristines/subversion/include/svn_wc.h Thu Sep  7 
09:53:56 2017
@@ -7447,7 +7447,8 @@ typedef svn_error_t * (*svn_wc_upgrade_g
  * repository uuid, @a repos_info_func (if non-NULL) will be called
  * with @a repos_info_baton to provide the missing information.
  *
- * @deprecated Provided for backward compatibility with the 1.7 API.
+ * @since New in 1.7
+ * @deprecated Provided for backward compatibility with the 1.9 API.
  */
 SVN_DEPRECATED
 svn_error_t *

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=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c 
(original)
+++ subversion/branches/better-pristines/subversion/libsvn_client/upgrade.c Thu 
Sep  7 09:53:56 2017
@@ -193,7 +193,16 @@ svn_client_upgrade2(const char *path,
   SVN_ERR(svn_wc__format_from_version_string(&wc_format,
                                              wc_format_version,
                                              scratch_pool));
-  return upgrade_internal(path, wc_format, ctx, scratch_pool);
+  SVN_ERR(upgrade_internal(path, wc_format, ctx, scratch_pool));
+  return SVN_NO_ERROR;
+}
+
+const char *
+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";
 }
 
 /* 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=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c 
(original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c Thu Sep 
 7 09:53:56 2017
@@ -2181,83 +2181,37 @@ svn_wc__update_schema(int *result_format
   for (*result_format = start_format;
        *result_format < target_format;)
     {
-      switch (*result_format)
-        {
-          case 19:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_20, &bb, scratch_pool));
-            *result_format = 20;
-            break;
-
-          case 20:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_21, &bb, scratch_pool));
-            *result_format = 21;
-            break;
-
-          case 21:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_22, &bb, scratch_pool));
-            *result_format = 22;
-            break;
-
-          case 22:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_23, &bb, scratch_pool));
-            *result_format = 23;
-            break;
-
-          case 23:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_24, &bb, scratch_pool));
-            *result_format = 24;
-            break;
-
-          case 24:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_25, &bb, scratch_pool));
-            *result_format = 25;
-            break;
-
-          case 25:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_26, &bb, scratch_pool));
-            *result_format = 26;
+#define UPDATE_TO_FORMAT(X) \
+          case ((X) - 1):   \
+            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_##X, &bb, 
scratch_pool)); \
+            *result_format = (X); \
             break;
 
-          case 26:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_27, &bb, scratch_pool));
-            *result_format = 27;
-            break;
-
-          case 27:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_28, &bb, scratch_pool));
-            *result_format = 28;
-            break;
-
-          case 28:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_29, &bb, scratch_pool));
-            *result_format = 29;
-            break;
-
-          case 29:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_30, &bb, scratch_pool));
-            *result_format = 30;
-            break;
-
-          case 30:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_31, &bb, scratch_pool));
-            *result_format = 31;
-            break;
-
-          case 31:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_32, &bb, scratch_pool));
-            *result_format = SVN_WC__VERSION;
-            break;
+      switch (*result_format)
+        {
+          UPDATE_TO_FORMAT(20);
+          UPDATE_TO_FORMAT(21);
+          UPDATE_TO_FORMAT(22);
+          UPDATE_TO_FORMAT(23);
+          UPDATE_TO_FORMAT(24);
+          UPDATE_TO_FORMAT(25);
+          UPDATE_TO_FORMAT(26);
+          UPDATE_TO_FORMAT(27);
+          UPDATE_TO_FORMAT(28);
+          UPDATE_TO_FORMAT(29);
+          UPDATE_TO_FORMAT(30);
+          UPDATE_TO_FORMAT(31);
+          UPDATE_TO_FORMAT(32);
 
           /* ### future bumps go here.  */
 #if 0
-          case XXX-1:
-            SVN_ERR(svn_sqlite__with_lock(sdb, bump_to_XXX, &bb, 
scratch_pool));
-            *result_format = XXX;
-            break;
+          UPDATE_TO_FORMAT(XXX);
 #endif
         }
+#undef UPDATE_TO_FORMAT
     }
 
+  SVN_ERR_ASSERT(*result_format == target_format);
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/wc.h?rev=1807576&r1=1807575&r2=1807576&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/wc.h Thu Sep  7 
09:53:56 2017
@@ -169,7 +169,9 @@ extern "C" {
 /* The default WC version created by the client. */
 #define SVN_WC__VERSION 32
 
-/* The minimum WC version supported by the client. */
+/* The minimum WC version supported by the client.
+   IMPORTANT: Update the implementation of svn_client_supported_wc_version()
+              whenever you change this value! */
 #define SVN_WC__SUPPORTED_VERSION 31
 
 /* Formats <= this have no concept of "revert text-base/props".  */


Reply via email to