subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1407279 - in /subversion/trunk/subversion: svnadmin/main.c tests/cmdline/svntest/main.py
Date Thu, 08 Nov 2012 21:42:34 GMT
Author: cmpilato
Date: Thu Nov  8 21:42:34 2012
New Revision: 1407279

URL: http://svn.apache.org/viewvc?rev=1407279&view=rev
Log:
Rather than continue the trend of accumulating new --pre-X.Y-compatible
options to 'svnadmin create', make use of the new version parsing and
comparison private functions to add a single new option that should
work henceforth.

* subversion/svnadmin/main.c
  (svnadmin__cmdline_options_t): Add 'svnadmin__compatible_version' value; 
    remove 'svnadmin__pre_1_8_compatible'.
  (options_table): Add record for new --compatible-version option, and
    remove the one for --pre-1.8-compatible.  Deprecate the
    --pre-1.4-compatible, --pre-1.5-compatible, and --pre-1.6-compatible
    options.
  (cmd_table): Teach 'svnadmin create' to accept --compatible-version
    (and to stop accepting --pre-1.8-compatible).
  (svnadmin_opt_state): Trade 'pre_1_8_compatible' member for a new
    'compatible_version' one.
  (subcommand_create, sub_main): Add handling for --compatible-version;
    drop handling for --pre-1.8-compatible.

* subversion/tests/cmdline/svntest/main.py
  (create_repos): Now pass the --compatible-version to 'svnadmin
    create'; this matches the flexibility of the --server-minor-version
    test harness option.

Suggested by: rhuijben

Modified:
    subversion/trunk/subversion/svnadmin/main.c
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/main.c?rev=1407279&r1=1407278&r2=1407279&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/main.c (original)
+++ subversion/trunk/subversion/svnadmin/main.c Thu Nov  8 21:42:34 2012
@@ -43,6 +43,7 @@
 #include "svn_xml.h"
 
 #include "private/svn_opt_private.h"
+#include "private/svn_subr_private.h"
 
 #include "svn_private_config.h"
 
@@ -193,7 +194,7 @@ enum svnadmin__cmdline_options_t
     svnadmin__pre_1_4_compatible,
     svnadmin__pre_1_5_compatible,
     svnadmin__pre_1_6_compatible,
-    svnadmin__pre_1_8_compatible
+    svnadmin__compatible_version
   };
 
 /* Option codes and descriptions.
@@ -271,26 +272,23 @@ static const apr_getopt_option_t options
         "                             use by another process")},
 
     {"pre-1.4-compatible",     svnadmin__pre_1_4_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.4")},
+     N_("deprecated; see --compatible-version")},
 
     {"pre-1.5-compatible",     svnadmin__pre_1_5_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.5")},
+     N_("deprecated; see --compatible-version")},
 
     {"pre-1.6-compatible",     svnadmin__pre_1_6_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.6")},
-
-    {"pre-1.8-compatible",     svnadmin__pre_1_8_compatible, 0,
-     N_("use format compatible with Subversion versions\n"
-        "                             earlier than 1.8")},
+     N_("deprecated; see --compatible-version")},
 
     {"memory-cache-size",     'M', 1,
      N_("size of the extra in-memory cache in MB used to\n"
         "                             minimize redundant operations. Default: 16.\n"
         "                             [used for FSFS repositories only]")},
 
+    {"compatible-version",     svnadmin__compatible_version, 1,
+     N_("use repository format compatible with Subversion\n"
+        "                             version ARG (\"1.5.5\", \"1.7\", etc.)")},
+
     {NULL}
   };
 
@@ -310,9 +308,9 @@ static const svn_opt_subcommand_desc2_t 
    ("usage: svnadmin create REPOS_PATH\n\n"
     "Create a new, empty repository at REPOS_PATH.\n"),
    {svnadmin__bdb_txn_nosync, svnadmin__bdb_log_keep,
-    svnadmin__config_dir, svnadmin__fs_type, svnadmin__pre_1_4_compatible,
-    svnadmin__pre_1_5_compatible, svnadmin__pre_1_6_compatible,
-    svnadmin__pre_1_8_compatible
+    svnadmin__config_dir, svnadmin__fs_type, svnadmin__compatible_version,
+    svnadmin__pre_1_4_compatible, svnadmin__pre_1_5_compatible,
+    svnadmin__pre_1_6_compatible
     } },
 
   {"deltify", subcommand_deltify, {0}, N_
@@ -487,7 +485,7 @@ struct svnadmin_opt_state
   svn_boolean_t pre_1_4_compatible;                 /* --pre-1.4-compatible */
   svn_boolean_t pre_1_5_compatible;                 /* --pre-1.5-compatible */
   svn_boolean_t pre_1_6_compatible;                 /* --pre-1.6-compatible */
-  svn_boolean_t pre_1_8_compatible;                 /* --pre-1.8-compatible */
+  svn_version_t *compatible_version;                /* --compatible-version */
   svn_opt_revision_t start_revision, end_revision;  /* -r X[:Y] */
   svn_boolean_t help;                               /* --help or -? */
   svn_boolean_t version;                            /* --version */
@@ -638,25 +636,35 @@ subcommand_create(apr_getopt_t *os, void
                  APR_HASH_KEY_STRING,
                  opt_state->fs_type);
 
+  /* Prior to 1.8, we had explicit options to specify compatibility
+     with a handful of prior Subversion releases. */
   if (opt_state->pre_1_4_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
-
+                 APR_HASH_KEY_STRING, "1");
   if (opt_state->pre_1_5_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
-
+                 APR_HASH_KEY_STRING, "1");
   if (opt_state->pre_1_6_compatible)
     apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
+                 APR_HASH_KEY_STRING, "1");
 
-  if (opt_state->pre_1_8_compatible)
-    apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE,
-                 APR_HASH_KEY_STRING,
-                 "1");
+  /* In 1.8, we figured out that we didn't have to keep extending this
+     madness indefinitely. */
+  if (opt_state->compatible_version)
+    {
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 4, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 5, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 6, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+      if (! svn_version__at_least(opt_state->compatible_version, 1, 8, 0))
+        apr_hash_set(fs_config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE,
+                     APR_HASH_KEY_STRING, "1");
+    }
 
   SVN_ERR(svn_repos_create(&repos, opt_state->repository_path,
                            NULL, NULL, NULL, fs_config, pool));
@@ -1987,8 +1995,42 @@ sub_main(int argc, const char *argv[], a
       case svnadmin__pre_1_6_compatible:
         opt_state.pre_1_6_compatible = TRUE;
         break;
-      case svnadmin__pre_1_8_compatible:
-        opt_state.pre_1_8_compatible = TRUE;
+      case svnadmin__compatible_version:
+        {
+          svn_version_t latest = { SVN_VER_MAJOR, SVN_VER_MINOR,
+                                   SVN_VER_PATCH, NULL };
+          svn_version_t *compatible_version;
+
+          /* Parse the version string which carries our target
+             compatibility. */
+          SVN_INT_ERR(svn_version__parse_version_string(&compatible_version,
+                                                        opt_arg, pool));
+
+          /* We can't create repository with a version older than 1.0.0.  */
+          if (! svn_version__at_least(compatible_version, 1, 0, 0))
+            {
+              err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                      _("Cannot create pre-1.0-compatible "
+                                        "repositories"));
+              return EXIT_ERROR(err);
+            }
+
+          /* We can't create repository with a version newer than what
+             the running version of Subversion supports. */
+          if (! svn_version__at_least(&latest,
+                                      compatible_version->major,
+                                      compatible_version->minor,
+                                      compatible_version->patch))
+            {
+              err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                      _("Cannot guaranteed compatibility "
+                                        "beyond the current running version "
+                                        "(" SVN_VER_NUM ")"));
+              return EXIT_ERROR(err);
+            }
+
+          opt_state.compatible_version = compatible_version;
+        }
         break;
       case svnadmin__fs_type:
         SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1407279&r1=1407278&r2=1407279&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Thu Nov  8 21:42:34 2012
@@ -829,12 +829,7 @@ def create_repos(path, minor_version = N
   opts = ("--bdb-txn-nosync",)
   if not minor_version or minor_version > options.server_minor_version:
     minor_version = options.server_minor_version
-  if minor_version < 4:
-    opts += ("--pre-1.4-compatible",)
-  elif minor_version < 5:
-    opts += ("--pre-1.5-compatible",)
-  elif minor_version < 6:
-    opts += ("--pre-1.6-compatible",)
+  opts += ("--compatible-version=1.%d" % (minor_version),)
   if options.fs_type is not None:
     opts += ("--fs-type=" + options.fs_type,)
   exit_code, stdout, stderr = run_command(svnadmin_binary, 1, 0, "create",



Mime
View raw message