You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2022/11/30 10:29:53 UTC

svn commit: r1905640 - /subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py

Author: kotkov
Date: Wed Nov 30 10:29:53 2022
New Revision: 1905640

URL: http://svn.apache.org/viewvc?rev=1905640&view=rev
Log:
On the 'pristines-on-demand-on-mwf' branch: Add tests for copies in the
--store-pristine=yes/no modes.

* subversion/tests/cmdline/store_pristine_tests.py
  (simple_copy_with_pristine,
   simple_copy_without_pristine,
   copy_modified_file_with_pristine,
   copy_modified_file_without_pristine): New tests.
  (test_list): Run new tests.

Modified:
    subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py?rev=1905640&r1=1905639&r2=1905640&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py Wed Nov 30 10:29:53 2022
@@ -553,6 +553,144 @@ def update_modified_file_without_pristin
                                         expected_disk,
                                         expected_status)
 
+def simple_copy_with_pristine(sbox):
+  "simple copy with pristine"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_wc = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(sbox.repo_url,
+                                          sbox.wc_dir,
+                                          expected_output,
+                                          expected_wc,
+                                          [],
+                                          "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
+  sbox.simple_append('file', 'foo')
+  sbox.simple_add('file')
+  sbox.simple_commit(message='r1')
+
+  svntest.actions.run_and_verify_svn(None, [], 'copy',
+                                     sbox.ospath('file'),
+                                     sbox.ospath('file2'))
+
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+    ''      : Item(status='  ', wc_rev=0),
+    'file'  : Item(status='  ', wc_rev=1),
+    'file2' : Item(status='A ', wc_rev='-', copied='+'),
+    })
+  svntest.actions.run_and_verify_status(sbox.wc_dir,
+                                        expected_status)
+
+@SkipUnless(svntest.main.wc_supports_optional_pristine)
+def simple_copy_without_pristine(sbox):
+  "simple copy without pristine"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_wc = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(sbox.repo_url,
+                                          sbox.wc_dir,
+                                          expected_output,
+                                          expected_wc,
+                                          [],
+                                          "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
+  sbox.simple_append('file', 'foo')
+  sbox.simple_add('file')
+  sbox.simple_commit(message='r1')
+
+  svntest.actions.run_and_verify_svn(None, [], 'copy',
+                                     sbox.ospath('file'),
+                                     sbox.ospath('file2'))
+
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+    ''      : Item(status='  ', wc_rev=0),
+    'file'  : Item(status='  ', wc_rev=1),
+    'file2' : Item(status='A ', wc_rev='-', copied='+'),
+    })
+  svntest.actions.run_and_verify_status(sbox.wc_dir,
+                                        expected_status)
+
+def copy_modified_file_with_pristine(sbox):
+  "copy locally modified file with pristine"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_wc = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(sbox.repo_url,
+                                          sbox.wc_dir,
+                                          expected_output,
+                                          expected_wc,
+                                          [],
+                                          "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
+  sbox.simple_append('file', 'foo')
+  sbox.simple_add('file')
+  sbox.simple_commit(message='r1')
+
+  sbox.simple_append('file', 'bar')
+
+  svntest.actions.run_and_verify_svn(None, [], 'copy',
+                                     sbox.ospath('file'),
+                                     sbox.ospath('file2'))
+
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+    ''      : Item(status='  ', wc_rev=0),
+    'file'  : Item(status='M ', wc_rev=1),
+    'file2' : Item(status='A ', wc_rev='-', copied='+'),
+    })
+  svntest.actions.run_and_verify_status(sbox.wc_dir,
+                                        expected_status)
+
+@SkipUnless(svntest.main.wc_supports_optional_pristine)
+def copy_modified_file_without_pristine(sbox):
+  "copy locally modified file without pristine"
+
+  sbox.build(empty=True, create_wc=False)
+  expected_output = svntest.wc.State(sbox.wc_dir, {})
+  expected_wc = svntest.wc.State('', {})
+  svntest.actions.run_and_verify_checkout(sbox.repo_url,
+                                          sbox.wc_dir,
+                                          expected_output,
+                                          expected_wc,
+                                          [],
+                                          "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
+  sbox.simple_append('file', 'foo')
+  sbox.simple_add('file')
+  sbox.simple_commit(message='r1')
+
+  sbox.simple_append('file', 'bar')
+
+  svntest.actions.run_and_verify_svn(None, [], 'copy',
+                                     sbox.ospath('file'),
+                                     sbox.ospath('file2'))
+
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+    ''      : Item(status='  ', wc_rev=0),
+    'file'  : Item(status='M ', wc_rev=1),
+    'file2' : Item(status='A ', wc_rev='-', copied='+'),
+    })
+  svntest.actions.run_and_verify_status(sbox.wc_dir,
+                                        expected_status)
+
 ########################################################################
 # Run the tests
 
@@ -573,6 +711,10 @@ test_list = [ None,
               simple_revert_without_pristine,
               update_modified_file_with_pristine,
               update_modified_file_without_pristine,
+              simple_copy_with_pristine,
+              simple_copy_without_pristine,
+              copy_modified_file_with_pristine,
+              copy_modified_file_without_pristine,
              ]
 serial_only = True