[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-commits
Subject:    svn commit: r1906821 - in /subversion/branches/pristine-checksum-kind/subversion: include/
From:       kotkov () apache ! org
Date:       2023-01-19 18:51:16
Message-ID: 20230119185117.3CCD017AE30 () svn01-us-east ! apache ! org
[Download RAW message or body]

Author: kotkov
Date: Thu Jan 19 18:51:16 2023
New Revision: 1906821

URL: http://svn.apache.org/viewvc?rev=1906821&view=rev
Log:
On the 'pristine-checksum-kind' branch: First-cut implementation that makes
the working copy pristine checksum kind configurable.

With this changeset, a user can create working copies that use a checksum kind
other than SHA-1.

The checksum kind is persisted in the settings table.  Upgraded working copies
of the older formats will have SHA-1 recorded as their pristine checksum kind
and will continue to use it for compatibility.  Newly created working copies
of the latest format (with --compatible-version=1.15 or --store-pristine=no),
as currently implemented, will use the new pristine checksum kind.  Currently,
as a proof-of-concept, the branch uses salted SHA-1 as the new pristine
checksum kind.

This changeset bumps the working copy format from 32 to 33.

* subversion/include/svn_wc.h
  (svn_wc_info_t): Add new `pristine_checksum_kind` field.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_settings): Return the pristine checksum kind.

* subversion/libsvn_wc/wc-metadata.sql
  (): Bump to format 33.  Update some of the comments.
  (STMT_UPGRADE_TO_33): New.  Add the `pristine_checksum_kind` column to
   the SETTINGS table.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_SETTINGS): Return the pristine checksum kind.
  (STMT_UPSERT_SETTINGS): Change the pristine checksum kind.

* subversion/libsvn_wc/wc.h
  (SVN_WC__VERSION): Change to 33.
  (SVN_WC__HAS_PRISTINE_CHECKSUM_KIND): New.
  (SVN_WC__HAS_PRISTINE_CHECKSUM_SHA1_SALTED): New.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_init,
   svn_wc__db_upgrade_begin): Accept the pristine checksum kind.
  (svn_wc__db_get_settings): Return the pristine checksum kind.
  (svn_wc__db_pristine_read,
   svn_wc__db_pristine_prepare_install,
   svn_wc__db_pristine_install,
   svn_wc__db_pristine_get_md5,
   svn_wc__db_pristine_lookup_by_md5,
   svn_wc__db_pristine_remove,
   svn_wc__db_pristine_check,
   svn_wc__db_pristine_dehydrate): Tweak comments.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_wcroot_t): Add the new `pristine_checksum_kind` field.
  (enum svn_wc__db_pristine_checksum_kind_t): New.
  (svn_wc__db_pdh_create_wcroot): Add the new `pristine_checksum_kind` argument.

* subversion/libsvn_client/checkout.c
  (svn_client__checkout_internal): Adjust call to svn_wc__get_settings().

* subversion/libsvn_client/commit.c
  (post_process_commit_item): Tweak comment.

* subversion/libsvn_client/upgrade.c
  (svn_client_wc_version_from_format): Adjust for format 33.

* subversion/libsvn_wc/adm_crawler.c
  (svn_wc__internal_transmit_text_deltas): Tweak comment.

* subversion/libsvn_wc/adm_files.c
  (init_adm): Add the new `pristine_checksum_kind` argument and pass it further.
  (svn_wc__internal_ensure_adm): Determine the pristine checksum kind when
   creating a working copy.  Adjust call to svn_wc__db_get_settings().

* subversion/libsvn_wc/adm_ops.c
  (get_pristine_copy_path): Adjust call to svn_wc__db_get_settings().
  (get_pristine_lazyopen_func): Arrange to look up the actual checksum if
   we have an MD5.

* subversion/libsvn_wc/conflicts.c
  (svn_wc_resolved_conflict5): Adjust call to svn_wc__get_settings().

* subversion/libsvn_wc/deprecated.c
  (svn_wc_crawl_revisions5,
   svn_wc_transmit_text_deltas3,
   svn_wc_restore,
   svn_wc_get_pristine_contents2,
   svn_wc_revert6,
   svn_wc_get_diff_editor6,
   svn_wc_diff6,
   svn_wc_get_status_editor5,
   svn_wc_get_update_editor4,
   svn_wc_get_switch_editor4,
   svn_wc_merge5): Adjust calls to svn_wc__get_settings().

* subversion/libsvn_wc/info.c
  (build_info_for_node): Fill in the pristine checksum kind.
  (svn_wc__get_settings): Update to return the pristine checksum kind.

* subversion/libsvn_wc/textbase.c
  (open_textbase,
   svn_wc_textbase_sync): Adjust calls to svn_wc__db_get_settings().

* subversion/libsvn_wc/update_editor.c
  (handler_baton): Tweak comments.
  (apply_textdelta): Do not assert a specific checksum kind.

* subversion/libsvn_wc/upgrade.c
  (bump_to_33): New.
  (svn_wc__version_string_from_format): Adjust for format 33.
  (svn_wc__update_schema): Adjust for format 33.
  (svn_wc__upgrade): Adjust call to svn_wc__db_upgrade_begin().

* subversion/libsvn_wc/wc_db.c
  (init_db): Write the new pristine checksum kind to the database.
  (svn_wc__db_init, create_db, svn_wc__db_upgrade_begin): Pass the
   `pristine_checksum_kind` argument further.
  (svn_wc__db_get_settings): Return the pristine checksum kind.

* subversion/libsvn_wc/wc_db_wcroot.c
  (svn_wc__db_pdh_create_wcroot): Initialize the `pristine_checksum_kind` field.
  (read_settings): Read the pristine checksum kind from the database.
  (fetch_sdb_info): Return the pristine checksum kind.
  (svn_wc__db_wcroot_parse_local_abspath): Adjust calls to the updated functions.

* subversion/libsvn_wc/wc_db_pristine.c
  (*): Do not assert a specific checksum kind (svn_checksum_sha1).
   Tweak the related comments.
  (get_pristine_fname): Prefix the subdirectory (shard) name with the
   checksum kind to ensure that the file names for different checksum kinds
   are unique.
  (pristine_install_txn): Tweak comment.
  (svn_wc__db_pristine_prepare_install_internal): Arrange to return a checksum
   of the configured pristine checksum kind.
  (svn_wc__db_pristine_check): Adjust the check in this function.

* subversion/svn/info-cmd.c
  (print_info): Print the pristine checksum kind of a working copy.
  (print_info_xml): Add a TODO.
  (print_info_item): Add a TODO.

* subversion/tests/cmdline/svntest/main.py
  (wc_format): Adjust for format 33.

* subversion/tests/cmdline/svntest/wc.py
  (text_base_path): Update the implementation to take the pristine checksum
   kind into account.

* subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout,
* subversion/tests/cmdline/getopt_tests_data/svn--version_stdout:
  Adjust for format 33.

* subversion/tests/libsvn_wc/utils.c
  (svn_test__create_fake_wc): Adjust for format 33.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (schema_statements, create_memory_db): Adjust for format 33.

* subversion/tests/libsvn_wc/wc-test.c
  (test_get_pristine_copy_path): Adjust call to svn_wc__db_get_settings().

* subversion/tests/libsvn_wc/pristine-store-test.c
  (pristine_write_read): Tweak comment.
  (pristine_install_dehydrated): Adjust call to svn_wc__db_get_settings().
   Tweak comment.
  (pristine_dehydrate): Adjust call to svn_wc__db_get_settings().

Modified:
    subversion/branches/pristine-checksum-kind/subversion/include/private/svn_wc_private.h
  subversion/branches/pristine-checksum-kind/subversion/include/svn_wc.h
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/commit.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_crawler.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_files.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_ops.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/conflicts.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/info.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/textbase.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/update_editor.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-metadata.sql
    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.c
    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/libsvn_wc/wc_db_private.h
    subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_wcroot.c
    subversion/branches/pristine-checksum-kind/subversion/svn/info-cmd.c
    subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout
  subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version_stdout
  subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py
    subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/wc.py
    subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/pristine-store-test.c
  subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/utils.c
    subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c
  subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-test.c

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=1906821&r1=1906820&r2=1906821&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 \
Thu Jan 19 18:51:16 2023 @@ -2317,11 +2317,12 @@ svn_wc__upgrade(svn_wc_context_t \
*wc_ctx  void *notify_baton,
                 apr_pool_t *scratch_pool);
 
-/* Return the working copy settings *FORMAT_P and *STORE_PRISTINE_P for
-   LOCAL_ABSPATH in WC_CTX. */
+/* Return the working copy settings *FORMAT_P, *STORE_PRISTINE_P and
+   *PRISTINE_CHECKSUM_KIND_P for LOCAL_ABSPATH in WC_CTX. */
 svn_error_t *
 svn_wc__get_settings(int *format_p,
                      svn_boolean_t *store_pristine_p,
+                     svn_checksum_kind_t *pristine_checksum_kind_p,
                      svn_wc_context_t *wc_ctx,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool);

Modified: subversion/branches/pristine-checksum-kind/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/include/svn_wc.h?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/include/svn_wc.h (original)
+++ subversion/branches/pristine-checksum-kind/subversion/include/svn_wc.h Thu Jan 19 \
18:51:16 2023 @@ -3320,6 +3320,12 @@ typedef struct svn_wc_info_t
    * @since New in 1.15.
    */
   svn_boolean_t store_pristine;
+
+  /**
+   * Checksum kind used for the pristine content.
+   * @since New in 1.15.
+   */
+  svn_checksum_kind_t pristine_checksum_kind;
 } svn_wc_info_t;
 
 /**

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=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/checkout.c \
Thu Jan 19 18:51:16 2023 @@ -195,8 +195,8 @@ svn_client__checkout_internal(svn_revnum
         {
           svn_boolean_t wc_store_pristine;
 
-          SVN_ERR(svn_wc__get_settings(NULL, &wc_store_pristine, ctx->wc_ctx,
-                                       local_abspath, scratch_pool));
+          SVN_ERR(svn_wc__get_settings(NULL, &wc_store_pristine, NULL,
+                                       ctx->wc_ctx, local_abspath, scratch_pool));
 
           if ((target_store_pristine && !wc_store_pristine) ||
               (!target_store_pristine && wc_store_pristine))

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_client/commit.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_client/commit.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/commit.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/commit.c Thu \
Jan 19 18:51:16 2023 @@ -218,8 +218,7 @@ collect_lock_tokens(apr_hash_t **result,
   return SVN_NO_ERROR;
 }
 
-/* Put ITEM onto QUEUE, allocating it in QUEUE's pool...
- * If a checksum is provided, it can be the MD5 and/or the SHA1. */
+/* Put ITEM onto QUEUE, allocating it in QUEUE's pool... */
 static svn_error_t *
 post_process_commit_item(svn_wc_committed_queue_t *queue,
                          const svn_client_commit_item3_t *item,

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=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_client/upgrade.c Thu \
Jan 19 18:51:16 2023 @@ -225,7 +225,7 @@ svn_client_wc_version_from_format(int wc
       case 10: return &version_1_6;
       case 29: return &version_1_7;
       case 31: return &version_1_8;
-      case 32: return &version_1_15;
+      case 33: return &version_1_15;
     }
   return NULL;
 }

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_crawler.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_crawler.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_crawler.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_crawler.c Thu \
Jan 19 18:51:16 2023 @@ -1075,7 +1075,7 @@ svn_wc__internal_transmit_text_deltas(sv
   const svn_checksum_t *expected_md5_checksum;  /* recorded MD5 of BASE_S. */
   svn_checksum_t *verify_md5_checksum;  /* calc'd MD5 of BASE_STREAM */
   svn_checksum_t *local_md5_checksum;  /* calc'd MD5 of LOCAL_STREAM */
-  svn_checksum_t *local_checksum;  /* calc'd SHA1 of LOCAL_STREAM */
+  svn_checksum_t *local_checksum;  /* calc'd checksum of LOCAL_STREAM */
   svn_wc__db_install_data_t *install_data = NULL;
   svn_error_t *err;
   svn_error_t *err2;

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_files.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_files.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_files.c Thu \
Jan 19 18:51:16 2023 @@ -208,6 +208,7 @@ init_adm(svn_wc__db_t *db,
          svn_revnum_t initial_rev,
          svn_depth_t depth,
          svn_boolean_t store_pristine,
+         svn_checksum_kind_t pristine_checksum_kind,
          apr_pool_t *pool)
 {
   /* First, make an empty administrative area. */
@@ -229,7 +230,8 @@ init_adm(svn_wc__db_t *db,
   /* Create the SDB. */
   SVN_ERR(svn_wc__db_init(db, target_format, local_abspath,
                           repos_relpath, repos_root_url, repos_uuid,
-                          initial_rev, depth, store_pristine, pool));
+                          initial_rev, depth, store_pristine,
+                          pristine_checksum_kind, pool));
 
   /* Stamp ENTRIES and FORMAT files for old clients.  */
   SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath,
@@ -300,10 +302,24 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
      just create one. */
   if (present_format == 0)
     {
+      svn_checksum_kind_t pristine_checksum_kind;
+
+      if (target_format >= SVN_WC__HAS_PRISTINE_CHECKSUM_SHA1_SALTED)
+        {
+          /* The format of a working copy is new enough to support checksum
+             kinds other than plain SHA-1. */
+          pristine_checksum_kind = svn_checksum_sha1_salted;
+        }
+      else
+        {
+          /* Compatibility: use plain SHA-1. */
+          pristine_checksum_kind = svn_checksum_sha1;
+        }
+
       return svn_error_trace(init_adm(db, target_format, local_abspath,
                                       repos_relpath, repos_root_url, repos_uuid,
                                       revision, depth, store_pristine,
-                                      scratch_pool));
+                                      pristine_checksum_kind, scratch_pool));
     }
   else if (present_format != target_format)
     {
@@ -314,7 +330,7 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
           svn_dirent_local_style(local_abspath, scratch_pool));
     }
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &wc_store_pristine, db,
+  SVN_ERR(svn_wc__db_get_settings(NULL, &wc_store_pristine, NULL, db,
                                   local_abspath, scratch_pool));
 
   if ((store_pristine && !wc_store_pristine) ||

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_ops.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_ops.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/adm_ops.c Thu Jan \
19 18:51:16 2023 @@ -768,7 +768,7 @@ get_pristine_copy_path(const char **pris
   const svn_checksum_t *checksum;
   const char *wcroot_abspath;
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, db,
+  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL, db,
                                   local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE,
@@ -894,14 +894,13 @@ get_pristine_lazyopen_func(svn_stream_t
   const svn_checksum_t *checksum;
   svn_stream_t *stream;
 
-  /* svn_wc__db_pristine_read() wants a SHA1, so if we have an MD5,
-     we'll use it to lookup the SHA1. */
-  if (b->checksum->kind == svn_checksum_sha1)
-    checksum = b->checksum;
-  else
+  /* If we have an MD5, we'll use it to look up the actual checksum. */
+  if (b->checksum->kind == svn_checksum_md5)
     SVN_ERR(svn_wc__db_pristine_lookup_by_md5(&checksum, b->wc_ctx->db,
                                               b->wri_abspath, b->checksum,
                                               scratch_pool, scratch_pool));
+  else
+    checksum = b->checksum;
 
   SVN_ERR(svn_wc__db_pristine_read(&stream, NULL, b->wc_ctx->db,
                                    b->wri_abspath, checksum,

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/conflicts.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/conflicts.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/conflicts.c Thu \
Jan 19 18:51:16 2023 @@ -3367,8 +3367,8 @@ svn_wc_resolved_conflict5(svn_wc_context
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 

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=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/deprecated.c Thu \
Jan 19 18:51:16 2023 @@ -174,8 +174,8 @@ svn_wc_crawl_revisions5(svn_wc_context_t
     {
       svn_boolean_t store_pristine;
 
-      SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                                   scratch_pool));
+      SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                                   local_abspath, scratch_pool));
       if (!store_pristine)
         return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE,
                                 NULL, NULL);
@@ -524,8 +524,8 @@ svn_wc_transmit_text_deltas3(const svn_c
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -652,8 +652,8 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -783,8 +783,8 @@ svn_wc_get_pristine_contents2(svn_stream
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -1243,8 +1243,8 @@ svn_wc_revert6(svn_wc_context_t *wc_ctx,
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -2259,8 +2259,8 @@ svn_wc_get_diff_editor6(const svn_delta_
   const svn_diff_tree_processor_t *diff_processor;
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, anchor_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               anchor_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -2477,8 +2477,8 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, local_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               local_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -3187,8 +3187,8 @@ svn_wc_get_status_editor5(const svn_delt
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, anchor_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               anchor_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -3841,8 +3841,8 @@ svn_wc_get_update_editor4(const svn_delt
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, anchor_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               anchor_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -4034,8 +4034,8 @@ svn_wc_get_switch_editor4(const svn_delt
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, anchor_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               anchor_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 
@@ -4819,8 +4819,8 @@ svn_wc_merge5(enum svn_wc_merge_outcome_
 {
   svn_boolean_t store_pristine;
 
-  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, wc_ctx, target_abspath,
-                               scratch_pool));
+  SVN_ERR(svn_wc__get_settings(NULL, &store_pristine, NULL, wc_ctx,
+                               target_abspath, scratch_pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_WC_DEPRECATED_API_STORE_PRISTINE, NULL, NULL);
 

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/info.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/info.c (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/info.c Thu Jan 19 \
18:51:16 2023 @@ -108,6 +108,7 @@ build_info_for_node(svn_wc__info2_t **in
 
   SVN_ERR(svn_wc__db_get_settings(&wc_info->wc_format,
                                   &wc_info->store_pristine,
+                                  &wc_info->pristine_checksum_kind,
                                   db, local_abspath, scratch_pool));
 
   SVN_ERR(svn_wc__db_read_info(&status, &db_kind, &tmpinfo->rev,
@@ -561,12 +562,14 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
 svn_error_t *
 svn_wc__get_settings(int *format_p,
                      svn_boolean_t *store_pristine_p,
+                     svn_checksum_kind_t *pristine_checksum_kind_p,
                      svn_wc_context_t *wc_ctx,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool)
 {
-  SVN_ERR(svn_wc__db_get_settings(format_p, store_pristine_p, wc_ctx->db,
-                                  local_abspath, scratch_pool));
+  SVN_ERR(svn_wc__db_get_settings(format_p, store_pristine_p,
+                                  pristine_checksum_kind_p,
+                                  wc_ctx->db, local_abspath, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/textbase.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/textbase.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/textbase.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/textbase.c Thu \
Jan 19 18:51:16 2023 @@ -275,8 +275,8 @@ open_textbase(svn_stream_t **contents_p,
     {
       svn_boolean_t store_pristine;
 
-      SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, db, local_abspath,
-                                      scratch_pool));
+      SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL, db,
+                                      local_abspath, scratch_pool));
       if (!store_pristine)
         {
           svn_boolean_t modified;
@@ -567,7 +567,7 @@ svn_wc_textbase_sync(svn_wc_context_t *w
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, wc_ctx->db,
+  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL, wc_ctx->db,
                                   local_abspath, scratch_pool));
   if (store_pristine)
     return SVN_NO_ERROR;

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/update_editor.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/update_editor.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/update_editor.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/update_editor.c \
Thu Jan 19 18:51:16 2023 @@ -405,17 +405,15 @@ struct handler_baton
   /* Where we are assembling the new file. */
   svn_wc__db_install_data_t *install_data;
 
-    /* The expected source checksum of the text source or NULL if no base
-     checksum is available (MD5 if the server provides a checksum, SHA1 if
-     the server doesn't) */
+  /* The expected source checksum of the text source or NULL if no base
+     checksum is available (MD5 if the server provides a checksum). */
   svn_checksum_t *expected_source_checksum;
 
   /* Why two checksums?
      The editor currently provides an md5 which we use to detect corruption
-     during transmission.  We use the sha1 inside libsvn_wc both for pristine
-     handling and corruption detection.  In the future, the editor will also
-     provide a sha1, so we may not have to calculate both, but for the time
-     being, that's the way it is. */
+     during transmission.  We use a different checksum inside libsvn_wc both
+     for pristine handling and corruption detection.  In the future, we may not
+     have to calculate both, but for the time being, that's the way it is. */
 
   /* The calculated checksum of the text source or NULL if the actual
      checksum is not being calculated. The checksum kind is identical to the
@@ -432,7 +430,7 @@ struct handler_baton
      apply_textdelta(). */
   unsigned char new_text_base_md5_digest[APR_MD5_DIGESTSIZE];
 
-  /* A calculated SHA-1 of NEW_TEXT_BASE_TMP_ABSPATH, which we'll use for
+  /* A calculated checksum of NEW_TEXT_BASE_TMP_ABSPATH, which we'll use for
      eventually writing the pristine. */
   svn_checksum_t * new_text_base_checksum;
 };
@@ -3907,9 +3905,6 @@ apply_textdelta(void *file_baton,
 
   if (! fb->adding_file)
     {
-      SVN_ERR_ASSERT(!fb->original_checksum
-                     || fb->original_checksum->kind == svn_checksum_sha1);
-
       source = svn_stream_lazyopen_create(lazy_open_source, fb, FALSE,
                                           handler_pool);
     }

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=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/upgrade.c Thu Jan \
19 18:51:16 2023 @@ -1436,6 +1436,15 @@ bump_to_32(void *baton,
 }
 
 static svn_error_t *
+bump_to_33(void *baton,
+           svn_sqlite__db_t *sdb,
+           apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_33));
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 upgrade_apply_dav_cache(svn_sqlite__db_t *sdb,
                         const char *dir_relpath,
                         apr_int64_t wc_id,
@@ -1636,7 +1645,7 @@ svn_wc__version_string_from_format(int w
       case SVN_WC__WC_NG_VERSION: return "1.7";
       case 29: return "1.7";
       case 31: return "1.8";
-      case 32: return "1.15";
+      case 33: return "1.15";
     }
   return _("(unreleased development version)");
 }
@@ -1846,6 +1855,7 @@ svn_wc__update_schema(int *result_format
           UPDATE_TO_FORMAT(30);
           UPDATE_TO_FORMAT(31);
           UPDATE_TO_FORMAT(32);
+          UPDATE_TO_FORMAT(33);
 
           /* ### future bumps go here.  */
 #if 0
@@ -2128,7 +2138,7 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
                                    &data.repos_id, &data.wc_id,
                                    db, target_format, data.root_abspath,
                                    this_dir->repos, this_dir->uuid,
-                                   TRUE, scratch_pool));
+                                   TRUE, svn_checksum_sha1, scratch_pool));
 
   /* Migrate the entries over to the new database.
    ### We need to think about atomicity here.

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-metadata.sql
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-metadata.sql?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-metadata.sql \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc-metadata.sql \
Thu Jan 19 18:51:16 2023 @@ -92,8 +92,8 @@ CREATE UNIQUE INDEX I_LOCAL_ABSPATH ON W
    In future, the pristine text file may be compressed.
  */
 CREATE TABLE PRISTINE (
-  /* The SHA-1 checksum of the pristine text. This is a unique key. The
-     SHA-1 checksum of a pristine text is assumed to be unique among all
+  /* The checksum of the pristine text. This is a unique key. The
+     checksum of a pristine text is assumed to be unique among all
      pristine texts referenced from this database. */
   checksum  TEXT NOT NULL PRIMARY KEY,
 
@@ -414,7 +414,7 @@ CREATE TABLE NODES (
   /* ### maybe a WC-to-WC copy can retain a depth?  */
   depth  TEXT,
 
-  /* The SHA-1 checksum of the pristine text, if this node is a file and was
+  /* The checksum of the pristine text, if this node is a file and was
      moved here or copied here, else NULL. */
   checksum  TEXT REFERENCES PRISTINE (checksum),
 
@@ -777,22 +777,29 @@ INSERT OR IGNORE INTO SETTINGS SELECT id
 PRAGMA user_version = 32;
 
 /* ------------------------------------------------------------------------- */
-/* Format 33 ....  */
+/* Format 33 adds support for configurable pristine checksum kinds with
+   the following schema changes:
+   - Add the 'pristine_checksum_kind' column to the SETTINGS table. */
+-- STMT_UPGRADE_TO_33
+ALTER TABLE SETTINGS ADD COLUMN pristine_checksum_kind INTEGER;
 
-/* Note: we use checksums to detect if the file contents have been modified
-   in textbase.c and in the svn_wc__internal_file_modified_p() function.
+UPDATE SETTINGS
+SET pristine_checksum_kind = 1 /* svn_wc__db_pristine_checksum_sha1 */
+WHERE pristine_checksum_kind IS NULL;
 
-   The new working copy format SHOULD incorporate a switch to a different
-   checksum type without known collisions.
+PRAGMA user_version = 33;
 
-   For the updated pristine table schema, we MAY want to add a new column
+/* ------------------------------------------------------------------------- */
+/* Format 34 ....  */
+
+/* For the updated pristine table schema, we MAY want to add a new column
    containing a checksum of the first 8KB of the file to allow saying that
    the file is modified without reading all its content.  That could speed
    up the check for large modified files whose size did not change, for
    example if they are allocated in certain extents. */
 
-/* -- STMT_UPGRADE_TO_33
-PRAGMA user_version = 33; */
+/* -- STMT_UPGRADE_TO_34
+PRAGMA user_version = 34; */
 
 /* ------------------------------------------------------------------------- */
 /* When bumping the format, also update:

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=1906821&r1=1906820&r2=1906821&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 \
Thu Jan 19 18:51:16 2023 @@ -1894,12 +1894,12 @@ SELECT pristine.checksum, \
pristine.hydra  FROM pristine WHERE refcount = 0
 
 -- STMT_SELECT_SETTINGS
-SELECT store_pristine FROM settings WHERE wc_id = ?1
+SELECT store_pristine, pristine_checksum_kind FROM settings WHERE wc_id = ?1
 
 -- STMT_UPSERT_SETTINGS
-INSERT INTO settings (wc_id, store_pristine)
-VALUES (?1, ?2)
-ON CONFLICT(wc_id) DO UPDATE SET store_pristine=?2
+INSERT INTO settings (wc_id, store_pristine, pristine_checksum_kind)
+VALUES (?1, ?2, ?3)
+ON CONFLICT(wc_id) DO UPDATE SET store_pristine=?2, pristine_checksum_kind=?3
 
 /* ------------------------------------------------------------------------- */
 

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=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc.h Thu Jan 19 \
18:51:16 2023 @@ -165,7 +165,10 @@ extern "C" {
  * The bump to 32 adds support for optional pristine contents; see the docstring
  * of STMT_UPGRADE_TO_32 for details.
  *
- * == 1.15.x shipped with format 32 and multi-wc-format support
+ * The bump to 33 adds support for configurable pristine checksum kind; see the
+ * docstring of STMT_UPGRADE_TO_33 for details.
+ *
+ * == 1.15.x shipped with format 33 and multi-wc-format support
  *
  * Please document any further format changes here.
  */
@@ -174,7 +177,7 @@ extern "C" {
  *
  * @see svn_wc__max_supported_format()
  */
-#define SVN_WC__VERSION 32
+#define SVN_WC__VERSION 33
 
 /* The minimum WC version supported by the client.
  *
@@ -226,6 +229,13 @@ extern "C" {
 /* Starting from this version, the DB stores per-WC settings. */
 #define SVN_WC__HAS_SETTINGS 32
 
+/* Starting from this version, pristine checksum kind can be configured. */
+#define SVN_WC__HAS_PRISTINE_CHECKSUM_KIND 33
+
+/* Starting from this version, salted SHA-1 can be used as the pristine
+   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.

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db.c Thu Jan \
19 18:51:16 2023 @@ -1367,6 +1367,7 @@ init_db(/* output values */
         svn_revnum_t root_node_revision,
         svn_depth_t root_node_depth,
         svn_boolean_t store_pristine,
+        svn_checksum_kind_t pristine_checksum_kind,
         const char *wcroot_abspath,
         apr_pool_t *scratch_pool)
 {
@@ -1392,8 +1393,24 @@ init_db(/* output values */
 
   if (target_format >= SVN_WC__HAS_SETTINGS)
     {
+      svn_wc__db_pristine_checksum_kind_t db_checksum_kind;
+
+      switch (pristine_checksum_kind)
+        {
+          case svn_checksum_sha1:
+            db_checksum_kind = svn_wc__db_pristine_checksum_sha1;
+            break;
+          case svn_checksum_sha1_salted:
+            SVN_ERR_ASSERT(target_format >= \
SVN_WC__HAS_PRISTINE_CHECKSUM_SHA1_SALTED); +            db_checksum_kind = \
svn_wc__db_pristine_checksum_sha1_salted; +            break;
+          default:
+            SVN_ERR_MALFUNCTION();
+        }
+
       SVN_ERR(svn_sqlite__get_statement(&stmt, db, STMT_UPSERT_SETTINGS));
-      SVN_ERR(svn_sqlite__bindf(stmt, "id", *wc_id, store_pristine));
+      SVN_ERR(svn_sqlite__bindf(stmt, "idd",
+                                *wc_id, store_pristine, db_checksum_kind));
       SVN_ERR(svn_sqlite__insert(NULL, stmt));
     }
 
@@ -1445,6 +1462,7 @@ create_db(svn_sqlite__db_t **sdb,
           svn_revnum_t root_node_revision,
           svn_depth_t root_node_depth,
           svn_boolean_t store_pristine,
+          svn_checksum_kind_t pristine_checksum_kind,
           svn_boolean_t exclusive,
           apr_int32_t timeout,
           apr_pool_t *result_pool,
@@ -1459,7 +1477,8 @@ create_db(svn_sqlite__db_t **sdb,
   SVN_SQLITE__WITH_LOCK(init_db(repos_id, wc_id,
                                 *sdb, target_format, repos_root_url, repos_uuid,
                                 root_node_repos_relpath, root_node_revision,
-                                root_node_depth, store_pristine, dir_abspath,
+                                root_node_depth, store_pristine,
+                                pristine_checksum_kind, dir_abspath,
                                 scratch_pool),
                         *sdb);
 
@@ -1477,6 +1496,7 @@ svn_wc__db_init(svn_wc__db_t *db,
                 svn_revnum_t initial_rev,
                 svn_depth_t depth,
                 svn_boolean_t store_pristine,
+                svn_checksum_kind_t pristine_checksum_kind,
                 apr_pool_t *scratch_pool)
 {
   svn_sqlite__db_t *sdb;
@@ -1506,7 +1526,8 @@ svn_wc__db_init(svn_wc__db_t *db,
   /* Create the SDB and insert the basic rows.  */
   SVN_ERR(create_db(&sdb, &repos_id, &wc_id, target_format, local_abspath,
                     repos_root_url, repos_uuid, SDB_FILE,
-                    repos_relpath, initial_rev, depth, store_pristine,
+                    repos_relpath, initial_rev, depth,
+                    store_pristine, pristine_checksum_kind,
                     sqlite_exclusive, sqlite_timeout,
                     db->state_pool, scratch_pool));
 
@@ -1515,7 +1536,7 @@ svn_wc__db_init(svn_wc__db_t *db,
                         apr_pstrdup(db->state_pool, local_abspath),
                         sdb, wc_id, FORMAT_FROM_SDB,
                         FALSE /* auto-upgrade */,
-                        store_pristine,
+                        store_pristine, pristine_checksum_kind,
                         db->state_pool, scratch_pool));
 
   /* Any previously cached children may now have a new WCROOT, most likely that
@@ -1551,6 +1572,7 @@ svn_wc__db_init(svn_wc__db_t *db,
 svn_error_t *
 svn_wc__db_get_settings(int *format_p,
                         svn_boolean_t *store_pristine_p,
+                        svn_checksum_kind_t *pristine_checksum_kind_p,
                         svn_wc__db_t *db,
                         const char *local_abspath,
                         apr_pool_t *scratch_pool)
@@ -1569,6 +1591,8 @@ svn_wc__db_get_settings(int *format_p,
     *format_p = wcroot->format;
   if (store_pristine_p)
     *store_pristine_p = wcroot->store_pristine;
+  if (pristine_checksum_kind_p)
+    *pristine_checksum_kind_p = wcroot->pristine_checksum_kind;
 
   return SVN_NO_ERROR;
 }
@@ -13460,6 +13484,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                          const char *repos_root_url,
                          const char *repos_uuid,
                          svn_boolean_t store_pristine,
+                         svn_checksum_kind_t pristine_checksum_kind,
                          apr_pool_t *scratch_pool)
 {
   svn_wc__db_wcroot_t *wcroot;
@@ -13470,6 +13495,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                     SDB_FILE,
                     NULL, SVN_INVALID_REVNUM, svn_depth_unknown,
                     store_pristine,
+                    pristine_checksum_kind,
                     TRUE /* exclusive */,
                     0 /* timeout */,
                     wc_db->state_pool, scratch_pool));
@@ -13480,6 +13506,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                                        *sdb, *wc_id, FORMAT_FROM_SDB,
                                        FALSE /* auto-upgrade */,
                                        store_pristine,
+                                       pristine_checksum_kind,
                                        wc_db->state_pool, scratch_pool));
 
   /* The WCROOT is complete. Stash it into DB.  */

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=1906821&r1=1906820&r2=1906821&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 Thu Jan \
19 18:51:16 2023 @@ -297,7 +297,8 @@ svn_wc__db_close(svn_wc__db_t *db);
    DEPTH is the initial depth of the working copy; it must be a definite
    depth, not svn_depth_unknown.
 
-   Create the working copy with the given TARGET_FORMAT.
+   Create the working copy with the given TARGET_FORMAT and settings
+   STORE_PRISTINE and PRISTINE_CHECKSUM_KIND.
 
    Use SCRATCH_POOL for temporary allocations.
 */
@@ -311,16 +312,18 @@ svn_wc__db_init(svn_wc__db_t *db,
                 svn_revnum_t initial_rev,
                 svn_depth_t depth,
                 svn_boolean_t store_pristine,
+                svn_checksum_kind_t pristine_checksum_kind,
                 apr_pool_t *scratch_pool);
 
-/* Return the working copy settings *FORMAT_P and *STORE_PRISTINE_P for
-   LOCAL_ABSPATH in DB.
+/* Return the working copy settings *FORMAT_P, *STORE_PRISTINE_P and
+   *PRISTINE_CHECKSUM_KIND_P for LOCAL_ABSPATH in DB.
 
    Use SCRATCH_POOL for temporary allocations.
 */
 svn_error_t *
 svn_wc__db_get_settings(int *format_p,
                         svn_boolean_t *store_pristine_p,
+                        svn_checksum_kind_t *pristine_checksum_kind_p,
                         svn_wc__db_t *db,
                         const char *local_abspath,
                         apr_pool_t *scratch_pool);
@@ -943,9 +946,8 @@ svn_wc__db_pristine_get_future_path(cons
 
 
 /* If requested set *CONTENTS to a readable stream that will yield the pristine
-   text identified by CHECKSUM (must be a SHA-1 checksum) within the WC
-   identified by WRI_ABSPATH in DB.  If the pristine is present in the store,
-   but dehydrated, set *CONTENTS to NULL.
+   text identified by CHECKSUM within the WC identified by WRI_ABSPATH in DB.
+   If the pristine is present in the store, but dehydrated, set *CONTENTS to NULL.
 
    If requested set *SIZE to the size of the pristine stream in bytes,
 
@@ -972,7 +974,7 @@ typedef struct svn_wc__db_install_data_t
    for either installing or removing the file
 
    Arrange that, on stream closure, *MD5_CHECKSUM and *CHECKSUM will be
-   set to the MD-5 and SHA-1 checksums respectively of that file.
+   set to the MD-5 and main checksum respectively of that file.
    MD5_CHECKSUM and/or CHECKSUM may be NULL if not wanted.
 
    The contents of the pristine will be saved to disk if HYDRATED is true or
@@ -992,7 +994,7 @@ svn_wc__db_pristine_prepare_install(svn_
                                     apr_pool_t *scratch_pool);
 
 /* Install the file created via svn_wc__db_pristine_prepare_install() into
-   the pristine data store, to be identified by the SHA-1 checksum of its
+   the pristine data store, to be identified by the checksum of its
    contents, CHECKSUM, and whose MD-5 checksum is MD5_CHECKSUM. */
 svn_error_t *
 svn_wc__db_pristine_install(svn_wc__db_install_data_t *install_data,
@@ -1008,7 +1010,7 @@ svn_wc__db_pristine_install_abort(svn_wc
 
 
 /* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text
-   identified by its SHA-1 checksum CHECKSUM. Return an error
+   identified by its checksum CHECKSUM. Return an error
    if the pristine text does not exist or its MD5 checksum is not found.
 
    Allocate *MD5_CHECKSUM in RESULT_POOL. */
@@ -1021,9 +1023,9 @@ svn_wc__db_pristine_get_md5(const svn_ch
                             apr_pool_t *scratch_pool);
 
 
-/* Set *CHECKSUM to the SHA-1 checksum of a pristine text
+/* Set *CHECKSUM to the checksum of a pristine text
    identified by its MD-5 checksum MD5_CHECKSUM. Return an error
-   if the pristine text does not exist or its SHA-1 checksum is not found.
+   if the pristine text does not exist or its checksum is not found.
 
    Note: The MD-5 checksum is not strictly guaranteed to be unique in the
    database table, although duplicates are expected to be extremely rare.
@@ -1051,7 +1053,7 @@ svn_wc__db_pristine_transfer(svn_wc__db_
                              void *cancel_baton,
                              apr_pool_t *scratch_pool);
 
-/* Remove the pristine text with SHA-1 checksum CHECKSUM from the
+/* Remove the pristine text with checksum CHECKSUM from the
  * pristine store, iff it is not referenced by any of the (other) WC DB
  * tables. */
 svn_error_t *
@@ -1069,7 +1071,7 @@ svn_wc__db_pristine_cleanup(svn_wc__db_t
 
 
 /* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains
-   a pristine text with SHA-1 checksum CHECKSUM, and to false otherwise.
+   a pristine text with checksum CHECKSUM, and to false otherwise.
    If the pristine is present, set *HYDRATED to true if its contents are
    currently available on disk, and to false otherwise.  If the pristine
    is not present, set *HYDRATED to false. */
@@ -1082,7 +1084,7 @@ svn_wc__db_pristine_check(svn_boolean_t
                           apr_pool_t *scratch_pool);
 
 /* If the pristine store for WRI_ABSPATH in DB contains a pristine text with
-   SHA-1 checksum CHECKSUM with its content available on disk, remove
+   checksum CHECKSUM with its content available on disk, remove
    that content and mark the pristine entry as "dehydrated". */
 svn_error_t *
 svn_wc__db_pristine_dehydrate(svn_wc__db_t *db,
@@ -2966,6 +2968,7 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                          const char *repos_root_url,
                          const char *repos_uuid,
                          svn_boolean_t store_pristine,
+                         svn_checksum_kind_t pristine_checksum_kind,
                          apr_pool_t *scratch_pool);
 
 /* Simply insert (or replace) one row in the EXTERNALS table. */

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=1906821&r1=1906820&r2=1906821&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 \
Thu Jan 19 18:51:16 2023 @@ -58,13 +58,14 @@ get_pristine_fname(const char **pristine
 {
   const char *base_dir_abspath;
   const char *hexdigest = svn_checksum_to_cstring(checksum, scratch_pool);
-  char subdir[3];
+  const char *checksum_prefix;
+  const char *subdir;
+  char shard[3];
 
   /* ### code is in transition. make sure we have the proper data.  */
   SVN_ERR_ASSERT(pristine_abspath != NULL);
   SVN_ERR_ASSERT(svn_dirent_is_absolute(wcroot_abspath));
   SVN_ERR_ASSERT(checksum != NULL);
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
 
   base_dir_abspath = svn_dirent_join_many(scratch_pool,
                                           wcroot_abspath,
@@ -75,10 +76,26 @@ get_pristine_fname(const char **pristine
   /* We should have a valid checksum and (thus) a valid digest. */
   SVN_ERR_ASSERT(hexdigest != NULL);
 
-  /* Get the first two characters of the digest, for the subdir. */
-  subdir[0] = hexdigest[0];
-  subdir[1] = hexdigest[1];
-  subdir[2] = '\0';
+  /* Prefix the subdir name with the checksum kind. */
+  switch (checksum->kind)
+    {
+      case svn_checksum_sha1:
+        /* No prefix for SHA1 for historical reasons. */
+        checksum_prefix = "";
+        break;
+      case svn_checksum_sha1_salted:
+        checksum_prefix = "ssh1-";
+        break;
+      default:
+        SVN_ERR_MALFUNCTION();
+    }
+
+  /* Get the first two characters of the digest, for the shard name. */
+  shard[0] = hexdigest[0];
+  shard[1] = hexdigest[1];
+  shard[2] = '\0';
+
+  subdir = apr_pstrcat(scratch_pool, checksum_prefix, shard, SVN_VA_NULL);
 
   hexdigest = apr_pstrcat(scratch_pool, hexdigest, PRISTINE_STORAGE_EXT,
                           SVN_VA_NULL);
@@ -242,8 +259,6 @@ svn_wc__db_pristine_read(svn_stream_t **
                                "because no checksum supplied"),
                              svn_dirent_local_style(wri_abspath, scratch_pool));
 
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
-
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               wri_abspath, scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
@@ -333,7 +348,7 @@ pristine_install_txn(svn_wc__db_wcroot_t
                      svn_wc__db_install_data_t *install_data,
                      /* The target path for the file (within the pristine store). */
                      const char *pristine_abspath,
-                     /* The pristine text's SHA-1 checksum. */
+                     /* The pristine text's checksum. */
                      const svn_checksum_t *checksum,
                      /* The pristine text's MD-5 checksum. */
                      const svn_checksum_t *md5_checksum,
@@ -460,7 +475,8 @@ svn_wc__db_pristine_prepare_install_inte
                                      svn_checksum_md5, FALSE, result_pool);
   if (checksum_p)
     stream = svn_stream_checksummed2(stream, NULL, checksum_p,
-                                     svn_checksum_sha1, FALSE, result_pool);
+                                     wcroot->pristine_checksum_kind,
+                                     FALSE, result_pool);
 
   *stream_p = stream;
   *install_data_p = install_data;
@@ -478,7 +494,6 @@ svn_wc__db_pristine_install(svn_wc__db_i
   const char *pristine_abspath;
 
   SVN_ERR_ASSERT(checksum != NULL);
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
   SVN_ERR_ASSERT(md5_checksum != NULL);
   SVN_ERR_ASSERT(md5_checksum->kind == svn_checksum_md5);
 
@@ -525,7 +540,6 @@ svn_wc__db_pristine_get_md5(const svn_ch
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
   SVN_ERR_ASSERT(checksum != NULL);
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               wri_abspath, scratch_pool, scratch_pool));
@@ -580,7 +594,6 @@ svn_wc__db_pristine_lookup_by_md5(const
                                                              scratch_pool));
 
   SVN_ERR(svn_sqlite__column_checksum(checksum, stmt, 0, result_pool));
-  SVN_ERR_ASSERT((*checksum)->kind == svn_checksum_sha1);
 
   return svn_error_trace(svn_sqlite__reset(stmt));
 }
@@ -640,7 +653,7 @@ maybe_transfer_one_pristine(svn_wc__db_w
       SVN_ERR(svn_stream_open_readonly(&src_stream, src_abspath,
                                        scratch_pool, scratch_pool));
 
-      /* ### Should we verify the SHA1 or MD5 here, or is that too expensive? */
+      /* ### 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));
@@ -842,13 +855,12 @@ svn_wc__db_pristine_remove(svn_wc__db_t
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
   SVN_ERR_ASSERT(checksum != NULL);
-  /* ### Transitional: accept MD-5 and look up the SHA-1.  Return an error
+  /* ### Transitional: look up the checksum by MD-5.  Return an error
    * if the pristine text is not in the store. */
-  if (checksum->kind != svn_checksum_sha1)
+  if (checksum->kind == svn_checksum_md5)
     SVN_ERR(svn_wc__db_pristine_lookup_by_md5(&checksum, db, wri_abspath,
                                               checksum,
                                               scratch_pool, scratch_pool));
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
 
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               wri_abspath, scratch_pool, scratch_pool));
@@ -975,7 +987,11 @@ svn_wc__db_pristine_check(svn_boolean_t
   SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
   SVN_ERR_ASSERT(checksum != NULL);
 
-  if (checksum->kind != svn_checksum_sha1)
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
+                              wri_abspath, scratch_pool, scratch_pool));
+  VERIFY_USABLE_WCROOT(wcroot);
+
+  if (checksum->kind != wcroot->pristine_checksum_kind)
     {
       *present = FALSE;
       if (hydrated)
@@ -984,10 +1000,6 @@ svn_wc__db_pristine_check(svn_boolean_t
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
-                              wri_abspath, scratch_pool, scratch_pool));
-  VERIFY_USABLE_WCROOT(wcroot);
-
   /* Check that there is an entry in the PRISTINE table. */
   SVN_ERR(stmt_select_pristine(&have_row, NULL, NULL, hydrated,
                                wcroot, checksum,
@@ -1027,8 +1039,6 @@ svn_wc__db_pristine_dehydrate_internal(s
   const char *pristine_abspath;
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR_ASSERT(checksum->kind == svn_checksum_sha1);
-
   SVN_ERR(get_pristine_fname(&pristine_abspath, wcroot->abspath,
                              checksum,
                              scratch_pool, scratch_pool));

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_private.h
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_private.h?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_private.h \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_private.h \
Thu Jan 19 18:51:16 2023 @@ -111,8 +111,20 @@ typedef struct svn_wc__db_wcroot_t {
      to fetch the contents on demand. */
   svn_boolean_t store_pristine;
 
+  /* The checksum kind used for the pristine contents. */
+  svn_checksum_kind_t pristine_checksum_kind;
+
 } svn_wc__db_wcroot_t;
 
+/* The checksum kind used for the pristine contents.  Values of this enum
+   get recorded into the database. */
+typedef enum svn_wc__db_pristine_checksum_kind_t
+{
+  svn_wc__db_pristine_checksum_sha1 = 1,
+  /* Available in working copy format 33 and later. */
+  svn_wc__db_pristine_checksum_sha1_salted = 2
+} svn_wc__db_pristine_checksum_kind_t;
+
 
 /* */
 svn_error_t *
@@ -131,6 +143,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
                              int format,
                              svn_boolean_t verify_format,
                              svn_boolean_t store_pristine,
+                             svn_checksum_kind_t pristine_checksum_kind,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool);
 

Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_wcroot.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_wcroot.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_wcroot.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/libsvn_wc/wc_db_wcroot.c \
Thu Jan 19 18:51:16 2023 @@ -302,6 +302,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
                              int format,
                              svn_boolean_t verify_format,
                              svn_boolean_t store_pristine,
+                             svn_checksum_kind_t pristine_checksum_kind,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
 {
@@ -390,6 +391,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
                                           sizeof(svn_wc__db_wclock_t));
   (*wcroot)->access_cache = apr_hash_make(result_pool);
   (*wcroot)->store_pristine = store_pristine;
+  (*wcroot)->pristine_checksum_kind = pristine_checksum_kind;
 
   /* SDB will be NULL for pre-NG working copies. We only need to run a
      cleanup when the SDB is present.  */
@@ -499,6 +501,7 @@ verify_stats_table(svn_sqlite__db_t *sdb
 /* Read and return the settings for WC_ID in SDB. */
 static svn_error_t *
 read_settings(svn_boolean_t *store_pristine_p,
+              svn_checksum_kind_t *pristine_checksum_kind_p,
               svn_sqlite__db_t *sdb,
               int format,
               apr_int64_t wc_id,
@@ -507,6 +510,7 @@ read_settings(svn_boolean_t *store_prist
   if (format >= SVN_WC__HAS_SETTINGS)
     {
       svn_sqlite__stmt_t *stmt;
+      svn_wc__db_pristine_checksum_kind_t db_checksum_kind;
 
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_SETTINGS));
       SVN_ERR(svn_sqlite__bindf(stmt, "i", wc_id));
@@ -514,11 +518,31 @@ read_settings(svn_boolean_t *store_prist
 
       *store_pristine_p = svn_sqlite__column_boolean(stmt, 0);
 
+      db_checksum_kind = svn_sqlite__column_int(stmt, 1);
+      if (db_checksum_kind == svn_wc__db_pristine_checksum_sha1)
+        {
+          *pristine_checksum_kind_p = svn_checksum_sha1;
+        }
+      else if (format >= SVN_WC__HAS_PRISTINE_CHECKSUM_SHA1_SALTED &&
+               db_checksum_kind == svn_wc__db_pristine_checksum_sha1_salted)
+        {
+          *pristine_checksum_kind_p = svn_checksum_sha1_salted;
+        }
+      else
+        {
+          return svn_error_createf(SVN_ERR_WC_CORRUPT,
+                                   svn_sqlite__reset(stmt),
+                                   _("Unexpected value of the '%s' column (%d)"),
+                                   "pristine_checksum_kind",
+                                   db_checksum_kind);
+        }
+
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
   else
     {
       *store_pristine_p = TRUE;
+      *pristine_checksum_kind_p = svn_checksum_sha1;
     }
 
   return SVN_NO_ERROR;
@@ -531,6 +555,7 @@ static svn_error_t *
 fetch_sdb_info(apr_int64_t *wc_id,
                int *format,
                svn_boolean_t *store_pristine,
+               svn_checksum_kind_t *pristine_checksum_kind,
                svn_sqlite__db_t *sdb,
                apr_pool_t *scratch_pool)
 {
@@ -541,7 +566,8 @@ fetch_sdb_info(apr_int64_t *wc_id,
         svn_wc__db_util_fetch_wc_id(wc_id, sdb, scratch_pool),
         svn_sqlite__read_schema_version(format, sdb, scratch_pool),
         verify_stats_table(sdb, *format, scratch_pool),
-        read_settings(store_pristine, sdb, *format, *wc_id, scratch_pool),
+        read_settings(store_pristine, pristine_checksum_kind, sdb,
+                      *format, *wc_id, scratch_pool),
         sdb);
 
   return SVN_NO_ERROR;
@@ -795,9 +821,11 @@ try_symlink_as_dir:
       apr_int64_t wc_id;
       int format;
       svn_boolean_t store_pristine;
+      svn_checksum_kind_t pristine_checksum_kind;
       svn_error_t *err;
 
-      err = fetch_sdb_info(&wc_id, &format, &store_pristine, sdb, scratch_pool);
+      err = fetch_sdb_info(&wc_id, &format, &store_pristine,
+                           &pristine_checksum_kind, sdb, scratch_pool);
       if (err)
         {
           if (err->apr_err == SVN_ERR_WC_CORRUPT)
@@ -818,7 +846,7 @@ try_symlink_as_dir:
                                           : local_abspath),
                             sdb, wc_id, format,
                             db->verify_format,
-                            store_pristine,
+                            store_pristine, pristine_checksum_kind,
                             db->state_pool, scratch_pool);
       if (err && (err->apr_err == SVN_ERR_WC_UNSUPPORTED_FORMAT ||
                   err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) &&
@@ -894,7 +922,7 @@ try_symlink_as_dir:
                                           : local_abspath),
                             NULL, UNKNOWN_WC_ID, wc_format,
                             db->verify_format,
-                            TRUE,
+                            TRUE, svn_checksum_sha1,
                             db->state_pool, scratch_pool));
     }
 

Modified: subversion/branches/pristine-checksum-kind/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/svn/info-cmd.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/svn/info-cmd.c (original)
+++ subversion/branches/pristine-checksum-kind/subversion/svn/info-cmd.c Thu Jan 19 \
18:51:16 2023 @@ -613,6 +613,8 @@ print_info_xml(void *baton,
       svn_cl__xml_tagged_cdata(&sb, pool, "store-pristine",
                                info->wc_info->store_pristine ? "yes" : "no");
 
+      /* TODO: pristine_checksum_kind */
+
       /* "<schedule> xx </schedule>" */
       svn_cl__xml_tagged_cdata(&sb, pool, "schedule",
                                schedule_str(info->wc_info->schedule));
@@ -777,6 +779,24 @@ print_info(void *baton,
       else
         SVN_ERR(svn_cmdline_fputs(_("Working Copy Store Pristine: no\n"),
                                   stdout, pool));
+
+      switch (info->wc_info->pristine_checksum_kind)
+        {
+        case svn_checksum_sha1:
+          SVN_ERR(svn_cmdline_fputs(_("Working Copy Checksum Kind: SHA1\n"),
+                                    stdout, pool));
+          break;
+
+        case svn_checksum_sha1_salted:
+          SVN_ERR(svn_cmdline_fputs(_("Working Copy Checksum Kind: Salted SHA1\n"),
+                                    stdout, pool));
+          break;
+
+        default:
+          SVN_ERR(svn_cmdline_fputs(_("Working Copy Checksum Kind: INVALID\n"),
+                                    stdout, pool));
+          break;
+        }
     }
 
   if (info->URL)
@@ -1324,6 +1344,8 @@ print_info_item(void *baton,
       }
       break;
 
+    /* TODO: pristine_checksum_kind */
+
     default:
       SVN_ERR_MALFUNCTION();
     }

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversio \
n/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version--verbose_stdout \
Thu Jan 19 18:51:16 2023 @@ -9,7 +9,7 @@ Subversion is open source software, see
 Supported working copy (WC) formats:
 
 * WC format 31, compatible with Subversion v1.8 and newer
-* WC format 32, compatible with Subversion v1.15 and newer
+* WC format 33, compatible with Subversion v1.15 and newer
 
 The following repository access (RA) modules are available:
 

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version_stdout
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversio \
n/tests/cmdline/getopt_tests_data/svn--version_stdout?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version_stdout \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/getopt_tests_data/svn--version_stdout \
Thu Jan 19 18:51:16 2023 @@ -9,7 +9,7 @@ Subversion is open source software, see
 Supported working copy (WC) formats:
 
 * WC format 31, compatible with Subversion v1.8 and newer
-* WC format 32, compatible with Subversion v1.15 and newer
+* WC format 33, compatible with Subversion v1.15 and newer
 
 The following repository access (RA) modules are available:
 

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/main.py \
Thu Jan 19 18:51:16 2023 @@ -1773,7 +1773,7 @@ def wc_format(ver=None):
     ver = (options.wc_format_version or DEFAULT_COMPATIBLE_VERSION)
   minor = int(ver.split('.')[1])
   if minor >= 15 and minor <= SVN_VER_MINOR:
-    return 32
+    return 33
   if minor >= 8 and minor <= 14:
     return 31
   raise Exception("Unrecognized version number '%s'" % (ver,))

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/wc.py
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/wc.py?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/wc.py \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/cmdline/svntest/wc.py \
Thu Jan 19 18:51:16 2023 @@ -1133,12 +1133,23 @@ def text_base_path(file_path):
 
   info = svntest.actions.run_and_parse_info(file_path)[0]
 
+  wc_pristine_checksum_kind = info['Working Copy Checksum Kind']
   checksum = info['Checksum']
   db, root_path, relpath = open_wc_db(file_path)
 
   # Calculate single DB location
   dot_svn = svntest.main.get_admin_name()
-  fn = os.path.join(root_path, dot_svn, 'pristine', checksum[0:2], checksum)
+
+  if wc_pristine_checksum_kind == 'SHA1':
+    subdir_prefix = ''
+  elif wc_pristine_checksum_kind == 'Salted SHA1':
+    subdir_prefix = 'ssh1-'
+  else:
+    raise svntest.Failure
+
+  subdir = subdir_prefix + checksum[0:2]
+
+  fn = os.path.join(root_path, dot_svn, 'pristine', subdir, checksum)
 
   # For SVN_WC__VERSION < 29
   if os.path.isfile(fn):

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/pristine-store-test.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversio \
n/tests/libsvn_wc/pristine-store-test.c?rev=1906821&r1=1906820&r2=1906821&view=diff \
                ==============================================================================
                
--- subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/pristine-store-test.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/pristine-store-test.c \
Thu Jan 19 18:51:16 2023 @@ -127,7 +127,7 @@ pristine_write_read(const svn_test_opts_
     SVN_TEST_ASSERT(hydrated);
   }
 
-  /* Look up its MD-5 from its SHA-1, and check it's the same MD-5. */
+  /* Look up its MD-5 from its checksum, and check it's the same MD-5. */
   {
     const svn_checksum_t *looked_up_md5;
 
@@ -333,7 +333,8 @@ pristine_install_dehydrated(const svn_te
   SVN_ERR(create_repos_and_wc(&wc_abspath, &db,
                               "pristine_install_dehydrated", opts, pool));
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, db, wc_abspath, pool));
+  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL, db,
+                                  wc_abspath, pool));
   if (store_pristine)
     return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
                             "Test assumes a working copy without pristine");
@@ -376,7 +377,7 @@ pristine_install_dehydrated(const svn_te
     SVN_TEST_ASSERT(! hydrated);
   }
 
-  /* Look up its MD-5 from its SHA-1, and check it's the same MD-5. */
+  /* Look up its MD-5 from its checksum, and check it's the same MD-5. */
   {
     const svn_checksum_t *looked_up_md5;
 
@@ -443,7 +444,8 @@ pristine_dehydrate(const svn_test_opts_t
   SVN_ERR(create_repos_and_wc(&wc_abspath, &db,
                               "pristine_dehydrate", opts, pool));
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, db, wc_abspath, pool));
+  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL, db,
+                                  wc_abspath, pool));
   if (store_pristine)
     return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
                             "Test assumes a working copy without pristine");

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/utils.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/utils.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/utils.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/utils.c Thu \
Jan 19 18:51:16 2023 @@ -143,12 +143,14 @@ svn_test__create_fake_wc(const char *wc_
 
   /* Allocate MY_STATEMENTS in RESULT_POOL because the SDB will continue to
    * refer to it over its lifetime. */
-  my_statements = apr_palloc(scratch_pool, 7 * sizeof(const char *));
+  my_statements = apr_palloc(scratch_pool, 8 * sizeof(const char *));
   i = 0;
   my_statements[i++] = statements[STMT_CREATE_SCHEMA];
   my_statements[i++] = extra_statements;
   if (target_format >= 32)
     my_statements[i++] = statements[STMT_UPGRADE_TO_32];
+  if (target_format >= 33)
+    my_statements[i++] = statements[STMT_UPGRADE_TO_33];
   my_statements[i++] = statements[STMT_INSTALL_SCHEMA_STATISTICS];
   my_statements[i++] = NULL;
 

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-queries-test.c \
Thu Jan 19 18:51:16 2023 @@ -74,6 +74,7 @@ static const int schema_statements[] =
   STMT_CREATE_SCHEMA,
   /* (executing STMT_UPGRADE_TO_xx is conditional on desired WC format) */
   STMT_UPGRADE_TO_32,
+  STMT_UPGRADE_TO_33,
   STMT_INSTALL_SCHEMA_STATISTICS,
   /* Memory tables */
   STMT_CREATE_TARGETS_LIST,
@@ -186,6 +187,8 @@ create_memory_db(sqlite3 **db,
     {
       if (target_format < 32 && schema_statements[i] == STMT_UPGRADE_TO_32)
         continue;
+      if (target_format < 33 && schema_statements[i] == STMT_UPGRADE_TO_33)
+        continue;
       SQLITE_ERR(sqlite3_exec(sdb, wc_queries[schema_statements[i]], NULL, NULL, \
NULL));  }
 

Modified: subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-test.c
                
URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-test.c?rev=1906821&r1=1906820&r2=1906821&view=diff
 ==============================================================================
--- subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-test.c \
                (original)
+++ subversion/branches/pristine-checksum-kind/subversion/tests/libsvn_wc/wc-test.c \
Thu Jan 19 18:51:16 2023 @@ -782,7 +782,7 @@ test_get_pristine_copy_path(const svn_te
 
   SVN_ERR(svn_test__sandbox_create(&b, "get_pristine_copy_path", opts, pool));
 
-  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine,
+  SVN_ERR(svn_wc__db_get_settings(NULL, &store_pristine, NULL,
                                   b.wc_ctx->db, b.wc_abspath, pool));
   if (!store_pristine)
     return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic