Author: kotkov
Date: Wed Mar 22 15:08:00 2023
New Revision: 1908636

URL: http://svn.apache.org/viewvc?rev=1908636&view=rev
Log:
On the 'pristine-checksum-kind' branch: Sync with trunk@1908635.

Modified:
    subversion/branches/pristine-checksum-kind/   (props changed)
    subversion/branches/pristine-checksum-kind/Makefile.in
    subversion/branches/pristine-checksum-kind/build.conf
    subversion/branches/pristine-checksum-kind/build/ac-macros/apr_memcache.m4
    subversion/branches/pristine-checksum-kind/build/ac-macros/serf.m4
    subversion/branches/pristine-checksum-kind/build/ac-macros/svn-macros.m4
    subversion/branches/pristine-checksum-kind/build/run_tests.py
    subversion/branches/pristine-checksum-kind/configure.ac
    
subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h
    subversion/branches/pristine-checksum-kind/subversion/include/svn_client.h
    subversion/branches/pristine-checksum-kind/subversion/include/svn_config.h
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/client.h
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/copy.c
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/deprecated.c
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/externals.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/shelf.c
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/tree.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/   (props 
changed)
    subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/tree.c
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/config_file.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/time.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/copy.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.h
    
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_pristine.c
    subversion/branches/pristine-checksum-kind/subversion/svn/upgrade-cmd.c
    subversion/branches/pristine-checksum-kind/subversion/svnserve/svnserve.c
    subversion/branches/pristine-checksum-kind/subversion/tests/README
    
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/checkout_tests.py
    
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/externals_tests.py
    
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/store_pristine_tests.py
    
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py
    
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/upgrade_tests.py
    
subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_client/client-test.c
    
subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_fs/fs-test.c
    
subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c

Propchange: subversion/branches/pristine-checksum-kind/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1906817-1908635

Modified: subversion/branches/pristine-checksum-kind/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/Makefile.in?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/Makefile.in (original)
+++ subversion/branches/pristine-checksum-kind/Makefile.in Wed Mar 22 15:08:00 
2023
@@ -632,6 +632,12 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
          if test "$(STORE_PRISTINE)" != ""; then                            \
            flags="--store-pristine $(STORE_PRISTINE) $$flags";              \
          fi;                                                                \
+         if test "$(VALGRIND)" != ""; then                                  \
+           flags="--valgrind $(VALGRIND) $$flags";                          \
+         fi;                                                                \
+         if test "$(VALGRIND_OPTS)" != ""; then                             \
+           flags="--valgrind-opts $(VALGRIND_OPTS) $$flags";                \
+         fi;                                                                \
          LD_LIBRARY_PATH='$(auth_plugin_dirs):$(LD_LIBRARY_PATH)'           \
          $(PYTHON) $(top_srcdir)/build/run_tests.py                         \
                    --config-file $(top_srcdir)/subversion/tests/tests.conf  \

Modified: subversion/branches/pristine-checksum-kind/build.conf
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/build.conf?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/build.conf (original)
+++ subversion/branches/pristine-checksum-kind/build.conf Wed Mar 22 15:08:00 
2023
@@ -1337,7 +1337,7 @@ msvc-force-static = yes
 description = Test Sqlite query evaluation
 type = exe
 path = subversion/tests/libsvn_wc
-sources = wc-queries-test.c ../../libsvn_subr/sqlite3wrapper.c
+sources = wc-queries-test.c
 install = test
 libs = libsvn_test libsvn_wc libsvn_subr apriconv apr sqlite
 

Modified: 
subversion/branches/pristine-checksum-kind/build/ac-macros/apr_memcache.m4
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/build/ac-macros/apr_memcache.m4?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/build/ac-macros/apr_memcache.m4 
(original)
+++ subversion/branches/pristine-checksum-kind/build/ac-macros/apr_memcache.m4 
Wed Mar 22 15:08:00 2023
@@ -29,7 +29,7 @@ AC_DEFUN(SVN_LIB_APR_MEMCACHE,
 [
   apr_memcache_found=no
 
-  AC_ARG_WITH(apr_memcache,AC_HELP_STRING([--with-apr_memcache=PREFIX],
+  AC_ARG_WITH(apr_memcache,AS_HELP_STRING([--with-apr_memcache=PREFIX],
                                   [Standalone apr_memcache client library]),
   [
     if test "$withval" = "yes" ; then

Modified: subversion/branches/pristine-checksum-kind/build/ac-macros/serf.m4
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/build/ac-macros/serf.m4?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/build/ac-macros/serf.m4 
(original)
+++ subversion/branches/pristine-checksum-kind/build/ac-macros/serf.m4 Wed Mar 
22 15:08:00 2023
@@ -107,10 +107,10 @@ AC_DEFUN(SVN_SERF_PREFIX_CONFIG,
       save_ldflags="$LDFLAGS"
       LDFLAGS="$LDFLAGS `SVN_REMOVE_STANDARD_LIB_DIRS(-L$serf_prefix/lib)`"
       AC_CHECK_LIB($serf_major, serf_context_create,[
-        AC_TRY_COMPILE([
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <stdlib.h>
 #include "serf.h"
-],[
+]])],[
 #if ! SERF_VERSION_AT_LEAST($serf_check_major, $serf_check_minor, 
$serf_check_patch)
 #error Serf version too old: need $serf_check_version
 #endif

Modified: 
subversion/branches/pristine-checksum-kind/build/ac-macros/svn-macros.m4
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/build/ac-macros/svn-macros.m4?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/build/ac-macros/svn-macros.m4 
(original)
+++ subversion/branches/pristine-checksum-kind/build/ac-macros/svn-macros.m4 
Wed Mar 22 15:08:00 2023
@@ -126,7 +126,7 @@ AC_DEFUN([SVN_REMOVE_STANDARD_LIB_DIRS],
 AC_DEFUN([SVN_CHECK_FOR_ATOMIC_BUILTINS],
 [
   AC_CACHE_CHECK([whether the compiler provides atomic builtins], 
[svn_cv_atomic_builtins],
-  [AC_TRY_RUN([
+  [AC_RUN_IFELSE([AC_LANG_SOURCE([[
   int main()
   {
       unsigned long long val = 1010, tmp, *mem = &val;
@@ -161,5 +161,5 @@ AC_DEFUN([SVN_CHECK_FOR_ATOMIC_BUILTINS]
           return 1;
 
       return 0;
-  }], [svn_cv_atomic_builtins=yes], [svn_cv_atomic_builtins=no], 
[svn_cv_atomic_builtins=no])])
+  }]])], [svn_cv_atomic_builtins=yes], [svn_cv_atomic_builtins=no], 
[svn_cv_atomic_builtins=no])])
 ])

Modified: subversion/branches/pristine-checksum-kind/build/run_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/build/run_tests.py?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/build/run_tests.py (original)
+++ subversion/branches/pristine-checksum-kind/build/run_tests.py Wed Mar 22 
15:08:00 2023
@@ -266,6 +266,10 @@ class TestHarness:
       cmdline.append('--parallel')
     if self.opts.store_pristine is not None:
       cmdline.append('--store-pristine=%s' % self.opts.store_pristine)
+    if self.opts.valgrind is not None:
+      cmdline.append('--valgrind=%s' % self.opts.valgrind)
+    if self.opts.valgrind_opts is not None:
+      cmdline.append('--valgrind-opts=%s' % self.opts.valgrind_opts)
 
     self.c_test_cmdline = cmdline
 
@@ -335,6 +339,10 @@ class TestHarness:
       cmdline.append('--allow-remote-http-connection')
     if self.opts.store_pristine is not None:
       cmdline.append('--store-pristine=%s' % self.opts.store_pristine)
+    if self.opts.valgrind is not None:
+      cmdline.append('--valgrind=%s' % self.opts.valgrind)
+    if self.opts.valgrind_opts is not None:
+      cmdline.append('--valgrind-opts=%s' % self.opts.valgrind_opts)
 
     self.py_test_cmdline = cmdline
 
@@ -814,6 +822,17 @@ class TestHarness:
         log.write('FAIL:  %s: Unknown test failure (%s).\n'
                   % (progbase, test_failed))
 
+  def _maybe_prepend_valgrind(self, cmdline, progbase):
+    if self.opts.valgrind:
+      if (progbase in self.opts.valgrind.split(',')
+          or 'C' in self.opts.valgrind.split(',')):
+        valgrind = [os.path.join(self.builddir, 'libtool'), '--mode=execute',
+                    'valgrind', '--quiet', '--error-exitcode=1']
+        if self.opts.valgrind_opts:
+          valgrind += self.opts.valgrind_opts.split(' ')
+        cmdline = valgrind + cmdline
+    return cmdline
+
   def _run_c_test(self, progabs, progdir, progbase, test_nums, dot_count):
     'Run a c test, escaping parameters as required.'
     if self.opts.list_tests and self.opts.milestone_filter:
@@ -849,6 +868,7 @@ class TestHarness:
       self.dots_written = dots
 
     tests_completed = 0
+    cmdline = self._maybe_prepend_valgrind(cmdline, progbase)
     with Popen(cmdline, stdout=subprocess.PIPE, stderr=self.log) as prog:
       line = prog.stdout.readline()
       while line:
@@ -1095,6 +1115,10 @@ def create_parser():
                     help='Run tests that connect to remote HTTP(S) servers')
   parser.add_option('--store-pristine', action='store', type='str',
                     help='Set the WC pristine mode')
+  parser.add_option('--valgrind', action='store',
+                    help='programs to run under valgrind')
+  parser.add_option('--valgrind-opts', action='store',
+                    help='options to pass valgrind')
 
   parser.set_defaults(set_log_level=None)
   return parser

Modified: subversion/branches/pristine-checksum-kind/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/configure.ac?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/configure.ac (original)
+++ subversion/branches/pristine-checksum-kind/configure.ac Wed Mar 22 15:08:00 
2023
@@ -379,7 +379,7 @@ fi
 dnl Check for doxygen
 doxygen=yes
 AC_ARG_WITH(doxygen,
-AC_HELP_STRING([--with-doxygen=PATH],
+AS_HELP_STRING([--with-doxygen=PATH],
                [Specify the command to run doxygen]),
 [
     doxygen="$withval"
@@ -934,9 +934,6 @@ AC_SUBST(BDB_TEST_PROGRAMS)
 
 dnl Check for header files ----------------
 
-dnl Standard C headers
-AC_HEADER_STDC
-
 dnl Check for typedefs, structures, and compiler characteristics ----------
 
 dnl if compiler doesn't understand `const', then define it empty
@@ -1249,7 +1246,7 @@ AC_SUBST(MOD_ACTIVATION)
 
 
 AC_ARG_ENABLE(gcov,
-AC_HELP_STRING([--enable-gcov],
+AS_HELP_STRING([--enable-gcov],
                [Turn on gcov coverage testing (GCC only).]),
 [
     if test "$enableval" = "yes" ; then

Modified: 
subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h
 (original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h
 Wed Mar 22 15:08:00 2023
@@ -2194,6 +2194,16 @@ svn_wc__format_from_version(int *format,
                             const svn_version_t* version,
                             apr_pool_t *scratch_pool);
 
+/* Return a string indicating the released version (or versions) of
+ * Subversion that used WC format number WC_FORMAT, or some other
+ * suitable string if no released version used WC_FORMAT.
+ *
+ * ### It's not ideal to encode this sort of knowledge in this low-level
+ * library.  On the other hand, it doesn't need to be updated often and
+ * should be easily found when it does need to be updated.  */
+const char *
+svn_wc__version_string_from_format(int wc_format);
+
 /**
  * Return true iff @a format is a supported format.
  */
@@ -2290,6 +2300,9 @@ svn_wc__ensure_adm(svn_wc_context_t *wc_
  * format indicated by @a target_format.  @a local_abspath should be
  * an absolute path to the root of the working copy.
  *
+ * If @a result_format_p is non-NULL, it will be set to the resulting
+ * format of the working copy after the upgrade.
+ *
  * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at
  * various points during the operation.  If it returns an error
  * (typically #SVN_ERR_CANCELLED), return that error immediately.
@@ -2306,7 +2319,8 @@ svn_wc__ensure_adm(svn_wc_context_t *wc_
  * @since New in 1.15.
  */
 svn_error_t *
-svn_wc__upgrade(svn_wc_context_t *wc_ctx,
+svn_wc__upgrade(int *result_format_p,
+                svn_wc_context_t *wc_ctx,
                 const char *local_abspath,
                 int target_format,
                 svn_wc_upgrade_get_repos_info_t repos_info_func,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/include/svn_client.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/include/svn_client.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/include/svn_client.h 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/include/svn_client.h 
Wed Mar 22 15:08:00 2023
@@ -1242,7 +1242,7 @@ svn_client_args_to_target_array(apr_arra
  *              obstructing items.
  * @param[in] wc_format_version is the version number of the oldest Subversion
  *              client with which the created working copy should be 
compatible;
- *              @c NULL means the library's version.
+ *              @c NULL means the default version.
  *              See svn_client_default_wc_version(),
  *              svn_client_get_wc_formats_supported().
  * @param[in] store_pristine  If #svn_tristate_true, the pristine contents of
@@ -1284,8 +1284,8 @@ svn_client_checkout4(svn_revnum_t *resul
                      apr_pool_t *pool);
 
 /**
- * Similar to svn_client_checkout4() but always creates the newest
- * supported working copy format.
+ * Similar to svn_client_checkout4() but with @a wc_format_version set
+ * to @c NULL.
  *
  * @since New in 1.5.
  * @deprecated Provided for backward compatibility with the 1.10 API.
@@ -4403,12 +4403,27 @@ svn_client_cleanup(const char *dir,
 /**
  * Recursively upgrade a working copy and nested externals working
  * copies from any older format to a WC metadata storage
- * format supported by Subversion @a wc_format_version.
+ * format supported by Subversion @a target_format_version.
  *
- * If @a wc_format_version is @c NULL, the library's version is used.
+ * If @a target_format_version is @c NULL, the default version is used.
+ *
+ * If the working copy already has a supported format newer than
+ * @a target_format_version, the behavior is as follows:
+ *
+ * - If @a target_format_version is @c NULL, meaning the default version
+ *   should be used, the upgrade is no-op and the working copy is left
+ *   at its current format.
+ *
+ * - If @a target_format_version is not @c NULL, meaning that a specific
+ *   format version should be used, the upgrade results in an error.
  *
  * @a wcroot_dir is the path to the WC root.
  *
+ * If @a result_format_version_p is not @c NULL, it will be set to the
+ * resulting format version of the upgraded working copy, allocated from
+ * @a result_pool.  If this information is not required, @a result_pool
+ * may be passed as @c NULL.
+ *
  * @see svn_client_default_wc_version(),
  * svn_client_get_wc_formats_supported().
  *
@@ -4417,14 +4432,16 @@ svn_client_cleanup(const char *dir,
  * @since New in 1.15.
  */
 svn_error_t *
-svn_client_upgrade2(const char *wcroot_dir,
-                    const svn_version_t *wc_format_version,
+svn_client_upgrade2(const svn_version_t **result_format_version_p,
+                    const char *wcroot_dir,
+                    const svn_version_t *target_format_version,
                     svn_client_ctx_t *ctx,
+                    apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool);
 
 /**
- * Like svn_client_upgrade2(), but always upgrades to the newest
- * supported format.
+ * Like svn_client_upgrade2(), but with @a result_format_version_p,
+ * @a target_format_version and @a result_pool set to @c NULL.
  *
  * @since New in 1.7.
  * @deprecated Provided for backward compatibility with the 1.14 API.
@@ -4445,13 +4462,17 @@ const svn_version_t *
 svn_client_oldest_wc_version(apr_pool_t *result_pool);
 
 /**
- * Returns the first version that supported the library's default
- * working copy metadata format.
+ * Set @a *version_p to the version of a working copy format that should
+ * be used by default for @a ctx, according to its configuration.
+ * Allocate the result in @a result_pool.
  *
  * @since New in 1.15.
  */
-const svn_version_t *
-svn_client_default_wc_version(apr_pool_t *result_pool);
+svn_error_t *
+svn_client_default_wc_version(const svn_version_t **version_p,
+                              svn_client_ctx_t *ctx,
+                              apr_pool_t *result_pool,
+                              apr_pool_t *scratch_pool);
 
 /**
  * Returns the first version that supported the library's latest

Modified: 
subversion/branches/pristine-checksum-kind/subversion/include/svn_config.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/include/svn_config.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/include/svn_config.h 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/include/svn_config.h 
Wed Mar 22 15:08:00 2023
@@ -171,6 +171,8 @@ typedef struct svn_config_t svn_config_t
 #define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS  "exclusive-locking-clients"
 /** @since New in 1.9. */
 #define SVN_CONFIG_OPTION_SQLITE_BUSY_TIMEOUT       "busy-timeout"
+/** @since New in 1.15. */
+#define SVN_CONFIG_OPTION_COMPATIBLE_VERSION        "compatible-version"
 /** @} */
 
 /** @name Repository conf directory configuration files strings

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c 
Wed Mar 22 15:08:00 2023
@@ -80,6 +80,7 @@ svn_client__checkout_internal(svn_revnum
                               svn_depth_t depth,
                               svn_boolean_t ignore_externals,
                               svn_boolean_t allow_unver_obstructions,
+                              svn_boolean_t settings_from_context,
                               const svn_version_t *wc_format_version,
                               svn_tristate_t store_pristine,
                               svn_ra_session_t *ra_session,
@@ -88,6 +89,7 @@ svn_client__checkout_internal(svn_revnum
 {
   int target_format;
   svn_boolean_t target_store_pristine;
+  svn_boolean_t fail_on_format_mismatch;
   svn_node_kind_t kind;
   svn_client__pathrev_t *pathrev;
   svn_opt_revision_t resolved_rev = { svn_opt_revision_number };
@@ -103,26 +105,56 @@ svn_client__checkout_internal(svn_revnum
       && (revision->kind != svn_opt_revision_head))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
-  if (wc_format_version == NULL && store_pristine == svn_tristate_unknown)
+  if (settings_from_context)
     {
       SVN_ERR(svn_wc__settings_from_context(&target_format,
                                             &target_store_pristine,
                                             ctx->wc_ctx, local_abspath,
                                             scratch_pool));
+      fail_on_format_mismatch = FALSE;
     }
   else
     {
-      SVN_ERR_ASSERT(wc_format_version != NULL);
+      const svn_version_t *target_format_version;
 
-      SVN_ERR(svn_wc__format_from_version(&target_format, wc_format_version,
-                                          scratch_pool));
-
-      SVN_ERR_ASSERT(store_pristine != svn_tristate_unknown);
-
-      if (store_pristine == svn_tristate_true)
+      if (store_pristine == svn_tristate_unknown)
+        target_store_pristine = TRUE;
+      else if (store_pristine == svn_tristate_true)
         target_store_pristine = TRUE;
       else
         target_store_pristine = FALSE;
+
+      if (wc_format_version)
+        {
+          target_format_version = wc_format_version;
+          /* Fail if the existing WC's format is different than requested. */
+          fail_on_format_mismatch = TRUE;
+        }
+      else
+        {
+          /* A NULL wc_format_version translates to the minimum compatible
+             version. */
+          SVN_ERR(svn_client_default_wc_version(&target_format_version, ctx,
+                                                scratch_pool, scratch_pool));
+
+          if (!target_store_pristine)
+            {
+              const svn_version_t *required_version =
+                
svn_client__compatible_wc_version_optional_pristine(scratch_pool);
+
+              if (!svn_version__at_least(target_format_version,
+                                         required_version->major,
+                                         required_version->minor,
+                                         required_version->patch))
+                target_format_version = required_version;
+            }
+
+          fail_on_format_mismatch = FALSE;
+        }
+
+      SVN_ERR(svn_wc__format_from_version(&target_format,
+                                          target_format_version,
+                                          scratch_pool));
     }
 
   /* Get the RA connection, if needed. */
@@ -221,8 +253,7 @@ svn_client__checkout_internal(svn_revnum
                 _("'%s' is already a working copy for a different URL"),
                 svn_dirent_local_style(local_abspath, scratch_pool));
 
-          /* Warn if the existing WC's format is different than requested. */
-          if (present_format != target_format)
+          if (fail_on_format_mismatch && present_format != target_format)
             return svn_error_createf(
                 SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
                 _("'%s' is already a working copy for the same URL"
@@ -271,32 +302,12 @@ svn_client_checkout4(svn_revnum_t *resul
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
-  if (store_pristine == svn_tristate_unknown)
-    store_pristine = svn_tristate_true;
-
-  /* A NULL wc_format_version translates to the minimum compatible version. */
-  if (!wc_format_version)
-    {
-      wc_format_version = svn_client_default_wc_version(pool);
-
-      if (store_pristine == svn_tristate_false)
-        {
-          const svn_version_t *required_version =
-            svn_client__compatible_wc_version_optional_pristine(pool);
-
-          if (!svn_version__at_least(wc_format_version,
-                                     required_version->major,
-                                     required_version->minor,
-                                     required_version->patch))
-            wc_format_version = required_version;
-        }
-    }
-
   err = svn_client__checkout_internal(result_rev, &sleep_here,
                                       URL, local_abspath,
                                       peg_revision, revision, depth,
                                       ignore_externals,
                                       allow_unver_obstructions,
+                                      FALSE, /* settings_from_context */
                                       wc_format_version,
                                       store_pristine,
                                       NULL /* ra_session */,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/client.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/client.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/client.h 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/client.h 
Wed Mar 22 15:08:00 2023
@@ -539,18 +539,20 @@ svn_client__update_internal(svn_revnum_t
    the repos are tolerated; if FALSE, these obstructions cause the checkout
    to fail.
 
-   A new working copy, if needed, will be created in the format corresponding
-   to the WC_FORMAT_VERSION of the client.  The format of any existing working
-   copy will remain unchanged.
+   If SETTINGS_FROM_CONTEXT is TRUE, the working copy settings such as
+   WC_FORMAT_VERSION and STORE_PRISTINE will be determined from context
+   (see svn_wc__settings_from_context) and the values of the corresponding
+   arguments are ignored.  Otherwise, their values take effect as described
+   below:
 
-   If STORE_PRISTINE is svn_tristate_true, the pristine contents of all
-   files in the working copy will be stored on disk.  If STORE_PRISTINE is
-   svn_tristate_false, the pristine contents will be fetched on-demand when
-   required by the operation.
+   - A new working copy, if needed, will be created in the format corresponding
+     to the WC_FORMAT_VERSION of the client.  The format of any existing
+     working copy will remain unchanged.
 
-   If WC_FORMAT_VERSION is NULL and STORE_PRISTINE is svn_tristate_unknown, the
-   settings will be determined from context (see 
svn_wc__settings_from_context).
-   Otherwise, both WC_FORMAT_VERSION and STORE_PRISTINE must be defined.
+   - If STORE_PRISTINE is svn_tristate_true, the pristine contents of all
+     files in the working copy will be stored on disk.  If STORE_PRISTINE is
+     svn_tristate_false, the pristine contents will be fetched on-demand when
+     required by the operation.
 
    If RA_SESSION is NOT NULL, it may be used to avoid creating a new
    session. The session may point to a different URL after returning.
@@ -565,6 +567,7 @@ svn_client__checkout_internal(svn_revnum
                               svn_depth_t depth,
                               svn_boolean_t ignore_externals,
                               svn_boolean_t allow_unver_obstructions,
+                              svn_boolean_t settings_from_context,
                               const svn_version_t *wc_format_version,
                               svn_tristate_t store_pristine,
                               svn_ra_session_t *ra_session,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/copy.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/copy.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/copy.c 
Wed Mar 22 15:08:00 2023
@@ -2487,8 +2487,8 @@ svn_client__repos_to_wc_copy_dir(svn_boo
                                         svn_depth_infinity,
                                         TRUE /*ignore_externals*/,
                                         FALSE, /* we don't allow obstructions 
*/
-                                        NULL, /* default WC format */
-                                        svn_tristate_unknown,
+                                        TRUE, /*settings_from_context*/
+                                        NULL, svn_tristate_unknown,
                                         ra_session, ctx, scratch_pool);
 
     ctx->notify_func2 = old_notify_func2;

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/deprecated.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/deprecated.c
 (original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/deprecated.c
 Wed Mar 22 15:08:00 2023
@@ -3287,5 +3287,6 @@ svn_client_upgrade(const char *path,
                    svn_client_ctx_t *ctx,
                    apr_pool_t *scratch_pool)
 {
-  return svn_error_trace(svn_client_upgrade2(path, NULL, ctx, scratch_pool));
+  return svn_error_trace(svn_client_upgrade2(NULL, path, NULL, ctx,
+                                             NULL, scratch_pool));
 }

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/externals.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/externals.c 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/externals.c 
Wed Mar 22 15:08:00 2023
@@ -412,8 +412,8 @@ switch_dir_external(const char *local_ab
                                         url, local_abspath, peg_revision,
                                         revision, svn_depth_infinity,
                                         FALSE, FALSE,
-                                        NULL, /* default WC format */
-                                        svn_tristate_unknown,
+                                        TRUE, /*settings_from_context*/
+                                        NULL, svn_tristate_unknown,
                                         ra_session,
                                         ctx, pool));
 

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/shelf.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/shelf.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/shelf.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/shelf.c 
Wed Mar 22 15:08:00 2023
@@ -1036,8 +1036,8 @@ shelf_copy_base(svn_client__shelf_versio
                                         svn_depth_infinity,
                                         TRUE /*ignore_externals*/,
                                         FALSE /*allow_unver_obstructions*/,
-                                        NULL, /* default WC format */
-                                        svn_tristate_unknown,
+                                        TRUE, /*settings_from_context*/
+                                        NULL, svn_tristate_unknown,
                                         ra_session,
                                         ctx, scratch_pool));
   /* ### hopefully we won't eventually need to sleep_here... */

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c 
Wed Mar 22 15:08:00 2023
@@ -36,11 +36,13 @@
 #include "svn_pools.h"
 #include "svn_props.h"
 #include "svn_version.h"
+#include "svn_hash.h"
 
 #include "client.h"
 
 #include "svn_private_config.h"
 #include "private/svn_wc_private.h"
+#include "private/svn_subr_private.h"
 #include "../libsvn_wc/wc.h"
 
 
@@ -97,8 +99,9 @@ upgrade_externals_from_properties(svn_cl
                                   apr_pool_t *scratch_pool);
 
 static svn_error_t *
-upgrade_internal(const char *path,
-                 int wc_format,
+upgrade_internal(int *result_format_p,
+                 const char *path,
+                 int target_format,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *scratch_pool)
 {
@@ -116,7 +119,8 @@ upgrade_internal(const char *path,
                              _("'%s' is not a local path"), path);
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
-  SVN_ERR(svn_wc__upgrade(ctx->wc_ctx, local_abspath, wc_format,
+  SVN_ERR(svn_wc__upgrade(result_format_p, ctx->wc_ctx,
+                          local_abspath, target_format,
                           fetch_repos_info, &info_baton,
                           ctx->cancel_func, ctx->cancel_baton,
                           ctx->notify_func2, ctx->notify_baton2,
@@ -154,8 +158,9 @@ upgrade_internal(const char *path,
 
           if (kind == svn_node_dir)
             {
-              svn_error_t *err = upgrade_internal(ext_abspath, wc_format,
-                                                  ctx, iterpool);
+              svn_error_t *err = upgrade_internal(NULL, ext_abspath,
+                                                  target_format, ctx,
+                                                  iterpool);
 
               if (err)
                 {
@@ -179,8 +184,9 @@ upgrade_internal(const char *path,
       /* Upgrading from <= 1.6, or no svn:properties defined.
          (There is no way to detect the difference from libsvn_client :( ) */
 
-      SVN_ERR(upgrade_externals_from_properties(ctx, local_abspath, wc_format,
-                                                &info_baton, scratch_pool));
+      SVN_ERR(upgrade_externals_from_properties(ctx, local_abspath,
+                                                target_format, &info_baton,
+                                                scratch_pool));
     }
 
   SVN_ERR(svn_client__textbase_sync(NULL, local_abspath, FALSE, TRUE, ctx,
@@ -190,17 +196,54 @@ upgrade_internal(const char *path,
 }
 
 svn_error_t *
-svn_client_upgrade2(const char *path,
-                    const svn_version_t *wc_format_version,
+svn_client_upgrade2(const svn_version_t **result_format_version_p,
+                    const char *path,
+                    const svn_version_t *target_format_version,
                     svn_client_ctx_t *ctx,
+                    apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
 {
-  int wc_format;
+  int result_format;
+  int target_format;
+  svn_boolean_t fail_on_downgrade;
+
+  if (target_format_version)
+    {
+      SVN_ERR(svn_wc__format_from_version(&target_format,
+                                          target_format_version,
+                                          scratch_pool));
+      /* Fail on downgrade attempts if format version was passed explicitly. */
+      fail_on_downgrade = TRUE;
+    }
+  else
+    {
+      const svn_version_t *default_version;
+
+      SVN_ERR(svn_client_default_wc_version(&default_version, ctx,
+                                            scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__format_from_version(&target_format, default_version,
+                                          scratch_pool));
+      fail_on_downgrade = FALSE;
+    }
+
+  SVN_ERR(upgrade_internal(&result_format, path, target_format,
+                           ctx, scratch_pool));
+
+  if (fail_on_downgrade && result_format > target_format)
+    return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+                             _("Working copy '%s' is already at version %s "
+                               "(format %d) and cannot be downgraded to "
+                               "version %s (format %d)"),
+                             svn_dirent_local_style(path, scratch_pool),
+                             svn_wc__version_string_from_format(result_format),
+                             result_format,
+                             svn_wc__version_string_from_format(target_format),
+                             target_format);
+
+  if (result_format_version_p)
+    *result_format_version_p = svn_client_wc_version_from_format(
+                                 result_format, result_pool);
 
-  SVN_ERR(svn_wc__format_from_version(&wc_format,
-                                      wc_format_version,
-                                      scratch_pool));
-  SVN_ERR(upgrade_internal(path, wc_format, ctx, scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -251,13 +294,42 @@ svn_client_oldest_wc_version(apr_pool_t
   return &version;
 }
 
-const svn_version_t *
-svn_client_default_wc_version(apr_pool_t *result_pool)
-{
-  /* NOTE: For consistency, always return the version of the client
-     that first introduced the format. */
-  static const svn_version_t version = { 1, 8, 0, NULL };
-  return &version;
+svn_error_t *
+svn_client_default_wc_version(const svn_version_t **version_p,
+                              svn_client_ctx_t *ctx,
+                              apr_pool_t *result_pool,
+                              apr_pool_t *scratch_pool)
+{
+  svn_config_t *config;
+  const char *value;
+  svn_version_t *version;
+
+  if (ctx->config)
+    config = svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_CONFIG);
+  else
+    config = NULL;
+
+  svn_config_get(config, &value,
+                 SVN_CONFIG_SECTION_WORKING_COPY,
+                 SVN_CONFIG_OPTION_COMPATIBLE_VERSION,
+                 NULL);
+  if (value)
+    {
+      SVN_ERR(svn_version__parse_version_string(&version, value, result_pool));
+    }
+  else
+    {
+      /* NOTE: For consistency, always return the version of the client
+         that first introduced the format. */
+      version = apr_pcalloc(result_pool, sizeof(*version));
+      version->major = 1;
+      version->minor = 8;
+      version->patch = 0;
+      version->tag = NULL;
+    }
+
+  *version_p = version;
+  return SVN_NO_ERROR;
 }
 
 const svn_version_t *
@@ -325,7 +397,8 @@ upgrade_external_item(svn_client_ctx_t *
     {
       svn_error_clear(err);
 
-      SVN_ERR(upgrade_internal(external_abspath, wc_format, ctx, 
scratch_pool));
+      SVN_ERR(upgrade_internal(NULL, external_abspath, wc_format, ctx,
+                               scratch_pool));
     }
   else if (err)
     return svn_error_trace(err);

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/tree.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/tree.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/tree.c 
Wed Mar 22 15:08:00 2023
@@ -1977,7 +1977,30 @@ merge(svn_stringbuf_t *conflict_p,
        different contents. */
     SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, src_nr, anc_nr, pool));
     if (! same)
-      return conflict_err(conflict_p, target_path);
+      {
+        apr_hash_t *proplist;
+
+        /* There is a prop difference between source and ancestor, if
+           there is no property difference between target and ancestor
+           then this txn didn't change props and we can simply update
+           target to match source.
+
+           Commit calls merge in a loop until it manages to get the
+           write lock with source=head. Copying the properties like
+           this will only work on the first iteration as later
+           iterations will see tgt.prop!=anc.prop and won't know that
+           the txn did not change properties. This means we
+           successfully handle a race between this txn and a
+           propchange txn while building this txn, but we don't handle
+           a race that occurs after the first iteration of the merge
+           loop -- we will raise an unwanted conflict. */
+        SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, tgt_nr, anc_nr, pool));
+        if (! same)
+          return conflict_err(conflict_p, target_path);
+
+        SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, source, pool));
+        SVN_ERR(svn_fs_fs__dag_set_proplist(target, proplist, pool));
+      }
 
     /* The directory entries got changed in the repository but the directory
        properties did not. */

Propchange: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_fs_x:r1906817-1908635

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/tree.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/tree.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/tree.c 
Wed Mar 22 15:08:00 2023
@@ -890,7 +890,32 @@ merge(svn_stringbuf_t *conflict_p,
        different contents. */
     SVN_ERR(svn_fs_x__prop_rep_equal(&same, fs, src_nr, anc_nr, TRUE, pool));
     if (! same)
-      return conflict_err(conflict_p, target_path);
+      {
+        apr_hash_t *proplist;
+
+        /* There is a prop difference between source and ancestor, if
+           there is no property difference between target and ancestor
+           then this txn didn't change props and we can simply update
+           target to match source.
+
+           Commit calls merge in a loop until it manages to get the
+           write lock with source=head. Copying the properties like
+           this will only work on the first iteration as later
+           iterations will see tgt.prop!=anc.prop and won't know that
+           the txn did not change properties. This means we
+           successfully handle a race between this txn and a
+           propchange txn while building this txn, but we don't handle
+           a race that occurs after the first iteration of the merge
+           loop -- we will raise an unwanted conflict. */
+        SVN_ERR(svn_fs_x__prop_rep_equal(&same, fs, tgt_nr, anc_nr,
+                                         TRUE, pool));
+        if (! same)
+          return conflict_err(conflict_p, target_path);
+
+        SVN_ERR(svn_fs_x__dag_get_proplist(&proplist, source, pool, pool));
+        SVN_ERR(svn_fs_x__dag_set_proplist(target, proplist, pool));
+      }
+
 
     /* The directory entries got changed in the repository but the directory
        properties did not. */

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/config_file.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/config_file.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/config_file.c 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/config_file.c 
Wed Mar 22 15:08:00 2023
@@ -1553,6 +1553,10 @@ svn_config_ensure(const char *config_dir
         "### returning an error.  The default is 10000, i.e. 10 seconds."    NL
         "### Longer values may be useful when exclusive locking is enabled." NL
         "# busy-timeout = 10000"                                             NL
+        "### Set the default working copy format version.  Newly created"    NL
+        "### and upgraded working copies will by default be compatible with" NL
+        "### the specified Subversion version."                              NL
+        "# compatible-version = 1.8"                                         NL
         ;
 
       err = svn_io_file_open(&f, path,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/time.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/time.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/time.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/time.c 
Wed Mar 22 15:08:00 2023
@@ -124,7 +124,7 @@ find_matching_string(char *str, apr_size
   apr_size_t i;
 
   for (i = 0; i < size; i++)
-    if (strings[i] && (strcmp(str, strings[i]) == 0))
+    if (strcmp(str, strings[i]) == 0)
       return (apr_int32_t) i;
 
   return -1;

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/copy.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/copy.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/copy.c Wed 
Mar 22 15:08:00 2023
@@ -215,6 +215,8 @@ copy_to_tmpdir(svn_skel_t **work_item,
    If IS_MOVE is true, record move information in working copy meta
    data in addition to copying the file.
 
+   WITHIN_ONE_WC is TRUE if the copy/move is within a single working copy 
(root)
+
    If the versioned file has a text conflict, and the .mine file exists in
    the filesystem, copy the .mine file to DST_ABSPATH.  Otherwise, copy the
    versioned file itself.
@@ -237,6 +239,7 @@ copy_versioned_file(svn_wc__db_t *db,
                     svn_boolean_t metadata_only,
                     svn_boolean_t conflicted,
                     svn_boolean_t is_move,
+                    svn_boolean_t within_one_wc,
                     const svn_io_dirent2_t *dirent,
                     svn_filesize_t recorded_size,
                     apr_time_t recorded_time,
@@ -248,8 +251,45 @@ copy_versioned_file(svn_wc__db_t *db,
 {
   svn_skel_t *work_items = NULL;
 
-  /* In case we are copying from one WC to another (e.g. an external dir),
-     ensure the destination WC has a copy of the pristine text. */
+  if (within_one_wc)
+    {
+      /* In case we are copying within one WC, it already has the pristine. */
+    }
+  else
+    {
+      /* In case we are copying from one WC to another (e.g. an external dir),
+         ensure the destination WC has a copy of the pristine text. */
+
+      svn_stream_t *contents;
+
+      SVN_ERR(svn_wc__textbase_get_contents(&contents, db, src_abspath, NULL,
+                                            TRUE, scratch_pool, scratch_pool));
+      if (contents)
+        {
+          svn_stream_t *install_stream;
+          svn_wc__db_install_data_t *install_data;
+          svn_checksum_t *install_checksum;
+          svn_checksum_t *install_md5_checksum;
+          svn_error_t *err;
+
+          SVN_ERR(svn_wc__textbase_prepare_install(&install_stream,
+                                                   &install_data,
+                                                   &install_checksum,
+                                                   &install_md5_checksum,
+                                                   db, dst_abspath, FALSE,
+                                                   scratch_pool, 
scratch_pool));
+
+          err = svn_stream_copy3(contents, install_stream, NULL, NULL, 
scratch_pool);
+          if (err)
+            return svn_error_compose_create(err,
+                     svn_wc__db_pristine_install_abort(install_data, 
scratch_pool));
+
+          SVN_ERR(svn_wc__db_pristine_install(install_data,
+                                              install_checksum,
+                                              install_md5_checksum,
+                                              scratch_pool));
+        }
+    }
 
   /* Prepare a temp copy of the filesystem node.  It is usually a file, but
      copy recursively if it's a dir. */
@@ -349,6 +389,7 @@ copy_versioned_dir(svn_wc__db_t *db,
                    const char *tmpdir_abspath,
                    svn_boolean_t metadata_only,
                    svn_boolean_t is_move,
+                   svn_boolean_t within_one_wc,
                    const svn_io_dirent2_t *dirent,
                    svn_cancel_func_t cancel_func,
                    void *cancel_baton,
@@ -454,7 +495,7 @@ copy_versioned_dir(svn_wc__db_t *db,
                                             dst_op_root_abspath,
                                             tmpdir_abspath,
                                             metadata_only, info->conflicted,
-                                            is_move,
+                                            is_move, within_one_wc,
                                             disk_children
                                               ? svn_hash_gets(disk_children,
                                                               child_name)
@@ -469,7 +510,7 @@ copy_versioned_dir(svn_wc__db_t *db,
             SVN_ERR(copy_versioned_dir(db,
                                        child_src_abspath, child_dst_abspath,
                                        dst_op_root_abspath, tmpdir_abspath,
-                                       metadata_only, is_move,
+                                       metadata_only, is_move, within_one_wc,
                                        disk_children
                                               ? svn_hash_gets(disk_children,
                                                               child_name)
@@ -839,17 +880,12 @@ copy_or_move(svn_boolean_t *record_move_
       is_move = FALSE;
     }
 
-  if (!within_one_wc)
-    SVN_ERR(svn_wc__db_pristine_transfer(db, src_abspath, dst_wcroot_abspath,
-                                         cancel_func, cancel_baton,
-                                         scratch_pool));
-
   if (src_db_kind == svn_node_file
       || src_db_kind == svn_node_symlink)
     {
       err = copy_versioned_file(db, src_abspath, dst_abspath, dst_abspath,
-                                tmpdir_abspath,
-                                metadata_only, conflicted, is_move,
+                                tmpdir_abspath, metadata_only, conflicted,
+                                is_move, within_one_wc,
                                 NULL, recorded_size, recorded_time,
                                 cancel_func, cancel_baton,
                                 notify_func, notify_baton,
@@ -888,7 +924,7 @@ copy_or_move(svn_boolean_t *record_move_
 
       err = copy_versioned_dir(db, src_abspath, dst_abspath, dst_abspath,
                                tmpdir_abspath, metadata_only, is_move,
-                               NULL /* dirent */,
+                               within_one_wc, NULL /* dirent */,
                                cancel_func, cancel_baton,
                                notify_func, notify_baton,
                                scratch_pool);

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c 
Wed Mar 22 15:08:00 2023
@@ -5179,7 +5179,8 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
                void *notify_baton,
                apr_pool_t *scratch_pool)
 {
-  return svn_wc__upgrade(wc_ctx, local_abspath, SVN_WC__DEFAULT_VERSION,
+  return svn_wc__upgrade(NULL, wc_ctx, local_abspath,
+                         SVN_WC__DEFAULT_VERSION,
                          repos_info_func, repos_info_baton,
                          cancel_func, cancel_baton,
                          notify_func, notify_baton,

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c 
Wed Mar 22 15:08:00 2023
@@ -1774,18 +1774,6 @@ svn_wc__upgrade_sdb(int *result_format,
                                                     scratch_pool),
                              start_format);
 
-  if (start_format > target_format)
-    return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
-                             _("Working copy '%s' is already at version %s "
-                               "(format %d) and cannot be downgraded to "
-                               "version %s (format %d)"),
-                             svn_dirent_local_style(wcroot_abspath,
-                                                    scratch_pool),
-                             svn_wc__version_string_from_format(start_format),
-                             start_format,
-                             svn_wc__version_string_from_format(target_format),
-                             target_format);
-
   if (target_format < SVN_WC__SUPPORTED_VERSION)
     return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
                              _("Working copy version %s (format %d) "
@@ -1811,17 +1799,6 @@ svn_wc__upgrade_sdb(int *result_format,
       svn_wc__db_install_schema_statistics(sdb, scratch_pool),
       sdb);
 
-#ifdef SVN_DEBUG
-  if (*result_format != start_format)
-    {
-      int schema_version;
-      SVN_ERR(svn_sqlite__read_schema_version(&schema_version, sdb, 
scratch_pool));
-
-      /* If this assertion fails the schema isn't updated correctly */
-      SVN_ERR_ASSERT(schema_version == *result_format);
-    }
-#endif
-
   /* Zap anything that might be remaining or escaped our notice.  */
   wipe_obsolete_files(wcroot_abspath, scratch_pool);
 
@@ -1865,7 +1842,6 @@ svn_wc__update_schema(int *result_format
 #undef UPDATE_TO_FORMAT
     }
 
-  SVN_ERR_ASSERT(*result_format == target_format);
   return SVN_NO_ERROR;
 }
 
@@ -2033,7 +2009,8 @@ is_old_wcroot(const char *local_abspath,
 }
 
 svn_error_t *
-svn_wc__upgrade(svn_wc_context_t *wc_ctx,
+svn_wc__upgrade(int *result_format_p,
+                svn_wc_context_t *wc_ctx,
                 const char *local_abspath,
                 int target_format,
                 svn_wc_upgrade_get_repos_info_t repos_info_func,
@@ -2082,8 +2059,6 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
       /* Auto-upgrade worked! */
       SVN_ERR(svn_wc__db_close(db));
 
-      SVN_ERR_ASSERT(result_format == target_format);
-
       if (bumped_format && notify_func)
         {
           svn_wc_notify_t *notify;
@@ -2095,6 +2070,8 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
           notify_func(notify_baton, notify, scratch_pool);
         }
 
+      if (result_format_p)
+        *result_format_p = result_format;
       return SVN_NO_ERROR;
     }
 
@@ -2193,6 +2170,8 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
   SVN_ERR(svn_io_remove_dir2(data.root_abspath, FALSE, NULL, NULL,
                              scratch_pool));
 
+  if (result_format_p)
+    *result_format_p = target_format;
   return SVN_NO_ERROR;
 }
 

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-queries.sql?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-queries.sql 
(original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-queries.sql 
Wed Mar 22 15:08:00 2023
@@ -925,44 +925,6 @@ WHERE refcount = 0
 DELETE FROM pristine
 WHERE checksum = ?1 AND refcount = 0
 
--- STMT_SELECT_COPY_PRISTINES_F31
-/* For the root itself */
-SELECT n.checksum, md5_checksum, size, 1
-FROM nodes_current n
-LEFT JOIN pristine p ON n.checksum = p.checksum
-WHERE wc_id = ?1
-  AND n.local_relpath = ?2
-  AND n.checksum IS NOT NULL
-UNION ALL
-/* And all descendants */
-SELECT n.checksum, md5_checksum, size, 1
-FROM nodes n
-LEFT JOIN pristine p ON n.checksum = p.checksum
-WHERE wc_id = ?1
-  AND IS_STRICT_DESCENDANT_OF(n.local_relpath, ?2)
-  AND op_depth >=
-      (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2)
-  AND n.checksum IS NOT NULL
-
--- STMT_SELECT_COPY_PRISTINES_F32
-/* For the root itself */
-SELECT n.checksum, md5_checksum, size, p.hydrated
-FROM nodes_current n
-LEFT JOIN pristine p ON n.checksum = p.checksum
-WHERE wc_id = ?1
-  AND n.local_relpath = ?2
-  AND n.checksum IS NOT NULL
-UNION ALL
-/* And all descendants */
-SELECT n.checksum, md5_checksum, size, p.hydrated
-FROM nodes n
-LEFT JOIN pristine p ON n.checksum = p.checksum
-WHERE wc_id = ?1
-  AND IS_STRICT_DESCENDANT_OF(n.local_relpath, ?2)
-  AND op_depth >=
-      (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2)
-  AND n.checksum IS NOT NULL
-
 -- STMT_UPDATE_PRISTINE_HYDRATED
 UPDATE pristine SET hydrated = ?2
 WHERE checksum = ?1

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h Wed 
Mar 22 15:08:00 2023
@@ -236,16 +236,6 @@ extern "C" {
    checksum kind. */
 #define SVN_WC__HAS_PRISTINE_CHECKSUM_SHA1_SALTED 33
 
-/* Return a string indicating the released version (or versions) of
- * Subversion that used WC format number WC_FORMAT, or some other
- * suitable string if no released version used WC_FORMAT.
- *
- * ### It's not ideal to encode this sort of knowledge in this low-level
- * library.  On the other hand, it doesn't need to be updated often and
- * should be easily found when it does need to be updated.  */
-const char *
-svn_wc__version_string_from_format(int wc_format);
-
 /* Return true iff error E indicates an "is not a working copy" type
    of error, either because something wasn't a working copy at all, or
    because it's a working copy from a previous version (in need of

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.h?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.h 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.h Wed 
Mar 22 15:08:00 2023
@@ -1043,16 +1043,6 @@ svn_wc__db_pristine_lookup_by_md5(const
                                   apr_pool_t *scratch_pool);
 
 
-/* If necessary transfers the PRISTINE files of the tree rooted at
-   SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */
-svn_error_t *
-svn_wc__db_pristine_transfer(svn_wc__db_t *db,
-                             const char *src_local_abspath,
-                             const char *dst_wri_abspath,
-                             svn_cancel_func_t cancel_func,
-                             void *cancel_baton,
-                             apr_pool_t *scratch_pool);
-
 /* Remove the pristine text with checksum CHECKSUM from the
  * pristine store, iff it is not referenced by any of the (other) WC DB
  * tables. */

Modified: 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_pristine.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_pristine.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_pristine.c
 (original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_pristine.c
 Wed Mar 22 15:08:00 2023
@@ -598,197 +598,6 @@ svn_wc__db_pristine_lookup_by_md5(const
   return svn_error_trace(svn_sqlite__reset(stmt));
 }
 
-/* Handle the moving of a pristine from SRC_WCROOT to DST_WCROOT. The existing
-   pristine in SRC_WCROOT is described by CHECKSUM, MD5_CHECKSUM, SIZE and
-   HYDRATED. */
-static svn_error_t *
-maybe_transfer_one_pristine(svn_wc__db_wcroot_t *src_wcroot,
-                            svn_wc__db_wcroot_t *dst_wcroot,
-                            const svn_checksum_t *checksum,
-                            const svn_checksum_t *md5_checksum,
-                            apr_int64_t size,
-                            svn_boolean_t hydrated,
-                            svn_cancel_func_t cancel_func,
-                            void *cancel_baton,
-                            apr_pool_t *scratch_pool)
-{
-  int stmt_num;
-  svn_sqlite__stmt_t *stmt;
-  int affected_rows;
-
-  stmt_num = (dst_wcroot->format >= SVN_WC__HAS_OPTIONAL_PRISTINE
-              ? STMT_INSERT_OR_IGNORE_PRISTINE_F32
-              : STMT_INSERT_OR_IGNORE_PRISTINE_F31);
-  SVN_ERR(svn_sqlite__get_statement(&stmt, dst_wcroot->sdb, stmt_num));
-  SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, checksum, scratch_pool));
-  SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, scratch_pool));
-  SVN_ERR(svn_sqlite__bind_int64(stmt, 3, size));
-  if (dst_wcroot->format >= SVN_WC__HAS_OPTIONAL_PRISTINE)
-    SVN_ERR(svn_sqlite__bind_int(stmt, 4, hydrated));
-
-  SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
-
-  if (affected_rows == 0)
-    return SVN_NO_ERROR;
-
-  if (hydrated)
-    {
-      const char *pristine_abspath;
-      svn_stream_t *src_stream;
-      svn_stream_t *dst_stream;
-      const char *tmp_abspath;
-      const char *src_abspath;
-      svn_error_t *err;
-
-      SVN_ERR(svn_stream_open_unique(&dst_stream, &tmp_abspath,
-                                     pristine_get_tempdir(dst_wcroot,
-                                                          scratch_pool,
-                                                          scratch_pool),
-                                     svn_io_file_del_on_pool_cleanup,
-                                     scratch_pool, scratch_pool));
-
-      SVN_ERR(get_pristine_fname(&src_abspath, src_wcroot->abspath, checksum,
-                                 scratch_pool, scratch_pool));
-
-      SVN_ERR(svn_stream_open_readonly(&src_stream, src_abspath,
-                                       scratch_pool, scratch_pool));
-
-      /* ### Should we verify the checksum here, or is that too expensive? */
-      SVN_ERR(svn_stream_copy3(src_stream, dst_stream,
-                               cancel_func, cancel_baton,
-                               scratch_pool));
-
-      SVN_ERR(get_pristine_fname(&pristine_abspath, dst_wcroot->abspath, 
checksum,
-                                 scratch_pool, scratch_pool));
-
-      /* Move the file to its target location.  (If it is already there, it is
-       * an orphan file and it doesn't matter if we overwrite it.) */
-      err = svn_io_file_rename2(tmp_abspath, pristine_abspath, FALSE,
-                                scratch_pool);
-
-      /* Maybe the directory doesn't exist yet? */
-      if (err && APR_STATUS_IS_ENOENT(err->apr_err))
-        {
-          svn_error_t *err2;
-
-          err2 = svn_io_dir_make(svn_dirent_dirname(pristine_abspath,
-                                                    scratch_pool),
-                                 APR_OS_DEFAULT, scratch_pool);
-
-          if (err2)
-            /* Creating directory didn't work: Return all errors */
-            return svn_error_trace(svn_error_compose_create(err, err2));
-          else
-            /* We could create a directory: retry install */
-            svn_error_clear(err);
-
-          SVN_ERR(svn_io_file_rename2(tmp_abspath, pristine_abspath, FALSE,
-                                      scratch_pool));
-        }
-      else
-        SVN_ERR(err);
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* Transaction implementation of svn_wc__db_pristine_transfer().
-   We have a lock on DST_WCROOT.
- */
-static svn_error_t *
-pristine_transfer_txn(svn_wc__db_wcroot_t *src_wcroot,
-                       svn_wc__db_wcroot_t *dst_wcroot,
-                       const char *src_relpath,
-                       svn_cancel_func_t cancel_func,
-                       void *cancel_baton,
-                       apr_pool_t *scratch_pool)
-{
-  int stmt_num;
-  svn_sqlite__stmt_t *stmt;
-  svn_boolean_t got_row;
-  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
-
-  stmt_num = (dst_wcroot->format >= SVN_WC__HAS_OPTIONAL_PRISTINE
-              ? STMT_SELECT_COPY_PRISTINES_F32
-              : STMT_SELECT_COPY_PRISTINES_F31);
-  SVN_ERR(svn_sqlite__get_statement(&stmt, src_wcroot->sdb, stmt_num));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", src_wcroot->wc_id, src_relpath));
-
-  /* This obtains an sqlite read lock on src_wcroot */
-  SVN_ERR(svn_sqlite__step(&got_row, stmt));
-
-  while (got_row)
-    {
-      const svn_checksum_t *checksum;
-      const svn_checksum_t *md5_checksum;
-      apr_int64_t size;
-      svn_boolean_t hydrated;
-      svn_error_t *err;
-
-      svn_pool_clear(iterpool);
-
-      SVN_ERR(svn_sqlite__column_checksum(&checksum, stmt, 0, iterpool));
-      SVN_ERR(svn_sqlite__column_checksum(&md5_checksum, stmt, 1, iterpool));
-      size = svn_sqlite__column_int64(stmt, 2);
-      hydrated = svn_sqlite__column_boolean(stmt, 3);
-
-      err = maybe_transfer_one_pristine(src_wcroot, dst_wcroot,
-                                        checksum, md5_checksum, size,
-                                        hydrated,
-                                        cancel_func, cancel_baton,
-                                        iterpool);
-
-      if (err)
-        return svn_error_trace(svn_error_compose_create(
-                                    err,
-                                    svn_sqlite__reset(stmt)));
-
-      SVN_ERR(svn_sqlite__step(&got_row, stmt));
-    }
-  SVN_ERR(svn_sqlite__reset(stmt));
-
-  svn_pool_destroy(iterpool);
-
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_pristine_transfer(svn_wc__db_t *db,
-                             const char *src_local_abspath,
-                             const char *dst_wri_abspath,
-                             svn_cancel_func_t cancel_func,
-                             void *cancel_baton,
-                             apr_pool_t *scratch_pool)
-{
-  svn_wc__db_wcroot_t *src_wcroot, *dst_wcroot;
-  const char *src_relpath, *dst_relpath;
-
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&src_wcroot, &src_relpath,
-                                                db, src_local_abspath,
-                                                scratch_pool, scratch_pool));
-  VERIFY_USABLE_WCROOT(src_wcroot);
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&dst_wcroot, &dst_relpath,
-                                                db, dst_wri_abspath,
-                                                scratch_pool, scratch_pool));
-  VERIFY_USABLE_WCROOT(dst_wcroot);
-
-  if (src_wcroot == dst_wcroot
-      || src_wcroot->sdb == dst_wcroot->sdb)
-    {
-      return SVN_NO_ERROR; /* Nothing to transfer */
-    }
-
-  SVN_WC__DB_WITH_TXN(
-    pristine_transfer_txn(src_wcroot, dst_wcroot, src_relpath,
-                          cancel_func, cancel_baton, scratch_pool),
-    dst_wcroot);
-
-  return SVN_NO_ERROR;
-}
-
-
-
-
 /* If the pristine text referenced by CHECKSUM in WCROOT/SDB, whose path
  * within the pristine store is PRISTINE_ABSPATH, has a reference count of
  * zero, delete it (both the database row and the disk file).

Modified: 
subversion/branches/pristine-checksum-kind/subversion/svn/upgrade-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/svn/upgrade-cmd.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/svn/upgrade-cmd.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/svn/upgrade-cmd.c Wed 
Mar 22 15:08:00 2023
@@ -52,10 +52,9 @@ svn_cl__upgrade(apr_getopt_t *os,
   apr_array_header_t *targets;
   apr_pool_t *iterpool;
   int i;
-  const svn_version_t *default_version
-    = svn_client_default_wc_version(scratch_pool);
-  const svn_version_t *latest_version
-    = svn_client_latest_wc_version(scratch_pool);
+  const svn_version_t *latest_version;
+
+  latest_version = svn_client_latest_wc_version(scratch_pool);
 
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
                                                       opt_state->targets,
@@ -73,31 +72,34 @@ svn_cl__upgrade(apr_getopt_t *os,
   for (i = 0; i < targets->nelts; i++)
     {
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
+      const svn_version_t *result_format_version;
 
       svn_pool_clear(iterpool);
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
-      SVN_ERR(svn_client_upgrade2(target,
+      SVN_ERR(svn_client_upgrade2(&result_format_version, target,
                                   opt_state->compatible_version,
-                                  ctx, scratch_pool));
-    }
-  svn_pool_destroy(iterpool);
+                                  ctx, iterpool, iterpool));
 
-  /* Remind the user they can upgrade further if:
-   *   - the user did not specify compatible-version explicitly
-   *   - a higher version is available. */
-  if (! opt_state->compatible_version
-      && ! svn_version__at_least(default_version,
-                                 latest_version->major, latest_version->minor, 
0)
-      && ! opt_state->quiet)
-    {
-      const char *msg
-        = _("svn: The target working copies are already at version %d.%d; "
-            "the highest version supported by this client can be "
-            "specified with '--compatible-version=%d.%d'.\n");
-      SVN_ERR(svn_cmdline_printf(scratch_pool, msg,
-                                 default_version->major, 
default_version->minor,
-                                 latest_version->major, 
latest_version->minor));
+      /* Remind the user they can upgrade further if:
+       *   - the user did not specify compatible-version explicitly
+       *   - a higher version is available. */
+      if (! opt_state->compatible_version
+          && ! svn_version__at_least(result_format_version,
+                                     latest_version->major,
+                                     latest_version->minor, 0)
+          && ! opt_state->quiet)
+        {
+          SVN_ERR(svn_cmdline_printf(
+                    iterpool,
+                    _("svn: The target working copy '%s' is at version %d.%d; "
+                      "the highest version supported by this client can be "
+                      "specified with '--compatible-version=%d.%d'.\n"),
+                    svn_dirent_local_style(target, iterpool),
+                    result_format_version->major, result_format_version->minor,
+                    latest_version->major, latest_version->minor));
+        }
     }
+  svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }

Modified: 
subversion/branches/pristine-checksum-kind/subversion/svnserve/svnserve.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/svnserve/svnserve.c?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/svnserve/svnserve.c 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/svnserve/svnserve.c 
Wed Mar 22 15:08:00 2023
@@ -492,6 +492,15 @@ static void sigchld_handler(int signo)
 }
 #endif
 
+#ifdef APR_HAVE_SIGACTION
+static svn_atomic_t sigtermint_seen = 0;
+static void
+sigtermint_handler(int signo)
+{
+    svn_atomic_set(&sigtermint_seen, 1);
+}
+#endif /* APR_HAVE_SIGACTION */
+
 /* Redirect stdout to stderr.  ARG is the pool.
  *
  * In tunnel or inetd mode, we don't want hook scripts corrupting the
@@ -547,6 +556,10 @@ accept_connection(connection_t **connect
 
       status = apr_socket_accept(&(*connection)->usock, sock,
                                  connection_pool);
+#if APR_HAVE_SIGACTION
+      if (sigtermint_seen)
+          break;
+#endif
       if (handling_mode == connection_mode_fork)
         {
           apr_proc_t proc;
@@ -1330,11 +1343,20 @@ sub_main(int *exit_code, int argc, const
     }
 #endif
 
+#if APR_HAVE_SIGACTION
+  apr_signal(SIGTERM, sigtermint_handler);
+  apr_signal(SIGINT, sigtermint_handler);
+#endif
+
   while (1)
     {
       connection_t *connection = NULL;
       SVN_ERR(accept_connection(&connection, sock, &params, handling_mode,
                                 pool));
+#if APR_HAVE_SIGACTION
+      if (sigtermint_seen)
+          break;
+#endif
       if (run_mode == run_mode_listen_once)
         {
           err = serve_socket(connection, connection->pool);
@@ -1391,7 +1413,7 @@ sub_main(int *exit_code, int argc, const
       close_connection(connection);
     }
 
-  /* NOTREACHED */
+  return SVN_NO_ERROR;
 }
 
 int

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/README
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/README?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/README 
(original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/README Wed Mar 
22 15:08:00 2023
@@ -261,6 +261,72 @@ Testing Over DAV
 Please see subversion/tests/cmdline/README for how to run the
 command-line client test suite against a remote repository.
 
+
+Testing with valgrind
+---------------------
+
+The test suite has support for valgrind. For this to be useful
+Subversion must be compiled with pool debugging enabled by
+adding -DAPR_POOL_DEBUG to CFLAGS. It is sufficient to compile
+just Subversion with pool debugging but compiling apr, apr-util
+and serf will cause more of the code to be checked.
+
+Valgrind can be used on the C test programs, and/or on svn,
+svnlook, svnadmin, etc. invoked during the python tests. To test
+the C programs use:
+
+   make check VALGRIND=C
+
+To test svn during the python tests use:
+
+  make check SKIP_C_TESTS=1 VALGRIND=svn
+
+To test svnlook during the python tests use:
+
+  make check VALGRIND=svnlook TESTS=subversion/tests/cmdline/svnlook_tests.py
+
+The VALGRIND settings can be combined:
+
+  make check PARALLEL=1 VALGRIND=C,svn,svnlook
+
+Any valgrind error causes diagnostic output on stderr but the program
+will continue to run. For the C tests valgrind is invoked with the
+option --error-exitcode=1 so that the although the individual
+tests within each C test program may PASS the test as a whole will
+FAIL. For the python tests the test harness parses stderr and detects
+the valgrind diagnostic, so individual tests will FAIL. In both cases
+the stderr diagnostic output from valgrind is available in tests.log.
+
+If valgind is producing unwanted diagnostics in some of the system
+libraries then create a suppression file and pass it as:
+
+  make check VALGRIND=svn VALGRIND_OPTS=--suppressions=$PWD/vg.supp
+
+Running valgrind in the testsuite will only check the client-side code.
+To check the server-side code invoke the server using valgrind and
+arrange for it to remain in the foreground so valgrind output will
+appear on stderr in the terminal. For svnserve something like:
+
+  ./libtool --mode=execute valgrind \
+       subversion/svnserve/svnserve -Tdr subversion/tests/cmdline --foreground
+  make check BASE_URL=svn://localhost   # in another terminal
+
+For apache use a threaded MPM and then something like:
+
+  valgrind httpd -X -f /path/to/cfg
+  make check BASE_URL=http://localhost:8888   # in another terminal
+
+Note that using valgrind will make the testsuite much slower; expect more
+than an order of magnitude slowdown if using valgrind on svn during the
+python tests.  Using the ASAN/MSAN/LSAN sanitizers in gcc/clang is an
+alternative; they will catch similar types of bugs and are much faster.
+The sanitizers also benefit from pool debugging.
+
+Debian's 1:3.19.0-1 version of valgrind seems to have a problem with
+the Dwarf 5 debugging info produced by Debian's compilers, so compile
+with -gdwarf-4 if using -g.
+
+
 Conclusion
 ----------
 

Modified: 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/checkout_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/checkout_tests.py?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/checkout_tests.py
 (original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/checkout_tests.py
 Wed Mar 22 15:08:00 2023
@@ -1185,6 +1185,67 @@ def checkout_wc_from_drive(sbox):
     # cleanup the virtual drive
     subprocess.call(['subst', '/D', drive +':'])
 
+def checkout_compatible_version_arg(sbox):
+  "checkout with compatible-version from arg"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_disk = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(
+    sbox.repo_url, sbox.wc_dir, expected_output, expected_disk, [],
+    '--compatible-version', '1.15')
+
+  svntest.actions.run_and_verify_svn(
+    ['1.15'], [],
+    'info', '--show-item=wc-compatible-version', '--no-newline',
+    sbox.wc_dir)
+
+def checkout_compatible_version_config(sbox):
+  "checkout with compatible-version from config"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_disk = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(
+    sbox.repo_url, sbox.wc_dir, expected_output, expected_disk, [],
+    '--config-option', 'config:working-copy:compatible-version=1.15')
+
+  svntest.actions.run_and_verify_svn(
+    ['1.15'], [],
+    'info', '--show-item=wc-compatible-version', '--no-newline',
+    sbox.wc_dir)
+
+def checkout_over_existing_wc_same_url(sbox):
+  "checkout over existing wc with same URL"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_disk = svntest.wc.State('', {})
+
+  svntest.actions.run_and_verify_checkout(
+    sbox.repo_url, sbox.wc_dir, expected_output, expected_disk, [],
+    '--compatible-version=1.15', '--store-pristine=yes')
+  svntest.actions.run_and_verify_svn(
+    ['1.15'], [],
+    'info', '--show-item=wc-compatible-version', '--no-newline',
+    sbox.wc_dir)
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
+  svntest.actions.run_and_verify_checkout(
+    sbox.repo_url, sbox.wc_dir, expected_output, expected_disk, [],
+    '--store-pristine=yes')
+  svntest.actions.run_and_verify_svn(
+    ['1.15'], [],
+    'info', '--show-item=wc-compatible-version', '--no-newline',
+    sbox.wc_dir)
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
 #----------------------------------------------------------------------
 
 # list all tests here, starting with None:
@@ -1202,7 +1263,10 @@ test_list = [ None,
               checkout_peg_rev,
               checkout_peg_rev_date,
               co_with_obstructing_local_adds,
-              checkout_wc_from_drive
+              checkout_wc_from_drive,
+              checkout_compatible_version_arg,
+              checkout_compatible_version_config,
+              checkout_over_existing_wc_same_url
             ]
 
 if __name__ == "__main__":

Modified: 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/externals_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/externals_tests.py?rev=1908636&r1=1908635&r2=1908636&view=diff
==============================================================================
--- 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/externals_tests.py
 (original)
+++ 
subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/externals_tests.py
 Wed Mar 22 15:08:00 2023
@@ -3431,7 +3431,6 @@ def update_deletes_file_external(sbox):
 
 
 @Issue(4519)
-@Wimp("May trigger an existing issue, see 
upgrade_tests.py:upgrade_latest_format()")
 def switch_relative_externals(sbox):
   "switch relative externals"
 


Reply via email to