3 # checkout_tests.py: Testing checkout --force behavior when local
6 # Subversion is a tool for revision control.
7 # See http://subversion.tigris.org for more information.
9 # ====================================================================
10 # Copyright (c) 2000-2006 CollabNet. All rights reserved.
12 # This software is licensed as described in the file COPYING, which
13 # you should have received as part of this distribution. The terms
14 # are also available at http://subversion.tigris.org/license-1.html.
15 # If newer versions of this license are posted there, you may use a
16 # newer version instead, at your option.
18 ######################################################################
21 import sys
, re
, os
, time
25 from svntest
import wc
28 Skip
= svntest
.testcase
.Skip
29 XFail
= svntest
.testcase
.XFail
32 #----------------------------------------------------------------------
33 # Helper function for testing stderr from co.
34 # If none of the strings in STDERR list matches the regular expression
35 # RE_STRING raise an error.
36 def test_stderr(re_string
, stderr
):
37 exp_err_re
= re
.compile(re_string
)
39 if exp_err_re
.search(line
):
41 raise svntest
.Failure("Checkout failed but not in the expected way")
43 #----------------------------------------------------------------------
44 # Helper function to set up an existing local tree that has paths which
45 # obstruct with the incoming WC.
47 # Build a sandbox SBOX without a WC. Created the following paths
48 # rooted at SBOX.WC_DIR:
54 # If MOD_FILES is FALSE, 'iota' and 'A/mu' have the same contents as the
55 # standard greek tree. If TRUE the contents of each as set as follows:
57 # iota : contents == "This is the local version of the file 'iota'.\n"
58 # A/mu : contents == "This is the local version of the file 'mu'.\n"
60 # If ADD_UNVERSIONED is TRUE, add the following files and directories,
61 # rooted in SBOX.WC_DIR, that don't exist in the standard greek tree:
67 # Return the expected output for svn co --force SBOX.REPO_URL SBOX.WC_DIR
69 def make_local_tree(sbox
, mod_files
=False, add_unversioned
=False):
70 """Make a local unversioned tree to checkout into."""
72 sbox
.build(create_wc
= False)
74 if os
.path
.exists(sbox
.wc_dir
):
75 svntest
.main
.safe_rmtree(sbox
.wc_dir
)
77 export_target
= sbox
.wc_dir
78 expected_output
= svntest
.main
.greek_state
.copy()
79 expected_output
.wc_dir
= sbox
.wc_dir
80 expected_output
.desc
[""] = Item()
81 expected_output
.tweak(contents
=None, status
="A ")
83 # Export an unversioned tree to sbox.wc_dir.
84 svntest
.actions
.run_and_verify_export(sbox
.repo_url
,
87 svntest
.main
.greek_state
.copy())
89 # Remove everything remaining except for 'iota', 'A/', and 'A/mu'.
90 svntest
.main
.safe_rmtree(os
.path
.join(sbox
.wc_dir
, "A", "B"))
91 svntest
.main
.safe_rmtree(os
.path
.join(sbox
.wc_dir
, "A", "C"))
92 svntest
.main
.safe_rmtree(os
.path
.join(sbox
.wc_dir
, "A", "D"))
94 # Should obstructions differ from the standard greek tree?
96 iota_path
= os
.path
.join(sbox
.wc_dir
, "iota")
97 mu_path
= os
.path
.join(sbox
.wc_dir
, "A", "mu")
98 svntest
.main
.file_write(iota_path
,
99 "This is the local version of the file 'iota'.\n")
100 svntest
.main
.file_write(mu_path
,
101 "This is the local version of the file 'mu'.\n")
103 # Add some files that won't obstruct anything in standard greek tree?
105 sigma_path
= os
.path
.join(sbox
.wc_dir
, "sigma")
106 svntest
.main
.file_append(sigma_path
, "unversioned sigma")
107 upsilon_path
= os
.path
.join(sbox
.wc_dir
, "A", "upsilon")
108 svntest
.main
.file_append(upsilon_path
, "unversioned upsilon")
109 Z_path
= os
.path
.join(sbox
.wc_dir
, "A", "Z")
112 return wc
.State(sbox
.wc_dir
, {
113 "A" : Item(status
='E '), # Obstruction
114 "A/B" : Item(status
='A '),
115 "A/B/lambda" : Item(status
='A '),
116 "A/B/E" : Item(status
='A '),
117 "A/B/E/alpha" : Item(status
='A '),
118 "A/B/E/beta" : Item(status
='A '),
119 "A/B/F" : Item(status
='A '),
120 "A/mu" : Item(status
='E '), # Obstruction
121 "A/C" : Item(status
='A '),
122 "A/D" : Item(status
='A '),
123 "A/D/gamma" : Item(status
='A '),
124 "A/D/G" : Item(status
='A '),
125 "A/D/G/pi" : Item(status
='A '),
126 "A/D/G/rho" : Item(status
='A '),
127 "A/D/G/tau" : Item(status
='A '),
128 "A/D/H" : Item(status
='A '),
129 "A/D/H/chi" : Item(status
='A '),
130 "A/D/H/omega" : Item(status
='A '),
131 "A/D/H/psi" : Item(status
='A '),
132 "iota" : Item(status
='E '), # Obstruction
135 ######################################################################
138 # Each test must return on success or raise on failure.
139 #----------------------------------------------------------------------
141 def checkout_with_obstructions(sbox
):
142 """co with obstructions should fail without --force"""
144 make_local_tree(sbox
, False, False)
146 svntest
.actions
.run_and_verify_svn("No error where some expected",
147 None, svntest
.verify
.AnyOutput
,
148 "co", sbox
.repo_url
, sbox
.wc_dir
)
150 #----------------------------------------------------------------------
152 def forced_checkout_of_file_with_dir_obstructions(sbox
):
153 """forced co fails if a dir obstructs a file"""
155 make_local_tree(sbox
, False, False)
157 # Make the "other" working copy
158 other_wc
= sbox
.add_wc_path('other')
160 os
.mkdir(os
.path
.join(other_wc
, "iota"))
162 # Checkout the standard greek repos into a directory that has a dir named
163 # "iota" obstructing the file "iota" in the repos. This should fail.
164 sout
, serr
= svntest
.actions
.run_and_verify_svn("Expected error during co",
166 svntest
.verify
.AnyOutput
,
168 sbox
.repo_url
, other_wc
)
170 test_stderr(".*Failed to add file.*a non-file object of the same name " \
171 "already exists", serr
)
173 #----------------------------------------------------------------------
175 def forced_checkout_of_dir_with_file_obstructions(sbox
):
176 """forced co fails if a file obstructs a dir"""
178 make_local_tree(sbox
, False, False)
180 # Make the "other" working copy
181 other_wc
= sbox
.add_wc_path('other')
183 svntest
.main
.file_append(os
.path
.join(other_wc
, "A"), "The file A")
185 # Checkout the standard greek repos into a directory that has a file named
186 # "A" obstructing the dir "A" in the repos. This should fail.
187 sout
, serr
= svntest
.actions
.run_and_verify_svn("Expected error during co",
189 svntest
.verify
.AnyOutput
,
191 sbox
.repo_url
, other_wc
)
193 test_stderr(".*Failed to add directory.*a non-directory object of the " \
194 "same name already exists", serr
)
196 #----------------------------------------------------------------------
198 def forced_checkout_with_faux_obstructions(sbox
):
199 """co with faux obstructions ok with --force"""
201 # Make a local tree that partially obstructs the paths coming from the
202 # repos but has no true differences.
203 expected_output
= make_local_tree(sbox
, False, False)
205 expected_wc
= svntest
.main
.greek_state
.copy()
207 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
,
208 sbox
.wc_dir
, expected_output
,
209 expected_wc
, None, None, None,
212 #----------------------------------------------------------------------
214 def forced_checkout_with_real_obstructions(sbox
):
215 """co with real obstructions ok with --force"""
217 # Make a local tree that partially obstructs the paths coming from the
218 # repos and make the obstructing files different from the standard greek
220 expected_output
= make_local_tree(sbox
, True, False)
222 expected_wc
= svntest
.main
.greek_state
.copy()
223 expected_wc
.tweak('A/mu',
224 contents
="This is the local version of the file 'mu'.\n")
225 expected_wc
.tweak('iota',
226 contents
="This is the local version of the file 'iota'.\n")
228 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
,
229 sbox
.wc_dir
, expected_output
,
230 expected_wc
, None, None, None,
233 #----------------------------------------------------------------------
235 def forced_checkout_with_real_obstructions_and_unversioned_files(sbox
):
236 """co with real obstructions and unversioned files"""
238 # Make a local tree that partially obstructs the paths coming from the
239 # repos, make the obstructing files different from the standard greek
240 # tree, and finally add some files that don't exist in the stardard tree.
241 expected_output
= make_local_tree(sbox
, True, True)
243 expected_wc
= svntest
.main
.greek_state
.copy()
244 expected_wc
.tweak('A/mu',
245 contents
="This is the local version of the file 'mu'.\n")
246 expected_wc
.tweak('iota',
247 contents
="This is the local version of the file 'iota'.\n")
248 expected_wc
.add({'sigma' : Item("unversioned sigma"),
249 'A/upsilon' : Item("unversioned upsilon"),
253 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
,
254 sbox
.wc_dir
, expected_output
,
255 expected_wc
, None, None, None,
258 #----------------------------------------------------------------------
260 def forced_checkout_with_versioned_obstruction(sbox
):
261 """forced co with versioned obstruction"""
263 # Make a greek tree working copy
264 sbox
.build(read_only
= True)
266 # Create a second repository with the same greek tree
267 repo_dir
= sbox
.repo_dir
268 repo_url
= sbox
.repo_url
269 other_repo_dir
, other_repo_url
= sbox
.add_repo_path("other")
270 svntest
.main
.copy_repos(repo_dir
, other_repo_dir
, 1, 1)
272 other_wc_dir
= sbox
.add_wc_path("other")
273 os
.mkdir(other_wc_dir
)
275 # Checkout "A/" from the other repos.
276 svntest
.actions
.run_and_verify_svn("Unexpected error during co",
277 svntest
.verify
.AnyOutput
, [],
278 "co", other_repo_url
+ "/A",
279 os
.path
.join(other_wc_dir
, "A"))
281 # Checkout the first repos into "other/A". This should fail since the
282 # obstructing versioned directory points to a different URL.
283 sout
, serr
= svntest
.actions
.run_and_verify_svn("Expected error during co",
285 svntest
.verify
.AnyOutput
,
287 sbox
.repo_url
, other_wc_dir
)
289 test_stderr("svn: Failed to add directory '.*A': a versioned directory " \
290 "of the same name already exists", serr
)
292 #----------------------------------------------------------------------
293 # Ensure that an import followed by a checkout in place works correctly.
294 def import_and_checkout(sbox
):
295 """import and checkout"""
297 sbox
.build(read_only
= True)
299 other_repo_dir
, other_repo_url
= sbox
.add_repo_path("other")
300 import_from_dir
= sbox
.add_wc_path("other")
302 # Export greek tree to import_from_dir
303 expected_output
= svntest
.main
.greek_state
.copy()
304 expected_output
.wc_dir
= import_from_dir
305 expected_output
.desc
[''] = Item()
306 expected_output
.tweak(contents
=None, status
='A ')
307 svntest
.actions
.run_and_verify_export(sbox
.repo_url
,
310 svntest
.main
.greek_state
.copy())
312 # Create the 'other' repos
313 svntest
.main
.create_repos(other_repo_dir
)
315 # Import import_from_dir to the other repos
316 expected_output
= svntest
.wc
.State(sbox
.wc_dir
, {})
318 svntest
.actions
.run_and_verify_svn(None, None, [], 'import',
319 '-m', 'import', import_from_dir
,
322 expected_output
= wc
.State(import_from_dir
, {
323 "A" : Item(status
='E '),
324 "A/B" : Item(status
='E '),
325 "A/B/lambda" : Item(status
='E '),
326 "A/B/E" : Item(status
='E '),
327 "A/B/E/alpha" : Item(status
='E '),
328 "A/B/E/beta" : Item(status
='E '),
329 "A/B/F" : Item(status
='E '),
330 "A/mu" : Item(status
='E '),
331 "A/C" : Item(status
='E '),
332 "A/D" : Item(status
='E '),
333 "A/D/gamma" : Item(status
='E '),
334 "A/D/G" : Item(status
='E '),
335 "A/D/G/pi" : Item(status
='E '),
336 "A/D/G/rho" : Item(status
='E '),
337 "A/D/G/tau" : Item(status
='E '),
338 "A/D/H" : Item(status
='E '),
339 "A/D/H/chi" : Item(status
='E '),
340 "A/D/H/omega" : Item(status
='E '),
341 "A/D/H/psi" : Item(status
='E '),
342 "iota" : Item(status
='E ')
345 expected_wc
= svntest
.main
.greek_state
.copy()
347 svntest
.actions
.run_and_verify_checkout(other_repo_url
, import_from_dir
,
348 expected_output
, expected_wc
,
349 None, None, None, None,
352 #----------------------------------------------------------------------
354 def checkout_broken_eol(sbox
):
355 "checkout file with broken eol style"
357 svntest
.actions
.load_repo(sbox
, os
.path
.join(os
.path
.dirname(sys
.argv
[0]),
359 'checkout_broken_eol.dump'))
363 expected_output
= svntest
.wc
.State(sbox
.wc_dir
, {
364 'file': Item(status
='A '),
367 expected_wc
= svntest
.wc
.State('', {
368 'file': Item(contents
='line\nline2\n'),
370 svntest
.actions
.run_and_verify_checkout(URL
,
375 def checkout_creates_intermediate_folders(sbox
):
376 "checkout and create some intermediate folders"
378 sbox
.build(create_wc
= False, read_only
= True)
380 checkout_target
= os
.path
.join(sbox
.wc_dir
, 'a', 'b', 'c')
382 # checkout a working copy in a/b/c, should create these intermediate
384 expected_output
= svntest
.main
.greek_state
.copy()
385 expected_output
.wc_dir
= checkout_target
386 expected_output
.tweak(status
='A ', contents
=None)
388 expected_wc
= svntest
.main
.greek_state
390 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
,
395 # Test that, if a peg revision is provided without an explicit revision,
396 # svn will checkout the directory as it was at rPEG, rather than at HEAD.
397 def checkout_peg_rev(sbox
):
398 "checkout with peg revision"
402 # create a new revision
403 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
404 svntest
.main
.file_append(mu_path
, 'appended mu text')
406 svntest
.actions
.run_and_verify_svn(None, None, [],
407 'ci', '-m', 'changed file mu', wc_dir
)
409 # now checkout the repo@1 in another folder, this should create our initial
410 # wc without the change in mu.
411 checkout_target
= sbox
.add_wc_path('checkout')
412 os
.mkdir(checkout_target
)
414 expected_output
= svntest
.main
.greek_state
.copy()
415 expected_output
.wc_dir
= checkout_target
416 expected_output
.tweak(status
='A ', contents
=None)
418 expected_wc
= svntest
.main
.greek_state
.copy()
420 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
+ '@1',
425 #----------------------------------------------------------------------
426 # Issue 2602: Test that peg revision dates are correctly supported.
427 def checkout_peg_rev_date(sbox
):
428 "checkout with peg revision date"
433 # note the current time to use it as peg revision date.
434 current_time
= time
.strftime("%Y-%m-%dT%H:%M:%S")
436 # sleep till the next minute.
437 current_sec
= time
.localtime().tm_sec
438 time
.sleep(62-current_sec
)
440 # create a new revision
441 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
442 svntest
.main
.file_append(mu_path
, 'appended mu text')
444 svntest
.actions
.run_and_verify_svn(None, None, [],
445 'ci', '-m', 'changed file mu', wc_dir
)
447 # now checkout the repo@current_time in another folder, this should create our
448 # initial wc without the change in mu.
449 checkout_target
= sbox
.add_wc_path('checkout')
450 os
.mkdir(checkout_target
)
452 expected_output
= svntest
.main
.greek_state
.copy()
453 expected_output
.wc_dir
= checkout_target
454 expected_output
.tweak(status
='A ', contents
=None)
456 expected_wc
= svntest
.main
.greek_state
.copy()
458 # use an old date to checkout, that way we're sure we get the first revision
459 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
+
460 '@{' + current_time
+ '}',
465 #----------------------------------------------------------------------
466 def co_with_obstructing_local_adds(sbox
):
467 "co handles obstructing paths scheduled for add"
472 # Make a backup copy of the working copy
473 wc_backup
= sbox
.add_wc_path('backup')
474 svntest
.actions
.duplicate_dir(wc_dir
, wc_backup
)
476 # Add files and dirs to the repos via the first WC. Each of these
477 # will be added to the backup WC via an update:
479 # A/B/upsilon: Identical to the file scheduled for addition in
482 # A/C/nu: A "normal" add, won't exist in the backup WC.
484 # A/D/kappa: Conflicts with the file scheduled for addition in
487 # A/D/H/I: New dirs that will also be scheduled for addition
488 # A/D/H/I/J: in the backup WC.
491 # A/D/H/I/L: A "normal" dir add, won't exist in the backup WC.
493 # A/D/H/I/K/xi: Identical to the file scheduled for addition in
496 # A/D/H/I/K/eta: Conflicts with the file scheduled for addition in
498 upsilon_path
= os
.path
.join(wc_dir
, 'A', 'B', 'upsilon')
499 svntest
.main
.file_append(upsilon_path
, "This is the file 'upsilon'\n")
500 nu_path
= os
.path
.join(wc_dir
, 'A', 'C', 'nu')
501 svntest
.main
.file_append(nu_path
, "This is the file 'nu'\n")
502 kappa_path
= os
.path
.join(wc_dir
, 'A', 'D', 'kappa')
503 svntest
.main
.file_append(kappa_path
, "This is REPOS file 'kappa'\n")
504 I_path
= os
.path
.join(wc_dir
, 'A', 'D', 'H', 'I')
506 J_path
= os
.path
.join(I_path
, 'J')
508 K_path
= os
.path
.join(I_path
, 'K')
510 L_path
= os
.path
.join(I_path
, 'L')
512 xi_path
= os
.path
.join(K_path
, 'xi')
513 svntest
.main
.file_append(xi_path
, "This is file 'xi'\n")
514 eta_path
= os
.path
.join(K_path
, 'eta')
515 svntest
.main
.file_append(eta_path
, "This is REPOS file 'eta'\n")
516 svntest
.main
.run_svn(None, 'add', upsilon_path
, nu_path
,
519 # Created expected output tree for 'svn ci'
520 expected_output
= wc
.State(wc_dir
, {
521 'A/B/upsilon' : Item(verb
='Adding'),
522 'A/C/nu' : Item(verb
='Adding'),
523 'A/D/kappa' : Item(verb
='Adding'),
524 'A/D/H/I' : Item(verb
='Adding'),
525 'A/D/H/I/J' : Item(verb
='Adding'),
526 'A/D/H/I/K' : Item(verb
='Adding'),
527 'A/D/H/I/K/xi' : Item(verb
='Adding'),
528 'A/D/H/I/K/eta' : Item(verb
='Adding'),
529 'A/D/H/I/L' : Item(verb
='Adding'),
532 # Create expected status tree.
533 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
534 expected_status
.add({
535 'A/B/upsilon' : Item(status
=' ', wc_rev
=2),
536 'A/C/nu' : Item(status
=' ', wc_rev
=2),
537 'A/D/kappa' : Item(status
=' ', wc_rev
=2),
538 'A/D/H/I' : Item(status
=' ', wc_rev
=2),
539 'A/D/H/I/J' : Item(status
=' ', wc_rev
=2),
540 'A/D/H/I/K' : Item(status
=' ', wc_rev
=2),
541 'A/D/H/I/K/xi' : Item(status
=' ', wc_rev
=2),
542 'A/D/H/I/K/eta' : Item(status
=' ', wc_rev
=2),
543 'A/D/H/I/L' : Item(status
=' ', wc_rev
=2),
547 svntest
.actions
.run_and_verify_commit(wc_dir
, expected_output
,
548 expected_status
, None, wc_dir
)
550 # Create various paths scheduled for addition which will obstruct
551 # the adds coming from the repos.
552 upsilon_backup_path
= os
.path
.join(wc_backup
, 'A', 'B', 'upsilon')
553 svntest
.main
.file_append(upsilon_backup_path
,
554 "This is the file 'upsilon'\n")
555 kappa_backup_path
= os
.path
.join(wc_backup
, 'A', 'D', 'kappa')
556 svntest
.main
.file_append(kappa_backup_path
,
557 "This is WC file 'kappa'\n")
558 I_backup_path
= os
.path
.join(wc_backup
, 'A', 'D', 'H', 'I')
559 os
.mkdir(I_backup_path
)
560 J_backup_path
= os
.path
.join(I_backup_path
, 'J')
561 os
.mkdir(J_backup_path
)
562 K_backup_path
= os
.path
.join(I_backup_path
, 'K')
563 os
.mkdir(K_backup_path
)
564 xi_backup_path
= os
.path
.join(K_backup_path
, 'xi')
565 svntest
.main
.file_append(xi_backup_path
, "This is file 'xi'\n")
566 eta_backup_path
= os
.path
.join(K_backup_path
, 'eta')
567 svntest
.main
.file_append(eta_backup_path
, "This is WC file 'eta'\n")
568 svntest
.main
.run_svn(None, 'add',
573 # Create expected output tree for an update of the wc_backup.
574 expected_output
= wc
.State(wc_backup
, {
575 'A/B/upsilon' : Item(status
='E '),
576 'A/C/nu' : Item(status
='A '),
577 'A/D/H/I' : Item(status
='E '),
578 'A/D/H/I/J' : Item(status
='E '),
579 'A/D/H/I/K' : Item(status
='E '),
580 'A/D/H/I/K/xi' : Item(status
='E '),
581 'A/D/H/I/K/eta' : Item(status
='C '),
582 'A/D/H/I/L' : Item(status
='A '),
583 'A/D/kappa' : Item(status
='C '),
586 # Create expected disk for update of wc_backup.
587 expected_disk
= svntest
.main
.greek_state
.copy()
589 'A/B/upsilon' : Item("This is the file 'upsilon'\n"),
590 'A/C/nu' : Item("This is the file 'nu'\n"),
592 'A/D/H/I/J' : Item(),
593 'A/D/H/I/K' : Item(),
594 'A/D/H/I/K/xi' : Item("This is file 'xi'\n"),
595 'A/D/H/I/K/eta' : Item("\n".join(["<<<<<<< .mine",
596 "This is WC file 'eta'",
598 "This is REPOS file 'eta'",
601 'A/D/H/I/L' : Item(),
602 'A/D/kappa' : Item("\n".join(["<<<<<<< .mine",
603 "This is WC file 'kappa'",
605 "This is REPOS file 'kappa'",
610 # Create expected status tree for the update. Since the obstructing
611 # kappa and upsilon differ from the repos, they should show as modified.
612 expected_status
= svntest
.actions
.get_virginal_state(wc_backup
, 2)
613 expected_status
.add({
614 'A/B/upsilon' : Item(status
=' ', wc_rev
=2),
615 'A/C/nu' : Item(status
=' ', wc_rev
=2),
616 'A/D/H/I' : Item(status
=' ', wc_rev
=2),
617 'A/D/H/I/J' : Item(status
=' ', wc_rev
=2),
618 'A/D/H/I/K' : Item(status
=' ', wc_rev
=2),
619 'A/D/H/I/K/xi' : Item(status
=' ', wc_rev
=2),
620 'A/D/H/I/K/eta' : Item(status
='C ', wc_rev
=2),
621 'A/D/H/I/L' : Item(status
=' ', wc_rev
=2),
622 'A/D/kappa' : Item(status
='C ', wc_rev
=2),
625 # "Extra" files that we expect to result from the conflicts.
626 extra_files
= ['eta\.r0', 'eta\.r2', 'eta\.mine',
627 'kappa\.r0', 'kappa\.r2', 'kappa\.mine']
629 # Perform forced update and check the results in three ways.
630 # We use --force here because run_and_verify_checkout() will delete
631 # wc_backup before performing the checkout otherwise.
632 svntest
.actions
.run_and_verify_checkout(sbox
.repo_url
, wc_backup
,
633 expected_output
, expected_disk
,
634 svntest
.tree
.detect_conflict_files
,
635 extra_files
, None, None,
638 svntest
.actions
.run_and_verify_status(wc_backup
, expected_status
)
640 # Some obstructions are still not permitted:
642 # Test that file and dir obstructions scheduled for addition *with*
643 # history fail when update tries to add the same path.
645 # URL to URL copy of A/D/G to A/D/M.
646 G_URL
= sbox
.repo_url
+ '/A/D/G'
647 M_URL
= sbox
.repo_url
+ '/A/D/M'
648 svntest
.actions
.run_and_verify_svn("Copy error:", None, [],
649 'cp', G_URL
, M_URL
, '-m', '')
651 # WC to WC copy of A/D/H to A/D/M. (M is now scheduled for addition
652 # with history in WC and pending addition from the repos).
653 D_path
= os
.path
.join(wc_dir
, 'A', 'D')
654 H_path
= os
.path
.join(wc_dir
, 'A', 'D', 'H')
655 M_path
= os
.path
.join(wc_dir
, 'A', 'D', 'M')
657 svntest
.actions
.run_and_verify_svn("Copy error:", None, [],
658 'cp', H_path
, M_path
)
660 # URL to URL copy of A/B/E/alpha to A/B/F/omicron.
661 omega_URL
= sbox
.repo_url
+ '/A/B/E/alpha'
662 omicron_URL
= sbox
.repo_url
+ '/A/B/F/omicron'
663 svntest
.actions
.run_and_verify_svn("Copy error:", None, [],
664 'cp', omega_URL
, omicron_URL
,
667 # WC to WC copy of A/D/H/chi to /A/B/F/omicron. (omicron is now
668 # scheduled for addition with history in WC and pending addition
670 F_path
= os
.path
.join(wc_dir
, 'A', 'B', 'F')
671 omicron_path
= os
.path
.join(wc_dir
, 'A', 'B', 'F', 'omicron')
672 chi_path
= os
.path
.join(wc_dir
, 'A', 'D', 'H', 'chi')
674 svntest
.actions
.run_and_verify_svn("Copy error:", None, [],
678 # Try to co M's Parent.
679 sout
, serr
= svntest
.actions
.run_and_verify_svn("Checkout XPASS",
680 [], svntest
.verify
.AnyOutput
,
682 sbox
.repo_url
+ '/A/D',
685 test_stderr("svn: Failed to add directory '.*M': a versioned " \
686 "directory of the same name already exists\n", serr
)
688 # --force shouldn't help either.
689 sout
, serr
= svntest
.actions
.run_and_verify_svn("Checkout XPASS",
690 [], svntest
.verify
.AnyOutput
,
692 sbox
.repo_url
+ '/A/D',
695 test_stderr("svn: Failed to add directory '.*M': a versioned " \
696 "directory of the same name already exists\n", serr
)
698 # Try to co omicron's parent.
699 sout
, serr
= svntest
.actions
.run_and_verify_svn("Checkout XPASS",
700 [], svntest
.verify
.AnyOutput
,
702 sbox
.repo_url
+ '/A/B/F',
705 test_stderr("svn: Failed to add file '.*omicron': a file of the same " \
706 "name is already scheduled for addition with history\n", serr
)
708 # Again, --force shouldn't matter.
709 sout
, serr
= svntest
.actions
.run_and_verify_svn("Checkout XPASS",
710 [], svntest
.verify
.AnyOutput
,
712 sbox
.repo_url
+ '/A/B/F',
715 test_stderr("svn: Failed to add file '.*omicron': a file of the same " \
716 "name is already scheduled for addition with history\n", serr
)
718 #----------------------------------------------------------------------
720 # list all tests here, starting with None:
722 checkout_with_obstructions
,
723 forced_checkout_of_file_with_dir_obstructions
,
724 forced_checkout_of_dir_with_file_obstructions
,
725 forced_checkout_with_faux_obstructions
,
726 forced_checkout_with_real_obstructions
,
727 forced_checkout_with_real_obstructions_and_unversioned_files
,
728 forced_checkout_with_versioned_obstruction
,
731 checkout_creates_intermediate_folders
,
733 checkout_peg_rev_date
,
734 co_with_obstructing_local_adds
,
737 if __name__
== "__main__":
738 svntest
.main
.run_tests(test_list
)