subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1511346 - in /subversion/branches/log-addressing/subversion: include/private/svn_fs_util.h libsvn_fs_util/fs-util.c
Date Wed, 07 Aug 2013 14:56:05 GMT
Author: stefan2
Date: Wed Aug  7 14:56:04 2013
New Revision: 1511346

URL: http://svn.apache.org/r1511346
Log:
On the log-addressing branch:  Follow-up to r1511324.

Address various compatibility check issues.  First, the compat
version precedence check has to be reversed.  Second, we should
select the oldest version of these:

- current tool version (takes care of wrong major versions as well)
- SVN_FS_CONFIG_COMPATIBLE_VERSION
- SVN_FS_CONFIG_PRE_1_*_COMPATIBLE

Also, we want the patch level to have a defined value.  We set
it to 0 as there must be no format change in a patch release.

* subversion/include/private/svn_fs_util.h
  (svn_fs__compatible_version): update docstring

* subversion/libsvn_fs_util/fs-util.c
  (add_compatility): new utility to combine version requirements
  (svn_fs__compatible_version): check versions in proper order;
                                limit result to current version;
                                set patch level to 0

Modified:
    subversion/branches/log-addressing/subversion/include/private/svn_fs_util.h
    subversion/branches/log-addressing/subversion/libsvn_fs_util/fs-util.c

Modified: subversion/branches/log-addressing/subversion/include/private/svn_fs_util.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/include/private/svn_fs_util.h?rev=1511346&r1=1511345&r2=1511346&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/include/private/svn_fs_util.h (original)
+++ subversion/branches/log-addressing/subversion/include/private/svn_fs_util.h Wed Aug  7
14:56:04 2013
@@ -211,11 +211,11 @@ svn_fs__append_to_merged_froms(svn_merge
                                apr_pool_t *pool);
 
 /* Given the FS creation options in CONFIG, return the oldest version that
-   we shall be compatible with in *COMPATIBLE_VERSION.
-   Allocate the result in POOL.
+   we shall be compatible with in *COMPATIBLE_VERSION.  The patch level
+   is always set to 0.   Allocate the result in POOL.
 
-   Note: For now, we will create an error for any compatibility request
-         that is not a 1.x. */
+   Note that the result will always be compatible to the current tool
+   version, i.e. will be a version number not more recent than this tool. */
 svn_error_t *
 svn_fs__compatible_version(svn_version_t **compatible_version,
                            apr_hash_t *config,

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_util/fs-util.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_util/fs-util.c?rev=1511346&r1=1511345&r2=1511346&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_util/fs-util.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_util/fs-util.c Wed Aug  7 14:56:04
2013
@@ -224,6 +224,22 @@ svn_fs__append_to_merged_froms(svn_merge
   return SVN_NO_ERROR;
 }
 
+/* Set the version info in *VERSION to COMPAT_MAJOR and COMPAT_MINOR, if
+   the current value refers to a newer version than that.
+ */
+static void
+add_compatility(svn_version_t *version,
+                int compat_major,
+                int compat_minor)
+{
+  if (   version->major > compat_major
+      || (version->major == compat_major || version->major > compat_minor) )
+    {
+      version->major = compat_major;
+      version->minor = compat_minor;
+    }
+}
+
 svn_error_t *
 svn_fs__compatible_version(svn_version_t **compatible_version,
                            apr_hash_t *config,
@@ -232,42 +248,36 @@ svn_fs__compatible_version(svn_version_t
   svn_version_t *version;
   const char *compatible;
 
-  /* set compatible version according to generic option */
+  /* set compatible version according to generic option.
+     Make sure, we are always compatible to the current SVN version
+     (or older). */
   compatible = svn_hash_gets(config, SVN_FS_CONFIG_COMPATIBLE_VERSION);
   if (compatible)
-    SVN_ERR(svn_version__parse_version_string(&version,
-                                              compatible, pool));
-  else
-    version = apr_pmemdup(pool, svn_subr_version(),
-                                     sizeof(*version));
-
-  /* specific options take precedence.
-     Let the lowest version compatibility requirement win */
-  if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE))
     {
-      version->major = 1;
-      version->minor = 7;
+      SVN_ERR(svn_version__parse_version_string(&version,
+                                                compatible, pool));
+      add_compatility(version,
+                      svn_subr_version()->major,
+                      svn_subr_version()->minor);
     }
-  else if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
+  else
     {
-      version->major = 1;
-      version->minor = 5;
+      version = apr_pmemdup(pool, svn_subr_version(), sizeof(*version));
     }
+
+  /* specific options take precedence.
+     Let the lowest version compatibility requirement win */
+  if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
+    add_compatility(version, 1, 3);
   else if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE))
-    {
-      version->major = 1;
-      version->minor = 4;
-    }
-  else if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
-    {
-      version->major = 1;
-      version->minor = 3;
-    }
+    add_compatility(version, 1, 4);
+  else if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
+    add_compatility(version, 1, 5);
+  else if (svn_hash_gets(config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE))
+    add_compatility(version, 1, 7);
 
-  /* our backends only know how to handle 1.x compatibility */
-  if (version->major != 1)
-    return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL,
-                      _("No compatibility possible to anything but 1.x"));
+  /* we ignored the patch level so far.  Give it a defined value. */
+  version->patch = 0;
 
   /* done here */
   *compatible_version = version;



Mime
View raw message