Author: kotkov
Date: Thu Mar 2 11:11:09 2023
New Revision: 1907966
URL: http://svn.apache.org/viewvc?rev=1907966&view=rev
Log:
Fix an issue where calling `svn checkout` without a format version argument
over an existing 1.15-format working copy for the same URL returned an error:
$ svn checkout URL wc --compatible-version=1.15
[…]
$ svn checkout URL wc
$ svn: E155000: '…' is already a working copy for the same URL but its
format is 32 instead of the expected 31
As with `svn upgrade`, let's allow a case where a working copy has a supported
format newer than the implicit default. Note that if the user has explicitly
specified a lower --compatible-version, we're still going to return an error.
* subversion/libsvn_client/checkout.c
(svn_client__checkout_internal): Fail if the existing WC's format is different
than requested, but only if the format version was specified explicitly.
* subversion/tests/cmdline/checkout_tests.py
(checkout_over_existing_wc_same_url): New regression test.
(test_list): Run the new test.
Modified:
subversion/trunk/subversion/libsvn_client/checkout.c
subversion/trunk/subversion/tests/cmdline/checkout_tests.py
Modified: subversion/trunk/subversion/libsvn_client/checkout.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/checkout.c?rev=1907966&r1=1907965&r2=1907966&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/checkout.c (original)
+++ subversion/trunk/subversion/libsvn_client/checkout.c Thu Mar 2 11:11:09
2023
@@ -89,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 };
@@ -110,6 +111,7 @@ svn_client__checkout_internal(svn_revnum
&target_store_pristine,
ctx->wc_ctx, local_abspath,
scratch_pool));
+ fail_on_format_mismatch = FALSE;
}
else
{
@@ -125,6 +127,8 @@ svn_client__checkout_internal(svn_revnum
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
{
@@ -144,6 +148,8 @@ svn_client__checkout_internal(svn_revnum
required_version->patch))
target_format_version = required_version;
}
+
+ fail_on_format_mismatch = FALSE;
}
SVN_ERR(svn_wc__format_from_version(&target_format,
@@ -247,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"
Modified: subversion/trunk/subversion/tests/cmdline/checkout_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/checkout_tests.py?rev=1907966&r1=1907965&r2=1907966&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/checkout_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/checkout_tests.py Thu Mar 2
11:11:09 2023
@@ -1215,6 +1215,37 @@ def checkout_compatible_version_config(s
'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:
@@ -1234,7 +1265,8 @@ test_list = [ None,
co_with_obstructing_local_adds,
checkout_wc_from_drive,
checkout_compatible_version_arg,
- checkout_compatible_version_config
+ checkout_compatible_version_config,
+ checkout_over_existing_wc_same_url
]
if __name__ == "__main__":