Fix compiler warning due to missing function prototype.
[svn.git] / subversion / tests / cmdline / checkout_tests.py
blob134a749961baa1dca6f5ab7ac3ffec5fbc32d4ed
1 #!/usr/bin/env python
3 # checkout_tests.py: Testing checkout --force behavior when local
4 # tree already exits.
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 ######################################################################
20 # General modules
21 import sys, re, os, time
23 # Our testing module
24 import svntest
25 from svntest import wc
27 # (abbreviation)
28 Skip = svntest.testcase.Skip
29 XFail = svntest.testcase.XFail
30 Item = wc.StateItem
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)
38 for line in stderr:
39 if exp_err_re.search(line):
40 return
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:
50 # iota
51 # A/
52 # A/mu
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:
63 # 'sigma'
64 # 'A/upsilon'
65 # 'A/Z/'
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,
85 export_target,
86 expected_output,
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?
95 if mod_files:
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?
104 if add_unversioned:
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")
110 os.mkdir(Z_path)
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 ######################################################################
136 # Tests
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')
159 os.mkdir(other_wc)
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 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
165 "Expected error during co", None, svntest.verify.AnyOutput,
166 "co", "--force", sbox.repo_url, other_wc)
168 test_stderr(".*Failed to add file.*a non-file object of the same name " \
169 "already exists", serr)
171 #----------------------------------------------------------------------
173 def forced_checkout_of_dir_with_file_obstructions(sbox):
174 """forced co fails if a file obstructs a dir"""
176 make_local_tree(sbox, False, False)
178 # Make the "other" working copy
179 other_wc = sbox.add_wc_path('other')
180 os.mkdir(other_wc)
181 svntest.main.file_append(os.path.join(other_wc, "A"), "The file A")
183 # Checkout the standard greek repos into a directory that has a file named
184 # "A" obstructing the dir "A" in the repos. This should fail.
185 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
186 "Expected error during co", None, svntest.verify.AnyOutput,
187 "co", "--force", sbox.repo_url, other_wc)
189 test_stderr(".*Failed to add directory.*a non-directory object of the " \
190 "same name already exists", serr)
192 #----------------------------------------------------------------------
194 def forced_checkout_with_faux_obstructions(sbox):
195 """co with faux obstructions ok with --force"""
197 # Make a local tree that partially obstructs the paths coming from the
198 # repos but has no true differences.
199 expected_output = make_local_tree(sbox, False, False)
201 expected_wc = svntest.main.greek_state.copy()
203 svntest.actions.run_and_verify_checkout(sbox.repo_url,
204 sbox.wc_dir, expected_output,
205 expected_wc, None, None, None,
206 None, '--force')
208 #----------------------------------------------------------------------
210 def forced_checkout_with_real_obstructions(sbox):
211 """co with real obstructions ok with --force"""
213 # Make a local tree that partially obstructs the paths coming from the
214 # repos and make the obstructing files different from the standard greek
215 # tree.
216 expected_output = make_local_tree(sbox, True, False)
218 expected_wc = svntest.main.greek_state.copy()
219 expected_wc.tweak('A/mu',
220 contents="This is the local version of the file 'mu'.\n")
221 expected_wc.tweak('iota',
222 contents="This is the local version of the file 'iota'.\n")
224 svntest.actions.run_and_verify_checkout(sbox.repo_url,
225 sbox.wc_dir, expected_output,
226 expected_wc, None, None, None,
227 None, '--force')
229 #----------------------------------------------------------------------
231 def forced_checkout_with_real_obstructions_and_unversioned_files(sbox):
232 """co with real obstructions and unversioned files"""
234 # Make a local tree that partially obstructs the paths coming from the
235 # repos, make the obstructing files different from the standard greek
236 # tree, and finally add some files that don't exist in the stardard tree.
237 expected_output = make_local_tree(sbox, True, True)
239 expected_wc = svntest.main.greek_state.copy()
240 expected_wc.tweak('A/mu',
241 contents="This is the local version of the file 'mu'.\n")
242 expected_wc.tweak('iota',
243 contents="This is the local version of the file 'iota'.\n")
244 expected_wc.add({'sigma' : Item("unversioned sigma"),
245 'A/upsilon' : Item("unversioned upsilon"),
246 'A/Z' : Item(),
249 svntest.actions.run_and_verify_checkout(sbox.repo_url,
250 sbox.wc_dir, expected_output,
251 expected_wc, None, None, None,
252 None, '--force')
254 #----------------------------------------------------------------------
256 def forced_checkout_with_versioned_obstruction(sbox):
257 """forced co with versioned obstruction"""
259 # Make a greek tree working copy
260 sbox.build(read_only = True)
262 # Create a second repository with the same greek tree
263 repo_dir = sbox.repo_dir
264 repo_url = sbox.repo_url
265 other_repo_dir, other_repo_url = sbox.add_repo_path("other")
266 svntest.main.copy_repos(repo_dir, other_repo_dir, 1, 1)
268 other_wc_dir = sbox.add_wc_path("other")
269 os.mkdir(other_wc_dir)
271 # Checkout "A/" from the other repos.
272 svntest.actions.run_and_verify_svn("Unexpected error during co",
273 svntest.verify.AnyOutput, [],
274 "co", other_repo_url + "/A",
275 os.path.join(other_wc_dir, "A"))
277 # Checkout the first repos into "other/A". This should fail since the
278 # obstructing versioned directory points to a different URL.
279 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
280 "Expected error during co", None, svntest.verify.AnyOutput,
281 "co", "--force", sbox.repo_url, other_wc_dir)
283 test_stderr("svn: Failed to add directory '.*A': a versioned directory " \
284 "of the same name already exists", serr)
286 #----------------------------------------------------------------------
287 # Ensure that an import followed by a checkout in place works correctly.
288 def import_and_checkout(sbox):
289 """import and checkout"""
291 sbox.build(read_only = True)
293 other_repo_dir, other_repo_url = sbox.add_repo_path("other")
294 import_from_dir = sbox.add_wc_path("other")
296 # Export greek tree to import_from_dir
297 expected_output = svntest.main.greek_state.copy()
298 expected_output.wc_dir = import_from_dir
299 expected_output.desc[''] = Item()
300 expected_output.tweak(contents=None, status='A ')
301 svntest.actions.run_and_verify_export(sbox.repo_url,
302 import_from_dir,
303 expected_output,
304 svntest.main.greek_state.copy())
306 # Create the 'other' repos
307 svntest.main.create_repos(other_repo_dir)
309 # Import import_from_dir to the other repos
310 expected_output = svntest.wc.State(sbox.wc_dir, {})
312 svntest.actions.run_and_verify_svn(None, None, [], 'import',
313 '-m', 'import', import_from_dir,
314 other_repo_url)
316 expected_output = wc.State(import_from_dir, {
317 "A" : Item(status='E '),
318 "A/B" : Item(status='E '),
319 "A/B/lambda" : Item(status='E '),
320 "A/B/E" : Item(status='E '),
321 "A/B/E/alpha" : Item(status='E '),
322 "A/B/E/beta" : Item(status='E '),
323 "A/B/F" : Item(status='E '),
324 "A/mu" : Item(status='E '),
325 "A/C" : Item(status='E '),
326 "A/D" : Item(status='E '),
327 "A/D/gamma" : Item(status='E '),
328 "A/D/G" : Item(status='E '),
329 "A/D/G/pi" : Item(status='E '),
330 "A/D/G/rho" : Item(status='E '),
331 "A/D/G/tau" : Item(status='E '),
332 "A/D/H" : Item(status='E '),
333 "A/D/H/chi" : Item(status='E '),
334 "A/D/H/omega" : Item(status='E '),
335 "A/D/H/psi" : Item(status='E '),
336 "iota" : Item(status='E ')
339 expected_wc = svntest.main.greek_state.copy()
341 svntest.actions.run_and_verify_checkout(other_repo_url, import_from_dir,
342 expected_output, expected_wc,
343 None, None, None, None,
344 '--force')
346 #----------------------------------------------------------------------
347 # Issue #2529.
348 def checkout_broken_eol(sbox):
349 "checkout file with broken eol style"
351 svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
352 'update_tests_data',
353 'checkout_broken_eol.dump'))
355 URL = sbox.repo_url
357 expected_output = svntest.wc.State(sbox.wc_dir, {
358 'file': Item(status='A '),
361 expected_wc = svntest.wc.State('', {
362 'file': Item(contents='line\nline2\n'),
364 svntest.actions.run_and_verify_checkout(URL,
365 sbox.wc_dir,
366 expected_output,
367 expected_wc)
369 def checkout_creates_intermediate_folders(sbox):
370 "checkout and create some intermediate folders"
372 sbox.build(create_wc = False, read_only = True)
374 checkout_target = os.path.join(sbox.wc_dir, 'a', 'b', 'c')
376 # checkout a working copy in a/b/c, should create these intermediate
377 # folders
378 expected_output = svntest.main.greek_state.copy()
379 expected_output.wc_dir = checkout_target
380 expected_output.tweak(status='A ', contents=None)
382 expected_wc = svntest.main.greek_state
384 svntest.actions.run_and_verify_checkout(sbox.repo_url,
385 checkout_target,
386 expected_output,
387 expected_wc)
389 # Test that, if a peg revision is provided without an explicit revision,
390 # svn will checkout the directory as it was at rPEG, rather than at HEAD.
391 def checkout_peg_rev(sbox):
392 "checkout with peg revision"
394 sbox.build()
395 wc_dir = sbox.wc_dir
396 # create a new revision
397 mu_path = os.path.join(wc_dir, 'A', 'mu')
398 svntest.main.file_append(mu_path, 'appended mu text')
400 svntest.actions.run_and_verify_svn(None, None, [],
401 'ci', '-m', 'changed file mu', wc_dir)
403 # now checkout the repo@1 in another folder, this should create our initial
404 # wc without the change in mu.
405 checkout_target = sbox.add_wc_path('checkout')
406 os.mkdir(checkout_target)
408 expected_output = svntest.main.greek_state.copy()
409 expected_output.wc_dir = checkout_target
410 expected_output.tweak(status='A ', contents=None)
412 expected_wc = svntest.main.greek_state.copy()
414 svntest.actions.run_and_verify_checkout(sbox.repo_url + '@1',
415 checkout_target,
416 expected_output,
417 expected_wc)
419 #----------------------------------------------------------------------
420 # Issue 2602: Test that peg revision dates are correctly supported.
421 def checkout_peg_rev_date(sbox):
422 "checkout with peg revision date"
424 sbox.build()
425 wc_dir = sbox.wc_dir
427 # note the current time to use it as peg revision date.
428 current_time = time.strftime("%Y-%m-%dT%H:%M:%S")
430 # sleep till the next minute.
431 current_sec = time.localtime().tm_sec
432 time.sleep(62-current_sec)
434 # create a new revision
435 mu_path = os.path.join(wc_dir, 'A', 'mu')
436 svntest.main.file_append(mu_path, 'appended mu text')
438 svntest.actions.run_and_verify_svn(None, None, [],
439 'ci', '-m', 'changed file mu', wc_dir)
441 # now checkout the repo@current_time in another folder, this should create our
442 # initial wc without the change in mu.
443 checkout_target = sbox.add_wc_path('checkout')
444 os.mkdir(checkout_target)
446 expected_output = svntest.main.greek_state.copy()
447 expected_output.wc_dir = checkout_target
448 expected_output.tweak(status='A ', contents=None)
450 expected_wc = svntest.main.greek_state.copy()
452 # use an old date to checkout, that way we're sure we get the first revision
453 svntest.actions.run_and_verify_checkout(sbox.repo_url +
454 '@{' + current_time + '}',
455 checkout_target,
456 expected_output,
457 expected_wc)
459 #----------------------------------------------------------------------
460 def co_with_obstructing_local_adds(sbox):
461 "co handles obstructing paths scheduled for add"
463 sbox.build()
464 wc_dir = sbox.wc_dir
466 # Make a backup copy of the working copy
467 wc_backup = sbox.add_wc_path('backup')
468 svntest.actions.duplicate_dir(wc_dir, wc_backup)
470 # Add files and dirs to the repos via the first WC. Each of these
471 # will be added to the backup WC via an update:
473 # A/B/upsilon: Identical to the file scheduled for addition in
474 # the backup WC.
476 # A/C/nu: A "normal" add, won't exist in the backup WC.
478 # A/D/kappa: Conflicts with the file scheduled for addition in
479 # the backup WC.
481 # A/D/H/I: New dirs that will also be scheduled for addition
482 # A/D/H/I/J: in the backup WC.
483 # A/D/H/I/K:
485 # A/D/H/I/L: A "normal" dir add, won't exist in the backup WC.
487 # A/D/H/I/K/xi: Identical to the file scheduled for addition in
488 # the backup WC.
490 # A/D/H/I/K/eta: Conflicts with the file scheduled for addition in
491 # the backup WC.
492 upsilon_path = os.path.join(wc_dir, 'A', 'B', 'upsilon')
493 svntest.main.file_append(upsilon_path, "This is the file 'upsilon'\n")
494 nu_path = os.path.join(wc_dir, 'A', 'C', 'nu')
495 svntest.main.file_append(nu_path, "This is the file 'nu'\n")
496 kappa_path = os.path.join(wc_dir, 'A', 'D', 'kappa')
497 svntest.main.file_append(kappa_path, "This is REPOS file 'kappa'\n")
498 I_path = os.path.join(wc_dir, 'A', 'D', 'H', 'I')
499 os.mkdir(I_path)
500 J_path = os.path.join(I_path, 'J')
501 os.mkdir(J_path)
502 K_path = os.path.join(I_path, 'K')
503 os.mkdir(K_path)
504 L_path = os.path.join(I_path, 'L')
505 os.mkdir(L_path)
506 xi_path = os.path.join(K_path, 'xi')
507 svntest.main.file_append(xi_path, "This is file 'xi'\n")
508 eta_path = os.path.join(K_path, 'eta')
509 svntest.main.file_append(eta_path, "This is REPOS file 'eta'\n")
510 svntest.main.run_svn(None, 'add', upsilon_path, nu_path,
511 kappa_path, I_path)
513 # Created expected output tree for 'svn ci'
514 expected_output = wc.State(wc_dir, {
515 'A/B/upsilon' : Item(verb='Adding'),
516 'A/C/nu' : Item(verb='Adding'),
517 'A/D/kappa' : Item(verb='Adding'),
518 'A/D/H/I' : Item(verb='Adding'),
519 'A/D/H/I/J' : Item(verb='Adding'),
520 'A/D/H/I/K' : Item(verb='Adding'),
521 'A/D/H/I/K/xi' : Item(verb='Adding'),
522 'A/D/H/I/K/eta' : Item(verb='Adding'),
523 'A/D/H/I/L' : Item(verb='Adding'),
526 # Create expected status tree.
527 expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
528 expected_status.add({
529 'A/B/upsilon' : Item(status=' ', wc_rev=2),
530 'A/C/nu' : Item(status=' ', wc_rev=2),
531 'A/D/kappa' : Item(status=' ', wc_rev=2),
532 'A/D/H/I' : Item(status=' ', wc_rev=2),
533 'A/D/H/I/J' : Item(status=' ', wc_rev=2),
534 'A/D/H/I/K' : Item(status=' ', wc_rev=2),
535 'A/D/H/I/K/xi' : Item(status=' ', wc_rev=2),
536 'A/D/H/I/K/eta' : Item(status=' ', wc_rev=2),
537 'A/D/H/I/L' : Item(status=' ', wc_rev=2),
540 # Commit.
541 svntest.actions.run_and_verify_commit(wc_dir, expected_output,
542 expected_status, None, wc_dir)
544 # Create various paths scheduled for addition which will obstruct
545 # the adds coming from the repos.
546 upsilon_backup_path = os.path.join(wc_backup, 'A', 'B', 'upsilon')
547 svntest.main.file_append(upsilon_backup_path,
548 "This is the file 'upsilon'\n")
549 kappa_backup_path = os.path.join(wc_backup, 'A', 'D', 'kappa')
550 svntest.main.file_append(kappa_backup_path,
551 "This is WC file 'kappa'\n")
552 I_backup_path = os.path.join(wc_backup, 'A', 'D', 'H', 'I')
553 os.mkdir(I_backup_path)
554 J_backup_path = os.path.join(I_backup_path, 'J')
555 os.mkdir(J_backup_path)
556 K_backup_path = os.path.join(I_backup_path, 'K')
557 os.mkdir(K_backup_path)
558 xi_backup_path = os.path.join(K_backup_path, 'xi')
559 svntest.main.file_append(xi_backup_path, "This is file 'xi'\n")
560 eta_backup_path = os.path.join(K_backup_path, 'eta')
561 svntest.main.file_append(eta_backup_path, "This is WC file 'eta'\n")
562 svntest.main.run_svn(None, 'add',
563 upsilon_backup_path,
564 kappa_backup_path,
565 I_backup_path)
567 # Create expected output tree for an update of the wc_backup.
568 expected_output = wc.State(wc_backup, {
569 'A/B/upsilon' : Item(status='E '),
570 'A/C/nu' : Item(status='A '),
571 'A/D/H/I' : Item(status='E '),
572 'A/D/H/I/J' : Item(status='E '),
573 'A/D/H/I/K' : Item(status='E '),
574 'A/D/H/I/K/xi' : Item(status='E '),
575 'A/D/H/I/K/eta' : Item(status='C '),
576 'A/D/H/I/L' : Item(status='A '),
577 'A/D/kappa' : Item(status='C '),
580 # Create expected disk for update of wc_backup.
581 expected_disk = svntest.main.greek_state.copy()
582 expected_disk.add({
583 'A/B/upsilon' : Item("This is the file 'upsilon'\n"),
584 'A/C/nu' : Item("This is the file 'nu'\n"),
585 'A/D/H/I' : Item(),
586 'A/D/H/I/J' : Item(),
587 'A/D/H/I/K' : Item(),
588 'A/D/H/I/K/xi' : Item("This is file 'xi'\n"),
589 'A/D/H/I/K/eta' : Item("\n".join(["<<<<<<< .mine",
590 "This is WC file 'eta'",
591 "=======",
592 "This is REPOS file 'eta'",
593 ">>>>>>> .r2",
594 ""])),
595 'A/D/H/I/L' : Item(),
596 'A/D/kappa' : Item("\n".join(["<<<<<<< .mine",
597 "This is WC file 'kappa'",
598 "=======",
599 "This is REPOS file 'kappa'",
600 ">>>>>>> .r2",
601 ""])),
604 # Create expected status tree for the update. Since the obstructing
605 # kappa and upsilon differ from the repos, they should show as modified.
606 expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
607 expected_status.add({
608 'A/B/upsilon' : Item(status=' ', wc_rev=2),
609 'A/C/nu' : Item(status=' ', wc_rev=2),
610 'A/D/H/I' : Item(status=' ', wc_rev=2),
611 'A/D/H/I/J' : Item(status=' ', wc_rev=2),
612 'A/D/H/I/K' : Item(status=' ', wc_rev=2),
613 'A/D/H/I/K/xi' : Item(status=' ', wc_rev=2),
614 'A/D/H/I/K/eta' : Item(status='C ', wc_rev=2),
615 'A/D/H/I/L' : Item(status=' ', wc_rev=2),
616 'A/D/kappa' : Item(status='C ', wc_rev=2),
619 # "Extra" files that we expect to result from the conflicts.
620 extra_files = ['eta\.r0', 'eta\.r2', 'eta\.mine',
621 'kappa\.r0', 'kappa\.r2', 'kappa\.mine']
623 # Perform forced update and check the results in three ways.
624 # We use --force here because run_and_verify_checkout() will delete
625 # wc_backup before performing the checkout otherwise.
626 svntest.actions.run_and_verify_checkout(sbox.repo_url, wc_backup,
627 expected_output, expected_disk,
628 svntest.tree.detect_conflict_files,
629 extra_files, None, None,
630 '--force')
632 svntest.actions.run_and_verify_status(wc_backup, expected_status)
634 # Some obstructions are still not permitted:
636 # Test that file and dir obstructions scheduled for addition *with*
637 # history fail when update tries to add the same path.
639 # URL to URL copy of A/D/G to A/D/M.
640 G_URL = sbox.repo_url + '/A/D/G'
641 M_URL = sbox.repo_url + '/A/D/M'
642 svntest.actions.run_and_verify_svn("Copy error:", None, [],
643 'cp', G_URL, M_URL, '-m', '')
645 # WC to WC copy of A/D/H to A/D/M. (M is now scheduled for addition
646 # with history in WC and pending addition from the repos).
647 D_path = os.path.join(wc_dir, 'A', 'D')
648 H_path = os.path.join(wc_dir, 'A', 'D', 'H')
649 M_path = os.path.join(wc_dir, 'A', 'D', 'M')
651 svntest.actions.run_and_verify_svn("Copy error:", None, [],
652 'cp', H_path, M_path)
654 # URL to URL copy of A/B/E/alpha to A/B/F/omicron.
655 omega_URL = sbox.repo_url + '/A/B/E/alpha'
656 omicron_URL = sbox.repo_url + '/A/B/F/omicron'
657 svntest.actions.run_and_verify_svn("Copy error:", None, [],
658 'cp', omega_URL, omicron_URL,
659 '-m', '')
661 # WC to WC copy of A/D/H/chi to /A/B/F/omicron. (omicron is now
662 # scheduled for addition with history in WC and pending addition
663 # from the repos).
664 F_path = os.path.join(wc_dir, 'A', 'B', 'F')
665 omicron_path = os.path.join(wc_dir, 'A', 'B', 'F', 'omicron')
666 chi_path = os.path.join(wc_dir, 'A', 'D', 'H', 'chi')
668 svntest.actions.run_and_verify_svn("Copy error:", None, [],
669 'cp', chi_path,
670 omicron_path)
672 # Try to co M's Parent.
673 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
674 "Checkout XPASS", [], svntest.verify.AnyOutput,
675 'checkout', sbox.repo_url + '/A/D', D_path)
677 test_stderr("svn: Failed to add directory '.*M': a versioned " \
678 "directory of the same name already exists\n", serr)
680 # --force shouldn't help either.
681 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
682 "Checkout XPASS", [], svntest.verify.AnyOutput,
683 'checkout', sbox.repo_url + '/A/D', D_path, '--force')
685 test_stderr("svn: Failed to add directory '.*M': a versioned " \
686 "directory of the same name already exists\n", serr)
688 # Try to co omicron's parent.
689 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
690 "Checkout XPASS", [], svntest.verify.AnyOutput,
691 'checkout', sbox.repo_url + '/A/B/F', F_path)
693 test_stderr("svn: Failed to add file '.*omicron': a file of the same " \
694 "name is already scheduled for addition with history\n", serr)
696 # Again, --force shouldn't matter.
697 exit_code, sout, serr = svntest.actions.run_and_verify_svn(
698 "Checkout XPASS", [], svntest.verify.AnyOutput,
699 'checkout', sbox.repo_url + '/A/B/F', F_path, '--force')
701 test_stderr("svn: Failed to add file '.*omicron': a file of the same " \
702 "name is already scheduled for addition with history\n", serr)
704 #----------------------------------------------------------------------
706 # list all tests here, starting with None:
707 test_list = [ None,
708 checkout_with_obstructions,
709 forced_checkout_of_file_with_dir_obstructions,
710 forced_checkout_of_dir_with_file_obstructions,
711 forced_checkout_with_faux_obstructions,
712 forced_checkout_with_real_obstructions,
713 forced_checkout_with_real_obstructions_and_unversioned_files,
714 forced_checkout_with_versioned_obstruction,
715 import_and_checkout,
716 checkout_broken_eol,
717 checkout_creates_intermediate_folders,
718 checkout_peg_rev,
719 checkout_peg_rev_date,
720 co_with_obstructing_local_adds,
723 if __name__ == "__main__":
724 svntest.main.run_tests(test_list)
725 # NOTREACHED
728 ### End of file.