Author: brane
Date: Fri Apr  5 14:11:49 2013
New Revision: 1464985

URL: http://svn.apache.org/r1464985
Log:
Make "svnadmin create --fs-type=bdb" warn about the BDB back-end deprecation.

* subversion/svnadmin/svnadmin.c (subcommand_create): Print a warning to stderr
   if the requested filesystem type is "bdb".

* subversion/tests/cmdline/svntest/main.py (create_repos): Expect the output
   of "svnadmin create" to contain that warning.

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

Modified: subversion/trunk/subversion/svnadmin/svnadmin.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/svnadmin.c?rev=1464985&r1=1464984&r2=1464985&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/svnadmin.c (original)
+++ subversion/trunk/subversion/svnadmin/svnadmin.c Fri Apr  5 14:11:49 2013
@@ -643,7 +643,19 @@ subcommand_create(apr_getopt_t *os, void
                 (opt_state->bdb_log_keep ? "0" :"1"));
 
   if (opt_state->fs_type)
-    svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
+    {
+      /* The non-default Berkeley DB backend is deprecated. */
+      if (0 == strcmp(opt_state->fs_type, "bdb"))
+        {
+          svn_error_t *const warning = svn_error_create(
+              SVN_WARNING, NULL,
+              "The 'bdb' repository back-end is deprecated,"
+              " consider using 'fsfs' instead.");
+          svn_handle_warning2(stderr, warning, "svnadmin: ");
+          svn_error_clear(warning);
+        }
+      svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
+    }
 
   /* Prior to 1.8, we had explicit options to specify compatibility
      with a handful of prior Subversion releases. */

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1464985&r1=1464984&r2=1464985&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Fri Apr  5 
14:11:49 2013
@@ -881,12 +881,26 @@ def create_repos(path, minor_version = N
 
   # Skip tests if we can't create the repository.
   if stderr:
+    stderr_lines = 0
+    using_bdb_backend = (options.fs_type == "bdb")
+    bdb_deprecation_warning = False
     for line in stderr:
+      stderr_lines += 1
       if line.find('Unknown FS type') != -1:
         raise Skip
-    # If the FS type is known, assume the repos couldn't be created
-    # (e.g. due to a missing 'svnadmin' binary).
-    raise SVNRepositoryCreateFailure("".join(stderr).rstrip())
+      if using_bdb_backend:
+        if line.find("The 'bdb' repository back-end is deprecated") != -1:
+          bdb_deprecation_warning = True
+
+    # Creating BDB repositories will cause svnadmin to print a warning
+    # which should be ignored.
+    if using_bdb_backend and bdb_deprecation_warning and stderr_lines == 1:
+      pass
+    else:
+      # If the FS type is known and we noticed more than just the
+      # BDB-specific warning, assume the repos couldn't be created
+      # (e.g. due to a missing 'svnadmin' binary).
+      raise SVNRepositoryCreateFailure("".join(stderr).rstrip())
 
   # Require authentication to write to the repos, for ra_svn testing.
   file_write(get_svnserve_conf_file_path(path),


Reply via email to