3
# module_tests.py: testing modules / external sources.
5
# Subversion is a tool for revision control.
6
# See http://subversion.tigris.org for more information.
8
# ====================================================================
9
# Copyright (c) 2000-2004 CollabNet. All rights reserved.
11
# This software is licensed as described in the file COPYING, which
12
# you should have received as part of this distribution. The terms
13
# are also available at http://subversion.tigris.org/license-1.html.
14
# If newer versions of this license are posted there, you may use a
15
# newer version instead, at your option.
17
######################################################################
20
import shutil, string, sys, re, os
25
from svntest import SVNAnyOutput
29
Skip = svntest.testcase.Skip
30
XFail = svntest.testcase.XFail
31
Item = svntest.wc.StateItem
34
######################################################################
37
# Each test must return on success or raise on failure.
40
#----------------------------------------------------------------------
42
### todo: it's inefficient to keep calling externals_test_setup() for
43
### every test. It's slow. But it's very safe -- we're guaranteed to
44
### have a clean repository, built from the latest Subversion, with
45
### the svn:externals properties preset in a known way. Right now I
46
### can't think of any other way to achieve that guarantee, so the
47
### result is that each individual test is slow.
49
def externals_test_setup(sbox):
50
"""Set up a repository in which some directories have the externals property,
51
and set up another repository, referred to by some of those externals.
52
Both repositories contain greek trees with five revisions worth of
53
random changes, then in the sixth revision the first repository --
54
and only the first -- has some externals properties set. ### Later,
55
test putting externals on the second repository. ###
57
The arrangement of the externals in the first repository is:
59
/A/C/ ==> exdir_G <scheme>:///<other_repos>/A/D/G
60
exdir_H -r 1 <scheme>:///<other_repos>/A/D/H
62
/A/D/ ==> exdir_A <scheme>:///<other_repos>/A
63
exdir_A/G <scheme>:///<other_repos>/A/D/G
64
exdir_A/H -r 3 <scheme>:///<other_repos>/A/D/H
65
x/y/z/blah <scheme>:///<other_repos>/A/B
67
NOTE: Before calling this, use externals_test_cleanup(SBOX) to
68
remove a previous incarnation of the other repository.
73
svntest.main.safe_rmtree(sbox.wc_dir) # The test itself will recreate this
75
wc_init_dir = sbox.add_wc_path('init') # just for setting up props
76
repo_dir = sbox.repo_dir
77
repo_url = sbox.repo_url
78
other_repo_dir, other_repo_url = sbox.add_repo_path('other')
80
# These files will get changed in revisions 2 through 5.
81
mu_path = os.path.join(wc_init_dir, "A/mu")
82
pi_path = os.path.join(wc_init_dir, "A/D/G/pi")
83
lambda_path = os.path.join(wc_init_dir, "A/B/lambda")
84
omega_path = os.path.join(wc_init_dir, "A/D/H/omega")
86
# These are the directories on which `svn:externals' will be set, in
87
# revision 6 on the first repo.
88
C_path = os.path.join(wc_init_dir, "A/C")
89
D_path = os.path.join(wc_init_dir, "A/D")
91
# Create a working copy.
92
svntest.actions.run_and_verify_svn("", None, [],
94
'--username', svntest.main.wc_author,
95
'--password', svntest.main.wc_passwd,
96
repo_url, wc_init_dir)
98
# Make revisions 2 through 5, but don't bother with pre- and
99
# post-commit status checks.
101
svntest.main.file_append(mu_path, "\nAdded to mu in revision 2.\n")
102
svntest.actions.run_and_verify_svn("", None, [],
103
'ci', '-m', 'log msg',
104
'--quiet', wc_init_dir)
106
svntest.main.file_append(pi_path, "\nAdded to pi in revision 3.\n")
107
svntest.actions.run_and_verify_svn("", None, [],
108
'ci', '-m', 'log msg',
109
'--quiet', wc_init_dir)
111
svntest.main.file_append(lambda_path, "\nAdded to lambda in revision 4.\n")
112
svntest.actions.run_and_verify_svn("", None, [],
113
'ci', '-m', 'log msg',
114
'--quiet', wc_init_dir)
116
svntest.main.file_append(omega_path, "\nAdded to omega in revision 5.\n")
117
svntest.actions.run_and_verify_svn("", None, [],
118
'ci', '-m', 'log msg',
119
'--quiet', wc_init_dir)
121
# Get the whole working copy to revision 5.
122
svntest.actions.run_and_verify_svn("", None, [], 'up', wc_init_dir)
124
# Now copy the initial repository to create the "other" repository,
125
# the one to which the first repository's `svn:externals' properties
126
# will refer. After this, both repositories have five revisions
127
# of random stuff, with no svn:externals props set yet.
128
svntest.main.copy_repos(repo_dir, other_repo_dir, 5)
130
# Set up the externals properties on A/B/ and A/D/.
132
"exdir_G " + other_repo_url + "/A/D/G" + "\n" + \
133
"exdir_H -r 1 " + other_repo_url + "/A/D/H" + "\n"
135
tmp_f = os.tempnam(wc_init_dir, 'tmp')
136
svntest.main.file_append(tmp_f, externals_desc)
137
svntest.actions.run_and_verify_svn("", None, [],
139
'-F', tmp_f, 'svn:externals', C_path)
144
"exdir_A " + other_repo_url + "/A" + \
146
"exdir_A/G/ " + other_repo_url + "/A/D/G/" + \
148
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
150
"x/y/z/blah " + other_repo_url + "/A/B" + \
153
svntest.main.file_append(tmp_f, externals_desc)
154
svntest.actions.run_and_verify_svn("", None, [], 'pset',
155
'-F', tmp_f, 'svn:externals', D_path)
159
# Commit the property changes.
161
expected_output = svntest.wc.State(wc_init_dir, {
162
'A/C' : Item(verb='Sending'),
163
'A/D' : Item(verb='Sending'),
166
expected_status = svntest.actions.get_virginal_state(wc_init_dir, 5)
167
expected_status.tweak('A/C', 'A/D', wc_rev=6, status=' ')
169
svntest.actions.run_and_verify_commit(wc_init_dir,
172
None, None, None, None, None,
176
def change_external(path, new_val):
177
"""Change the value of the externals property on PATH to NEW_VAL,
178
and commit the change."""
179
tmp_f = os.tempnam(svntest.main.temp_dir, 'tmp')
180
svntest.main.file_append(tmp_f, new_val)
181
svntest.actions.run_and_verify_svn("", None, [], 'pset',
182
'-F', tmp_f, 'svn:externals', path)
183
svntest.actions.run_and_verify_svn("", None, [], 'ci',
184
'-m', 'log msg', '--quiet', path)
188
#----------------------------------------------------------------------
191
### todo: It would be great if everything used the new wc.py system to
192
### check output/status. In fact, it would be great to do more output
193
### and status checking period! But must first see how well the
194
### output checkers deal with multiple summary lines. With external
195
### modules, you can get the first "Updated to revision X" line, and
196
### then there will be more "Updated to..." and "Checked out..." lines
197
### following it, one line for each new or changed external.
200
#----------------------------------------------------------------------
202
def checkout_with_externals(sbox):
203
"test checkouts with externals"
205
externals_test_setup(sbox)
208
repo_dir = sbox.repo_dir
209
repo_url = sbox.repo_url
211
# Create a working copy.
212
svntest.actions.run_and_verify_svn("", None, [],
214
'--username', svntest.main.wc_author,
215
'--password', svntest.main.wc_passwd,
218
# Probe the working copy a bit, see if it's as expected.
219
exdir_G_path = os.path.join(wc_dir, "A", "C", "exdir_G")
220
exdir_G_pi_path = os.path.join(exdir_G_path, "pi")
221
exdir_H_path = os.path.join(wc_dir, "A", "C", "exdir_H")
222
exdir_H_omega_path = os.path.join(exdir_H_path, "omega")
223
x_path = os.path.join(wc_dir, "A", "D", "x")
224
y_path = os.path.join(x_path, "y")
225
z_path = os.path.join(y_path, "z")
226
blah_path = os.path.join(z_path, "blah")
227
alpha_path = os.path.join(blah_path, "E", "alpha")
228
beta_path = os.path.join(blah_path, "E", "beta")
230
if (not os.path.exists(exdir_G_path)):
231
raise svntest.Failure("Probing for " + exdir_G_path + " failed.")
232
if (not os.path.exists(exdir_G_pi_path)):
233
raise svntest.Failure("Probing for " + exdir_G_pi_path + " failed.")
234
if (not os.path.exists(exdir_H_path)):
235
raise svntest.Failure("Probing for " + exdir_H_path + " failed.")
236
if (not os.path.exists(exdir_H_omega_path)):
237
raise svntest.Failure("Probing for " + exdir_H_omega_path + " failed.")
238
if (not os.path.exists(x_path)):
239
raise svntest.Failure("Probing for " + x_path + " failed.")
240
if (not os.path.exists(y_path)):
241
raise svntest.Failure("Probing for " + y_path + " failed.")
242
if (not os.path.exists(z_path)):
243
raise svntest.Failure("Probing for " + z_path + " failed.")
244
if (not os.path.exists(z_path)):
245
raise svntest.Failure("Probing for " + z_path + " failed.")
246
if (not os.path.exists(alpha_path)):
247
raise svntest.Failure("Probing for " + alpha_path + " failed.")
248
if (not os.path.exists(beta_path)):
249
raise svntest.Failure("Probing for " + beta_path + " failed.")
251
# Pick a file at random, make sure it has the expected contents.
252
fp = open(exdir_H_omega_path, 'r')
253
lines = fp.readlines()
254
if not ((len(lines) == 1) and (lines[0] == "This is the file 'omega'.")):
255
raise svntest.Failure("Unexpected contents for rev 1 of " +
258
#----------------------------------------------------------------------
260
def update_receive_new_external(sbox):
261
"update to receive a new external module"
263
externals_test_setup(sbox)
266
other_wc_dir = sbox.add_wc_path('other')
267
repo_dir = sbox.repo_dir
268
repo_url = sbox.repo_url
269
other_repo_url = repo_url + ".other"
271
# Checkout two working copies.
272
svntest.actions.run_and_verify_svn("", None, [],
274
'--username', svntest.main.wc_author,
275
'--password', svntest.main.wc_passwd,
278
svntest.actions.run_and_verify_svn("", None, [],
280
'--username', svntest.main.wc_author,
281
'--password', svntest.main.wc_passwd,
282
repo_url, other_wc_dir)
284
# Add one new external item to the property on A/D. The new item is
285
# "exdir_E", deliberately added in the middle not at the end.
286
new_externals_desc = \
287
"exdir_A " + other_repo_url + "/A" + \
289
"exdir_A/G " + other_repo_url + "/A/D/G" + \
291
"exdir_E " + other_repo_url + "/A/B/E" + \
293
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
295
"x/y/z/blah " + other_repo_url + "/A/B/E" + \
298
# Set and commit the property
299
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
301
# Update the other working copy, see if we get the new item.
302
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
304
exdir_E_path = os.path.join(other_wc_dir, "A", "D", "exdir_E")
305
if (not os.path.exists(exdir_E_path)):
306
raise svntest.Failure("Probing for " + exdir_E_path + " failed.")
308
#----------------------------------------------------------------------
310
def update_lose_external(sbox):
311
"update to lose an external module"
313
externals_test_setup(sbox)
316
other_wc_dir = sbox.add_wc_path('other')
317
repo_dir = sbox.repo_dir
318
repo_url = sbox.repo_url
319
other_repo_url = repo_url + ".other"
321
# Checkout two working copies.
322
svntest.actions.run_and_verify_svn("", None, [],
324
'--username', svntest.main.wc_author,
325
'--password', svntest.main.wc_passwd,
328
svntest.actions.run_and_verify_svn("", None, [],
330
'--username', svntest.main.wc_author,
331
'--password', svntest.main.wc_passwd,
332
repo_url, other_wc_dir)
334
# Lose one new external item from A/D. The lost item is
335
# "exdir_A", chosen because there are two other externals underneath
336
# it (G and H) which are not being removed. We expect them to
337
# remain -- in other words:
340
# ------------ ------------
341
# A/D/exdir_A A/D/exdir_A
342
# A/D/exdir_A/.svn/... <GONE>
343
# A/D/exdir_A/mu <GONE>
344
# A/D/exdir_A/B/... <GONE>
345
# A/D/exdir_A/C/... <GONE>
346
# A/D/exdir_A/D/... <GONE>
347
# A/D/exdir_A/G/... A/D/exdir_A/G/...
348
# A/D/exdir_A/H/... A/D/exdir_A/H/...
350
new_externals_desc = \
351
"exdir_A/G " + other_repo_url + "/A/D/G" + \
353
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
355
"x/y/z/blah " + other_repo_url + "/A/B/E" + \
358
# Set and commit the property
359
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
361
# Update other working copy, see if lose & preserve things appropriately
362
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
364
exdir_A_path = os.path.join(other_wc_dir, "A", "D", "exdir_A")
365
if (not os.path.exists(exdir_A_path)):
366
raise svntest.Failure("Probing for " + exdir_A_path + " failed.")
368
mu_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "mu")
369
if (os.path.exists(mu_path)):
370
raise svntest.Failure(mu_path + " unexpectedly still exists.")
372
B_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "B")
373
if (os.path.exists(B_path)):
374
raise svntest.Failure(B_path + " unexpectedly still exists.")
376
C_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "C")
377
if (os.path.exists(C_path)):
378
raise svntest.Failure(C_path + " unexpectedly still exists.")
380
D_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "D")
381
if (os.path.exists(D_path)):
382
raise svntest.Failure(D_path + " unexpectedly still exists.")
384
G_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "G")
385
if (not os.path.exists(G_path)):
386
raise svntest.Failure("Probing for " + G_path + " failed.")
388
H_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "H")
389
if (not os.path.exists(H_path)):
390
raise svntest.Failure("Probing for " + H_path + " failed.")
392
#----------------------------------------------------------------------
394
def update_change_pristine_external(sbox):
395
"update change to an unmodified external module"
397
externals_test_setup(sbox)
400
other_wc_dir = sbox.add_wc_path('other')
401
repo_dir = sbox.repo_dir
402
repo_url = sbox.repo_url
403
other_repo_url = repo_url + ".other"
405
# Checkout two working copies.
406
svntest.actions.run_and_verify_svn("", None, [],
408
'--username', svntest.main.wc_author,
409
'--password', svntest.main.wc_passwd,
412
svntest.actions.run_and_verify_svn("", None, [],
414
'--username', svntest.main.wc_author,
415
'--password', svntest.main.wc_passwd,
416
repo_url, other_wc_dir)
418
# Change the "x/y/z/blah" external on A/D to point to a different
419
# URL. Since no changes were made to the old checked-out external,
420
# we should get a clean replace.
421
new_externals_desc = \
422
"exdir_A " + other_repo_url + "/A" + \
424
"exdir_A/G " + other_repo_url + "/A/D/G" + \
426
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
428
"x/y/z/blah " + other_repo_url + "/A/B/F" + \
431
# Set and commit the property
432
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
434
# Update other working copy, see if get the right change.
435
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
437
xyzb_path = os.path.join(other_wc_dir, "x", "y", "z", "blah")
439
alpha_path = os.path.join(xyzb_path, "alpha")
440
if (os.path.exists(alpha_path)):
441
raise svntest.Failure(alpha_path + " unexpectedly still exists.")
443
beta_path = os.path.join(xyzb_path, "beta")
444
if (os.path.exists(beta_path)):
445
raise svntest.Failure(beta_path + " unexpectedly still exists.")
447
def update_change_modified_external(sbox):
448
"update changes to a modified external module"
450
externals_test_setup(sbox)
453
other_wc_dir = sbox.add_wc_path('other')
454
repo_dir = sbox.repo_dir
455
repo_url = sbox.repo_url
456
other_repo_url = repo_url + ".other"
458
# Checkout two working copies.
459
svntest.actions.run_and_verify_svn("", None, [],
461
'--username', svntest.main.wc_author,
462
'--password', svntest.main.wc_passwd,
465
svntest.actions.run_and_verify_svn("", None, [],
467
'--username', svntest.main.wc_author,
468
'--password', svntest.main.wc_passwd,
469
repo_url, other_wc_dir)
471
# Make a couple of mods in the "x/y/z/blah/" external.
472
alpha_path = os.path.join(other_wc_dir, "A", "D",
473
"x", "y", "z", "blah", "alpha")
474
svntest.main.file_append(alpha_path, "\nSome new text in alpha.")
475
new_file = os.path.join(other_wc_dir, "A", "D",
476
"x", "y", "z", "blah", "fish.txt")
477
svntest.main.file_append(new_file, "This is an unversioned file.")
479
# Change the "x/y/z/blah" external on A/D to point to a different
480
# URL. There are some local mods under the old checked-out external,
481
# so the old dir should be saved under a new name.
482
new_externals_desc = \
483
"exdir_A " + other_repo_url + "/A" + \
485
"exdir_A/G " + other_repo_url + "/A/D/G" + \
487
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
489
"x/y/z/blah " + other_repo_url + "/A/B/F" + \
492
# Set and commit the property
493
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
495
# Update other working copy, see if get the right change.
496
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
498
xyzb_path = os.path.join(other_wc_dir, "x", "y", "z", "blah")
500
alpha_path = os.path.join(xyzb_path, "alpha")
501
if (os.path.exists(alpha_path)):
502
raise svntest.Failure(alpha_path + " unexpectedly still exists.")
504
beta_path = os.path.join(xyzb_path, "beta")
505
if (os.path.exists(beta_path)):
506
raise svntest.Failure(beta_path + " unexpectedly still exists.")
508
def update_receive_change_under_external(sbox):
509
"update changes under an external module"
511
externals_test_setup(sbox)
514
other_wc_dir = sbox.add_wc_path('other')
515
repo_dir = sbox.repo_dir
516
repo_url = sbox.repo_url
517
other_repo_url = repo_url + ".other"
519
# Checkout two working copies.
520
svntest.actions.run_and_verify_svn("", None, [],
522
'--username', svntest.main.wc_author,
523
'--password', svntest.main.wc_passwd,
526
svntest.actions.run_and_verify_svn("", None, [],
528
'--username', svntest.main.wc_author,
529
'--password', svntest.main.wc_passwd,
530
other_repo_url, other_wc_dir)
532
# Commit some modifications from the other_wc.
533
other_gamma_path = os.path.join(other_wc_dir, 'A', 'D', 'gamma')
534
svntest.main.file_append(other_gamma_path, "\nNew text in other gamma.")
536
expected_output = svntest.wc.State(other_wc_dir, {
537
'A/D/gamma' : Item(verb='Sending'),
539
expected_status = svntest.actions.get_virginal_state(other_wc_dir, 5)
540
expected_status.tweak('A/D/gamma', wc_rev=6)
541
svntest.actions.run_and_verify_commit(other_wc_dir,
544
None, None, None, None, None,
547
# Now update the regular wc to see if we get the change. Note that
548
# none of the module *properties* in this wc have been changed; only
549
# the source repository of the modules has received a change, and
550
# we're verifying that an update here pulls that change.
552
# The output's going to be all screwy because of the module
553
# notifications, so don't bother parsing it, just run update
555
svntest.actions.run_and_verify_svn("", None, [], 'up', wc_dir)
557
external_gamma_path = os.path.join(wc_dir, 'A', 'D', 'exdir_A', 'D', 'gamma')
558
fp = open(external_gamma_path, 'r')
559
lines = fp.readlines()
560
if not ((len(lines) == 2)
561
and (lines[0] == "This is the file 'gamma'.\n")
562
and (lines[1] == "New text in other gamma.")):
563
raise svntest.Failure("Unexpected contents for externally modified " +
567
# Commit more modifications
568
other_rho_path = os.path.join(other_wc_dir, 'A', 'D', 'G', 'rho')
569
svntest.main.file_append(other_rho_path, "\nNew text in other rho.")
571
expected_output = svntest.wc.State(other_wc_dir, {
572
'A/D/G/rho' : Item(verb='Sending'),
574
expected_status = svntest.actions.get_virginal_state(other_wc_dir, 5)
575
expected_status.tweak('A/D/gamma', wc_rev=6)
576
expected_status.tweak('A/D/G/rho', wc_rev=7)
577
svntest.actions.run_and_verify_commit(other_wc_dir,
580
None, None, None, None, None,
583
svntest.actions.run_and_verify_svn("", None, [],
584
'up', os.path.join(wc_dir, "A", "C"))
586
external_rho_path = os.path.join(wc_dir, 'A', 'C', 'exdir_G', 'rho')
587
fp = open(external_rho_path, 'r')
588
lines = fp.readlines()
589
if not ((len(lines) == 2)
590
and (lines[0] == "This is the file 'rho'.\n")
591
and (lines[1] == "New text in other rho.")):
592
raise svntest.Failure("Unexpected contents for externally modified " +
596
#----------------------------------------------------------------------
598
def modify_and_update_receive_new_external(sbox):
599
"commit and update additional externals"
601
externals_test_setup(sbox)
604
repo_dir = sbox.repo_dir
605
repo_url = sbox.repo_url
606
other_repo_url = repo_url + ".other"
608
# Checkout a working copy
609
svntest.actions.run_and_verify_svn("", None, [],
611
'--username', svntest.main.wc_author,
612
'--password', svntest.main.wc_passwd,
615
# Add one more external item
616
B_path = os.path.join(wc_dir, "A/B")
618
"exdir_G " + other_repo_url + "/A/D/G" + "\n" + \
619
"exdir_H -r 1 " + other_repo_url + "/A/D/H" + "\n" + \
620
"exdir_Z " + other_repo_url + "/A/D/H" + "\n"
623
svntest.main.file_append(tmp_f, externals_desc)
624
svntest.actions.run_and_verify_svn("", None, [],
626
'svn:externals', B_path)
629
# Now cd into A/B and try updating
630
was_cwd = os.getcwd()
633
# Once upon a time there was a core-dump here
635
svntest.actions.run_and_verify_svn("update failed",
636
SVNAnyOutput, [], 'up' )
641
exdir_Z_path = os.path.join(B_path, "exdir_Z")
642
if not os.path.exists(exdir_Z_path):
643
raise svntest.Failure("Probing for " + exdir_Z_path + " failed.")
645
#----------------------------------------------------------------------
647
def disallow_dot_or_dotdot_directory_reference(sbox):
648
"error if external target dir involves '.' or '..'"
651
repo_url = sbox.repo_url
653
# Try to set illegal externals in the original WC.
654
def set_externals_for_path_expect_error(path, val, dir):
655
tmp_f = os.tempnam(dir, 'tmp')
656
svntest.main.file_append(tmp_f, val)
657
svntest.actions.run_and_verify_svn("", None, SVNAnyOutput,
659
'svn:externals', path)
662
B_path = os.path.join(wc_dir, 'A', 'B')
663
G_path = os.path.join(wc_dir, 'A', 'D', 'G')
664
H_path = os.path.join(wc_dir, 'A', 'D', 'H')
665
C_path = os.path.join(wc_dir, 'A', 'C')
666
F_path = os.path.join(wc_dir, 'A', 'C', 'F')
667
externals_value_1 = "../foo" + " " + repo_url + "/A/B/E" + "\n"
668
externals_value_2 = "foo/bar/../baz" + " " + repo_url + "/A/B/E" + "\n"
669
externals_value_3 = "foo/.." + " " + repo_url + "/A/B/E" + "\n"
670
externals_value_4 = "." + " " + repo_url + "/A/B/E" + "\n"
671
externals_value_5 = "./" + " " + repo_url + "/A/B/E" + "\n"
672
externals_value_6 = ".." + " " + repo_url + "/A/B/E" + "\n"
673
externals_value_7 = "././/.///." + " " + repo_url + "/A/B/E" + "\n"
674
externals_value_8 = "/foo" + " " + repo_url + "/A/B/E" + "\n"
677
set_externals_for_path_expect_error(B_path, externals_value_1, wc_dir)
678
set_externals_for_path_expect_error(G_path, externals_value_2, wc_dir)
679
set_externals_for_path_expect_error(H_path, externals_value_3, wc_dir)
680
set_externals_for_path_expect_error(C_path, externals_value_4, wc_dir)
681
set_externals_for_path_expect_error(F_path, externals_value_5, wc_dir)
682
set_externals_for_path_expect_error(B_path, externals_value_6, wc_dir)
683
set_externals_for_path_expect_error(G_path, externals_value_7, wc_dir)
684
set_externals_for_path_expect_error(H_path, externals_value_8, wc_dir)
687
#----------------------------------------------------------------------
689
def export_with_externals(sbox):
690
"test exports with externals"
692
externals_test_setup(sbox)
695
repo_dir = sbox.repo_dir
696
repo_url = sbox.repo_url
698
# Create a working copy.
699
svntest.actions.run_and_verify_svn("", None, [],
701
'--username', svntest.main.wc_author,
702
'--password', svntest.main.wc_passwd,
705
# Probe the working copy a bit, see if it's as expected.
706
exdir_G_path = os.path.join(wc_dir, "A", "C", "exdir_G")
707
exdir_G_pi_path = os.path.join(exdir_G_path, "pi")
708
exdir_H_path = os.path.join(wc_dir, "A", "C", "exdir_H")
709
exdir_H_omega_path = os.path.join(exdir_H_path, "omega")
710
x_path = os.path.join(wc_dir, "A", "D", "x")
711
y_path = os.path.join(x_path, "y")
712
z_path = os.path.join(y_path, "z")
713
blah_path = os.path.join(z_path, "blah")
714
alpha_path = os.path.join(blah_path, "E", "alpha")
715
beta_path = os.path.join(blah_path, "E", "beta")
717
if (not os.path.exists(exdir_G_path)):
718
raise svntest.Failure("Probing for " + exdir_G_path + " failed.")
719
if (not os.path.exists(exdir_G_pi_path)):
720
raise svntest.Failure("Probing for " + exdir_G_pi_path + " failed.")
721
if (not os.path.exists(exdir_H_path)):
722
raise svntest.Failure("Probing for " + exdir_H_path + " failed.")
723
if (not os.path.exists(exdir_H_omega_path)):
724
raise svntest.Failure("Probing for " + exdir_H_omega_path + " failed.")
725
if (not os.path.exists(x_path)):
726
raise svntest.Failure("Probing for " + x_path + " failed.")
727
if (not os.path.exists(y_path)):
728
raise svntest.Failure("Probing for " + y_path + " failed.")
729
if (not os.path.exists(z_path)):
730
raise svntest.Failure("Probing for " + z_path + " failed.")
731
if (not os.path.exists(z_path)):
732
raise svntest.Failure("Probing for " + z_path + " failed.")
733
if (not os.path.exists(alpha_path)):
734
raise svntest.Failure("Probing for " + alpha_path + " failed.")
735
if (not os.path.exists(beta_path)):
736
raise svntest.Failure("Probing for " + beta_path + " failed.")
738
# Pick some files, make sure their contents are as expected.
739
fp = open(exdir_G_pi_path, 'r')
740
lines = fp.readlines()
741
if not ((len(lines) == 2) \
742
and (lines[0] == "This is the file 'pi'.\n") \
743
and (lines[1] == "Added to pi in revision 3.\n")):
744
raise svntest.Failure("Unexpected contents for rev 1 of " +
746
fp = open(exdir_H_omega_path, 'r')
747
lines = fp.readlines()
748
if not ((len(lines) == 1) and (lines[0] == "This is the file 'omega'.")):
749
raise svntest.Failure("Unexpected contents for rev 1 of " +
754
########################################################################
758
# list all tests here, starting with None:
760
checkout_with_externals,
761
update_receive_new_external,
762
update_lose_external,
763
update_change_pristine_external,
764
update_change_modified_external,
765
update_receive_change_under_external,
766
modify_and_update_receive_new_external,
767
disallow_dot_or_dotdot_directory_reference,
768
export_with_externals,
771
if __name__ == '__main__':
772
warnings.filterwarnings('ignore', 'tempnam', RuntimeWarning)
773
svntest.main.run_tests(test_list)