You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2018/01/04 10:56:02 UTC

svn commit: r1820052 - /subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c

Author: brane
Date: Thu Jan  4 10:56:02 2018
New Revision: 1820052

URL: http://svn.apache.org/viewvc?rev=1820052&view=rev
Log:
On the better-pristines branch: Retreive WC format from version.

* subversion/libsvn_wc/upgrade.c (svn_wc__format_from_version): Implement.

Modified:
    subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c

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=1820052&r1=1820051&r2=1820052&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/upgrade.c Thu Jan  4 10:56:02 2018
@@ -1646,8 +1646,37 @@ svn_wc__format_from_version(int *format,
                             const svn_version_t* version,
                             apr_pool_t *scratch_pool)
 {
-  /* TODO: Convert VERSION to *FORMAT */
-  *format = SVN_WC__VERSION;
+  if (!version)
+    {
+      *format = SVN_WC__VERSION;
+      return SVN_NO_ERROR;
+    }
+
+  if (version->major != SVN_VER_MAJOR || version->minor > SVN_VER_MINOR)
+    return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                             _("Can't determine working copy format "
+                               "for Subversion %d.%d.%d"),
+                             version->major,
+                             version->minor,
+                             version->patch);
+
+  switch (version->minor)
+    {
+      case 0: /* Same as 1.3.x. */
+      case 1: /* Same as 1.3.x. */
+      case 2: /* Same as 1.3.x. */
+      case 3: *format = 4; break;
+      case 4: *format = 8; break;
+      case 5: *format = 9; break;
+      case 6: *format = 10; break;
+      case 7: *format = 29; break;
+      case 8: /* Same as 1.10.x. */
+      case 9: /* Same as 1.10.x. */
+      case 10: *format = 31; break;
+      case 11: /* Same as the current version. */
+      default: *format = SVN_WC__VERSION; break;
+    }
+
   return SVN_NO_ERROR;
 }