Author: rhuijben
Date: Fri Feb 27 23:47:02 2015
New Revision: 1662858

URL: http://svn.apache.org/r1662858
Log:
Remove some magic from run_and_verify_checkout(): The fact that it always
deletes what is there before invoking 'svn'.

Only a few callers expect this and the sandbox we use should be empty
anyway. Avoid some unneeded work in some callers that are affected by
this change.

* subversion/tests/cmdline/checkout_tests.py
  (checkout_with_obstructions): Use normal checkout.
  (checkout_broken_eol): Don't create a wc if the next function doesn't
    want it.

* subversion/tests/cmdline/special_tests.py
  (checkout_repo_with_symlinks,
   checkout_repo_with_unknown_special_type,
   replace_symlink_with_dir): Don't create wc as we want our own checkout.

* subversion/tests/cmdline/svntest/actions.py
  (load_repo): Make the checkout step optional.
  (run_and_verify_checkout2): Rename to/integrate in...
  (run_and_verify_checkout): ... this now single function.

* subversion/tests/cmdline/update_tests.py
  (forced_update_failures): Use the normal checkout.

Modified:
    subversion/trunk/subversion/tests/cmdline/checkout_tests.py
    subversion/trunk/subversion/tests/cmdline/special_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/checkout_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/checkout_tests.py?rev=1662858&r1=1662857&r2=1662858&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/checkout_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/checkout_tests.py Fri Feb 27 
23:47:02 2015
@@ -206,8 +206,8 @@ def checkout_with_obstructions(sbox):
     'A/B/lambda', 'A/D', 'A/D/G', 'A/D/G/rho', 'A/D/G/pi', 'A/D/G/tau',
     'A/D/H', 'A/D/H/psi', 'A/D/H/omega', 'A/D/H/chi', 'A/D/gamma', 'A/C')
 
-  actions.run_and_verify_checkout2(False, url, wc_dir, expected_output,
-                                   expected_disk)
+  actions.run_and_verify_checkout(url, wc_dir, expected_output,
+                                  expected_disk)
 
   # svn status
   expected_status = actions.get_virginal_state(wc_dir, 1)
@@ -578,7 +578,8 @@ def checkout_broken_eol(sbox):
 
   svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
                                                'update_tests_data',
-                                               'checkout_broken_eol.dump'))
+                                               'checkout_broken_eol.dump'),
+                            create_wc=False)
 
   URL = sbox.repo_url
 

Modified: subversion/trunk/subversion/tests/cmdline/special_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1662858&r1=1662857&r2=1662858&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Fri Feb 27 
23:47:02 2015
@@ -491,7 +491,8 @@ def checkout_repo_with_symlinks(sbox):
 
   svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
                                                'special_tests_data',
-                                               'symlink.dump'))
+                                               'symlink.dump'),
+                            create_wc=False)
 
   expected_output = svntest.wc.State(sbox.wc_dir, {
     'from': Item(status='A '),
@@ -557,7 +558,8 @@ def checkout_repo_with_unknown_special_t
 
   svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
                                                'special_tests_data',
-                                               'bad-special-type.dump'))
+                                               'bad-special-type.dump'),
+                            create_wc=False)
 
   expected_output = svntest.wc.State(sbox.wc_dir, {
     'special': Item(status='A '),
@@ -575,7 +577,8 @@ def replace_symlink_with_dir(sbox):
 
   svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
                                                'special_tests_data',
-                                               'symlink.dump'))
+                                               'symlink.dump'),
+                            create_wc=False)
 
   wc_dir = sbox.wc_dir
   from_path = os.path.join(wc_dir, 'from')

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1662858&r1=1662857&r2=1662858&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Fri Feb 27 
23:47:02 2015
@@ -430,7 +430,7 @@ def run_and_verify_svnsync2(expected_std
 
 
 def load_repo(sbox, dumpfile_path = None, dump_str = None,
-              bypass_prop_validation = False):
+              bypass_prop_validation = False,create_wc=True):
   "Loads the dumpfile into sbox"
   if not dump_str:
     dump_str = open(dumpfile_path, "rb").read()
@@ -443,7 +443,8 @@ def load_repo(sbox, dumpfile_path = None
   # Load the mergetracking dumpfile into the repos, and check it out the repo
   run_and_verify_load(sbox.repo_dir, dump_str.splitlines(True),
                       bypass_prop_validation)
-  run_and_verify_svn(None, [], "co", sbox.repo_url, sbox.wc_dir)
+  if create_wc:
+    run_and_verify_svn(None, [], "co", sbox.repo_url, sbox.wc_dir)
 
   return dump_str
 
@@ -480,10 +481,9 @@ def run_and_verify_svnauthz(expected_std
 #
 
 
-def run_and_verify_checkout2(do_remove,
-                             URL, wc_dir_name, output_tree, disk_tree,
-                             expected_stderr=[],
-                             *args, **kw):
+def run_and_verify_checkout(URL, wc_dir_name, output_tree, disk_tree,
+                            expected_stderr=[],
+                            *args, **kw):
   """Checkout the URL into a new directory WC_DIR_NAME. *ARGS are any
   extra optional args to the checkout subcommand.
 
@@ -500,12 +500,6 @@ def run_and_verify_checkout2(do_remove,
   if isinstance(output_tree, wc.State):
     output_tree = output_tree.old_tree()
 
-  # Remove dir if it's already there, unless this is a forced checkout.
-  # In that case assume we want to test a forced checkout's toleration
-  # of obstructing paths.
-  if do_remove:
-    main.safe_rmtree(wc_dir_name)
-
   # Checkout and make a tree of the output, using l:foo/p:bar
   ### todo: svn should not be prompting for auth info when using
   ### repositories with no auth/auth requirements
@@ -524,22 +518,6 @@ def run_and_verify_checkout2(do_remove,
   if disk_tree:
     verify_disk(wc_dir_name, disk_tree, False, **kw)
 
-def run_and_verify_checkout(URL, wc_dir_name, output_tree, disk_tree,
-                            expected_stderr=[],
-                            *args, **kw):
-  """Same as run_and_verify_checkout2(), but without the DO_REMOVE arg.
-  WC_DIR_NAME is deleted if present unless the '--force' option is passed
-  in *ARGS."""
-
-
-  # Remove dir if it's already there, unless this is a forced checkout.
-  # In that case assume we want to test a forced checkout's toleration
-  # of obstructing paths.
-  return run_and_verify_checkout2(('--force' not in args),
-                                  URL, wc_dir_name, output_tree, disk_tree,
-                                  expected_stderr, *args, **kw)
-
-
 def run_and_verify_export(URL, export_dir_name, output_tree, disk_tree,
                           *args):
   """Export the URL into a new directory WC_DIR_NAME.

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1662858&r1=1662857&r2=1662858&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Fri Feb 27 
23:47:02 2015
@@ -2210,8 +2210,8 @@ def forced_update_failures(sbox):
 
   expected_disk = svntest.wc.State(wc_dir, {})
 
-  actions.run_and_verify_checkout2(False, url_A_C_I, backup_A_C_I,
-                                   expected_output, expected_disk)
+  actions.run_and_verify_checkout(url_A_C_I, backup_A_C_I,
+                                  expected_output, expected_disk)
 
   # svn up --force wc_dir_backup/A/C
   expected_output = svntest.wc.State(wc_dir_backup, {


Reply via email to