3 # trans_tests.py: testing eol conversion and keyword substitution
5 # Subversion is a tool for revision control.
6 # See http://subversion.tigris.org for more information.
8 # ====================================================================
9 # Copyright (c) 2000-2006 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 ######################################################################
24 from svntest
import wc
27 Skip
= svntest
.testcase
.Skip
28 XFail
= svntest
.testcase
.XFail
29 Item
= svntest
.wc
.StateItem
32 ######################################################################
35 # *** Perhaps something like commit_tests.py:make_standard_slew_of_changes
36 # is in order here in this file as well. ***
39 # enable translation, status
40 # (now throw local text mods into the picture)
43 # enable translation, commit
44 # (now throw local text mods into the picture)
47 # checkout stuff with translation enabled
50 # disable translation, status
51 # change newline conversion to different style, status
52 # (now throw local text mods into the picture)
55 # disable translation, commit
56 # change newline conversion to different style, commit
57 # (now throw local text mods into the picture)
58 # (now throw local text mods with tortured line endings into the picture)
61 # update files from disabled translation to enabled translation
62 # update files from enabled translation to disabled translation
63 # update files with newline conversion style changes
64 # (now throw local text mods into the picture)
65 # (now throw conflicting local property mods into the picture)
71 # Paths that the tests test.
72 author_rev_unexp_path
= ''
73 author_rev_exp_path
= ''
74 bogus_keywords_path
= ''
75 embd_author_rev_unexp_path
= ''
76 embd_author_rev_exp_path
= ''
77 embd_bogus_keywords_path
= ''
79 def check_keywords(actual_kw
, expected_kw
, name
):
80 """A Helper function to compare two keyword lists"""
82 if len(actual_kw
) != len(expected_kw
):
83 print "Keyword lists are different by size"
86 for i
in range(0,len(actual_kw
)):
87 if actual_kw
[i
] != expected_kw
[i
]:
88 print '%s item %s, Expected: %s' % (name
, i
, expected_kw
[i
][:-1])
89 print '%s item %s, Got: %s' % (name
, i
, actual_kw
[i
][:-1])
92 def setup_working_copy(wc_dir
, value_len
):
93 """Setup a standard test working copy, then create (but do not add)
94 various files for testing translation."""
96 global author_rev_unexp_path
97 global author_rev_exp_path
102 global bogus_keywords_path
103 global embd_author_rev_unexp_path
104 global embd_author_rev_exp_path
105 global embd_bogus_keywords_path
106 global fixed_length_keywords_path
107 global id_with_space_path
108 global id_exp_with_dollar_path
110 # NOTE: Only using author and revision keywords in tests for now,
111 # since they return predictable substitutions.
113 # Unexpanded, expanded, and bogus keywords; sometimes as the only
114 # content of the files, sometimes embedded in non-keyword content.
115 author_rev_unexp_path
= os
.path
.join(wc_dir
, 'author_rev_unexp')
116 author_rev_exp_path
= os
.path
.join(wc_dir
, 'author_rev_exp')
117 url_unexp_path
= os
.path
.join(wc_dir
, 'url_unexp')
118 url_exp_path
= os
.path
.join(wc_dir
, 'url_exp')
119 id_unexp_path
= os
.path
.join(wc_dir
, 'id_unexp')
120 id_exp_path
= os
.path
.join(wc_dir
, 'id_exp')
121 bogus_keywords_path
= os
.path
.join(wc_dir
, 'bogus_keywords')
122 embd_author_rev_unexp_path
= os
.path
.join(wc_dir
, 'embd_author_rev_unexp')
123 embd_author_rev_exp_path
= os
.path
.join(wc_dir
, 'embd_author_rev_exp')
124 embd_bogus_keywords_path
= os
.path
.join(wc_dir
, 'embd_bogus_keywords')
125 fixed_length_keywords_path
= os
.path
.join(wc_dir
, 'fixed_length_keywords')
126 id_with_space_path
= os
.path
.join(wc_dir
, 'id with space')
127 id_exp_with_dollar_path
= os
.path
.join(wc_dir
, 'id_exp with_$_sign')
129 svntest
.main
.file_append(author_rev_unexp_path
, "$Author$\n$Rev$")
130 svntest
.main
.file_append(author_rev_exp_path
, "$Author: blah $\n$Rev: 0 $")
131 svntest
.main
.file_append(url_unexp_path
, "$URL$")
132 svntest
.main
.file_append(url_exp_path
, "$URL: blah $")
133 svntest
.main
.file_append(id_unexp_path
, "$Id$")
134 svntest
.main
.file_append(id_exp_path
, "$Id: blah $")
135 svntest
.main
.file_append(bogus_keywords_path
, "$Arthur$\n$Rev0$")
136 svntest
.main
.file_append(embd_author_rev_unexp_path
,
137 "one\nfish\n$Author$ two fish\n red $Rev$\n fish")
138 svntest
.main
.file_append(embd_author_rev_exp_path
,
139 "blue $Author: blah $ fish$Rev: 0 $\nI fish")
140 svntest
.main
.file_append(embd_bogus_keywords_path
,
141 "you fish $Arthur$then\n we$Rev0$ \n\nchew fish")
143 keyword_test_targets
= [
144 # User tries to shoot him or herself on the foot
148 # Following are valid entries
150 "$URL:: %s $\n" % (' ' * (value_len
-1)),
151 "$URL:: %s $\n" % (' ' * value_len
),
152 # Check we will clean the truncate marker when the value fits exactly
153 "$URL:: %s#$\n" % ('a' * value_len
),
154 "$URL:: %s $\n" % (' ' * (value_len
+1)),
155 # These are syntactically wrong
156 "$URL::x%s $\n" % (' ' * value_len
),
157 "$URL:: %sx$\n" % (' ' * value_len
),
158 "$URL::x%sx$\n" % (' ' * value_len
)
161 for i
in keyword_test_targets
:
162 svntest
.main
.file_append(fixed_length_keywords_path
, i
)
164 svntest
.main
.file_append(id_with_space_path
, "$Id$")
165 svntest
.main
.file_append(id_exp_with_dollar_path
,
166 "$Id: id_exp with_$_sign 1 2006-06-10 11:10:00Z jrandom $")
169 ### Helper functions for setting/removing properties
171 # Set the property keyword for PATH. Turn on all possible keywords.
172 # ### todo: Later, take list of keywords to set.
173 def keywords_on(path
):
174 svntest
.actions
.run_and_verify_svn(None, None, [], 'propset',
175 "svn:keywords", "Author Rev Date URL Id",
178 # Delete property NAME from versioned PATH in the working copy.
179 # ### todo: Later, take list of keywords to remove from the propval?
180 def keywords_off(path
):
181 svntest
.actions
.run_and_verify_svn(None, None, [], 'propdel',
182 "svn:keywords", path
)
185 ######################################################################
188 # Each test must return on success or raise on failure.
190 #----------------------------------------------------------------------
192 ### This test is know to fail when Subversion is built in very deep
193 ### directory structures, caused by SVN_KEYWORD_MAX_LEN being defined
195 def keywords_from_birth(sbox
):
196 "commit new files with keywords active from birth"
201 canonical_repo_url
= svntest
.main
.canonicalize_url(sbox
.repo_url
)
202 if canonical_repo_url
[-1:] != '/':
203 url_expand_test_data
= canonical_repo_url
+ '/fixed_length_keywords'
205 url_expand_test_data
= canonical_repo_url
+ 'fixed_length_keywords'
207 setup_working_copy(wc_dir
, len(url_expand_test_data
))
210 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
211 expected_status
.add({
212 'author_rev_unexp' : Item(status
='A ', wc_rev
=0),
213 'author_rev_exp' : Item(status
='A ', wc_rev
=0),
214 'url_unexp' : Item(status
='A ', wc_rev
=0),
215 'url_exp' : Item(status
='A ', wc_rev
=0),
216 'id_unexp' : Item(status
='A ', wc_rev
=0),
217 'id_exp' : Item(status
='A ', wc_rev
=0),
218 'bogus_keywords' : Item(status
='A ', wc_rev
=0),
219 'embd_author_rev_unexp' : Item(status
='A ', wc_rev
=0),
220 'embd_author_rev_exp' : Item(status
='A ', wc_rev
=0),
221 'embd_bogus_keywords' : Item(status
='A ', wc_rev
=0),
222 'fixed_length_keywords' : Item(status
='A ', wc_rev
=0),
223 'id with space' : Item(status
='A ', wc_rev
=0),
224 'id_exp with_$_sign' : Item(status
='A ', wc_rev
=0),
227 svntest
.main
.run_svn(None, 'add', author_rev_unexp_path
)
228 svntest
.main
.run_svn(None, 'add', author_rev_exp_path
)
229 svntest
.main
.run_svn(None, 'add', url_unexp_path
)
230 svntest
.main
.run_svn(None, 'add', url_exp_path
)
231 svntest
.main
.run_svn(None, 'add', id_unexp_path
)
232 svntest
.main
.run_svn(None, 'add', id_exp_path
)
233 svntest
.main
.run_svn(None, 'add', bogus_keywords_path
)
234 svntest
.main
.run_svn(None, 'add', embd_author_rev_unexp_path
)
235 svntest
.main
.run_svn(None, 'add', embd_author_rev_exp_path
)
236 svntest
.main
.run_svn(None, 'add', embd_bogus_keywords_path
)
237 svntest
.main
.run_svn(None, 'add', fixed_length_keywords_path
)
238 svntest
.main
.run_svn(None, 'add', id_with_space_path
)
239 svntest
.main
.run_svn(None, 'add', id_exp_with_dollar_path
)
241 svntest
.actions
.run_and_verify_status(wc_dir
, expected_status
)
243 # Add the keyword properties.
244 keywords_on(author_rev_unexp_path
)
245 keywords_on(url_unexp_path
)
246 keywords_on(url_exp_path
)
247 keywords_on(id_unexp_path
)
248 keywords_on(id_exp_path
)
249 keywords_on(embd_author_rev_exp_path
)
250 keywords_on(fixed_length_keywords_path
)
251 keywords_on(id_with_space_path
)
252 keywords_on(id_exp_with_dollar_path
)
255 expected_output
= svntest
.wc
.State(wc_dir
, {
256 'author_rev_unexp' : Item(verb
='Adding'),
257 'author_rev_exp' : Item(verb
='Adding'),
258 'url_unexp' : Item(verb
='Adding'),
259 'url_exp' : Item(verb
='Adding'),
260 'id_unexp' : Item(verb
='Adding'),
261 'id_exp' : Item(verb
='Adding'),
262 'bogus_keywords' : Item(verb
='Adding'),
263 'embd_author_rev_unexp' : Item(verb
='Adding'),
264 'embd_author_rev_exp' : Item(verb
='Adding'),
265 'embd_bogus_keywords' : Item(verb
='Adding'),
266 'fixed_length_keywords' : Item(verb
='Adding'),
267 'id with space' : Item(verb
='Adding'),
268 'id_exp with_$_sign' : Item(verb
='Adding'),
271 svntest
.actions
.run_and_verify_commit(wc_dir
, expected_output
,
274 # Make sure the unexpanded URL keyword got expanded correctly.
275 fp
= open(url_unexp_path
, 'r')
276 lines
= fp
.readlines()
277 if not ((len(lines
) == 1)
278 and (re
.match("\$URL: (http|file|svn|svn\\+ssh)://", lines
[0]))):
279 print "URL expansion failed for", url_unexp_path
280 raise svntest
.Failure
283 # Make sure the preexpanded URL keyword got reexpanded correctly.
284 fp
= open(url_exp_path
, 'r')
285 lines
= fp
.readlines()
286 if not ((len(lines
) == 1)
287 and (re
.match("\$URL: (http|file|svn|svn\\+ssh)://", lines
[0]))):
288 print "URL expansion failed for", url_exp_path
289 raise svntest
.Failure
292 # Make sure the unexpanded Id keyword got expanded correctly.
293 fp
= open(id_unexp_path
, 'r')
294 lines
= fp
.readlines()
295 if not ((len(lines
) == 1)
296 and (re
.match("\$Id: id_unexp", lines
[0]))):
297 print "Id expansion failed for", id_exp_path
298 raise svntest
.Failure
301 # Make sure the preexpanded Id keyword got reexpanded correctly.
302 fp
= open(id_exp_path
, 'r')
303 lines
= fp
.readlines()
304 if not ((len(lines
) == 1)
305 and (re
.match("\$Id: id_exp", lines
[0]))):
306 print "Id expansion failed for", id_exp_path
307 raise svntest
.Failure
310 # Check fixed length keywords.
315 '$URL:: %s#$\n' % url_expand_test_data
[0:1],
316 '$URL:: %s#$\n' % url_expand_test_data
[:-1],
317 '$URL:: %s $\n' % url_expand_test_data
,
318 '$URL:: %s $\n' % url_expand_test_data
,
319 '$URL:: %s $\n'% url_expand_test_data
,
320 '$URL::x%s $\n' % (' ' * len(url_expand_test_data
)),
321 '$URL:: %sx$\n' % (' ' * len(url_expand_test_data
)),
322 '$URL::x%sx$\n' % (' ' * len(url_expand_test_data
))
325 fp
= open(fixed_length_keywords_path
, 'r')
326 actual_workingcopy_kw
= fp
.readlines()
328 check_keywords(actual_workingcopy_kw
, kw_workingcopy
, "working copy")
330 # Check text base for fixed length keywords.
336 '$URL:: %s $\n' % (' ' * len(url_expand_test_data
[:-1])),
337 '$URL:: %s $\n' % (' ' * len(url_expand_test_data
)),
338 '$URL:: %s $\n' % (' ' * len(url_expand_test_data
)),
339 '$URL:: %s $\n'% (' ' * len(url_expand_test_data
)),
340 '$URL::x%s $\n' % (' ' * len(url_expand_test_data
)),
341 '$URL:: %sx$\n' % (' ' * len(url_expand_test_data
)),
342 '$URL::x%sx$\n' % (' ' * len(url_expand_test_data
))
345 fp
= open(os
.path
.join(wc_dir
, svntest
.main
.get_admin_name(),
346 'text-base', 'fixed_length_keywords.svn-base'), 'r')
347 actual_textbase_kw
= fp
.readlines()
349 check_keywords(actual_textbase_kw
, kw_textbase
, "text base")
351 # Check the Id keyword for filename with spaces.
352 fp
= open(id_with_space_path
, 'r')
353 lines
= fp
.readlines()
354 if not ((len(lines
) == 1)
355 and (re
.match("\$Id: .*id with space", lines
[0]))):
356 print "Id expansion failed for", id_with_space_path
357 raise svntest
.Failure
360 # Check the Id keyword for filename with_$_signs.
361 fp
= open(id_exp_with_dollar_path
, 'r')
362 lines
= fp
.readlines()
363 if not ((len(lines
) == 1)
364 and (re
.match("\$Id: .*id_exp with_\$_sign [^$]* jrandom \$",
366 print "Id expansion failed for", id_exp_with_dollar_path
368 raise svntest
.Failure
371 #----------------------------------------------------------------------
373 #def enable_translation(sbox):
374 # "enable translation, check status, commit"
376 # TODO: Turn on newline conversion and/or keyword substitution for all
377 # sorts of files, with and without local mods, and verify that
378 # status shows the right stuff. The, commit those mods.
380 #----------------------------------------------------------------------
382 #def checkout_translated():
383 # "checkout files that have translation enabled"
385 # TODO: Checkout a tree which contains files with translation
388 #----------------------------------------------------------------------
390 #def disable_translation():
391 # "disable translation, check status, commit"
393 # TODO: Disable translation on files which have had it enabled,
394 # with and without local mods, check status, and commit.
396 #----------------------------------------------------------------------
398 # Regression test for bug discovered by Vladmir Prus <ghost@cs.msu.csu>.
399 # This is a slight rewrite of his test, to use the run_and_verify_* API.
400 # This is for issue #631.
402 def do_nothing(x
, y
):
405 def update_modified_with_translation(sbox
):
406 "update modified file with eol-style 'native'"
411 # Replace contents of rho and set eol translation to 'native'
412 rho_path
= os
.path
.join(wc_dir
, 'A', 'D', 'G', 'rho')
413 svntest
.main
.file_write(rho_path
, "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
414 svntest
.actions
.run_and_verify_svn(None, None, [],
415 'propset', 'svn:eol-style', 'native',
418 # Create expected output and status trees of a commit.
419 expected_output
= svntest
.wc
.State(wc_dir
, {
420 'A/D/G/rho' : Item(verb
='Sending'),
423 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
425 expected_status
.tweak('A/D/G/rho', wc_rev
=2, status
=' ')
427 # Commit revision 2: it has the new rho.
428 svntest
.actions
.run_and_verify_commit(wc_dir
,
434 svntest
.main
.file_write(rho_path
, "1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n")
437 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
438 expected_status
.tweak('A/D/G/rho', wc_rev
=3, status
=' ')
440 svntest
.actions
.run_and_verify_commit(wc_dir
,
445 # Locally modify rho again.
446 svntest
.main
.file_write(rho_path
, "1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n10\n")
448 # Prepare trees for an update to rev 1.
449 expected_output
= svntest
.wc
.State(wc_dir
, {
450 'A/D/G/rho' : Item(status
='CU'),
453 expected_disk
= svntest
.main
.greek_state
.copy()
454 expected_disk
.tweak('A/D/G/rho',
455 contents
="\n".join(["<<<<<<< .mine",
468 "This is the file 'rho'.",
472 # Updating back to revision 1 should not error; the merge should
473 # work, with eol-translation turned on.
474 svntest
.actions
.run_and_verify_update(wc_dir
,
480 0, '-r', '1', wc_dir
)
483 #----------------------------------------------------------------------
485 # Regression test for issue #1085, whereby setting the eol-style to a
486 # fixed platform-incorrect value on a file whose line endings are
487 # platform-correct causes repository insanity (the eol-style prop
488 # claims one line ending style, the file is in another). This test
489 # assumes that this can be testing by verifying that a) new file
490 # contents are transmitted to the server during commit, and b) that
491 # after the commit, the file and its text-base have been changed to
492 # have the new line-ending style.
494 def eol_change_is_text_mod(sbox
):
495 "committing eol-style change forces text send"
501 # add a new file to the working copy.
502 foo_path
= os
.path
.join(wc_dir
, 'foo')
503 f
= open(foo_path
, 'wb')
504 if svntest
.main
.windows
:
505 f
.write("1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n")
507 f
.write("1\n2\n3\n4\n5\n6\n7\n8\n9\n")
511 svntest
.actions
.run_and_verify_svn(None, None, [], 'add', foo_path
)
512 svntest
.actions
.run_and_verify_svn(None, None, [],
513 'ci', '-m', 'log msg',
516 if svntest
.main
.windows
:
517 svntest
.actions
.run_and_verify_svn(None, None, [], 'propset',
518 'svn:eol-style', 'LF', foo_path
)
520 svntest
.actions
.run_and_verify_svn(None, None, [], 'propset',
521 'svn:eol-style', 'CRLF', foo_path
)
523 # check 1: did new contents get transmitted?
524 expected_output
= ["Sending " + foo_path
+ "\n",
525 "Transmitting file data .\n",
526 "Committed revision 3.\n"]
527 svntest
.actions
.run_and_verify_svn(None, expected_output
, [],
528 'ci', '-m', 'log msg', foo_path
)
530 # check 2: do the files have the right contents now?
531 contents
= svntest
.main
.file_read(foo_path
, 'rb')
532 if svntest
.main
.windows
:
533 if contents
!= "1\n2\n3\n4\n5\n6\n7\n8\n9\n":
534 raise svntest
.Failure
536 if contents
!= "1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n":
537 raise svntest
.Failure
539 foo_base_path
= os
.path
.join(wc_dir
, svntest
.main
.get_admin_name(),
540 'text-base', 'foo.svn-base')
541 base_contents
= svntest
.main
.file_read(foo_base_path
, 'rb')
542 if contents
!= base_contents
:
543 raise svntest
.Failure
545 #----------------------------------------------------------------------
546 # Regression test for issue #1151. A single file in a directory
547 # didn't get keywords expanded on checkout.
549 def keyword_expanded_on_checkout(sbox
):
550 "keyword expansion for lone file in directory"
555 # The bug didn't occur if there were multiple files in the
556 # directory, so setup an empty directory.
557 Z_path
= os
.path
.join(wc_dir
, 'Z')
558 svntest
.actions
.run_and_verify_svn(None, None, [], 'mkdir', Z_path
)
560 # Add the file that has the keyword to be expanded
561 url_path
= os
.path
.join(Z_path
, 'url')
562 svntest
.main
.file_append(url_path
, "$URL$")
563 svntest
.actions
.run_and_verify_svn(None, None, [], 'add', url_path
)
564 keywords_on(url_path
)
566 svntest
.actions
.run_and_verify_svn(None, None, [],
567 'ci', '-m', 'log msg', wc_dir
)
569 other_wc_dir
= sbox
.add_wc_path('other')
570 other_url_path
= os
.path
.join(other_wc_dir
, 'Z', 'url')
571 svntest
.actions
.run_and_verify_svn(None, None, [], 'checkout',
575 # Check keyword got expanded (and thus the mkdir, add, ps, commit
577 fp
= open(other_url_path
, 'r')
578 lines
= fp
.readlines()
579 if not ((len(lines
) == 1)
580 and (re
.match("\$URL: (http|file|svn|svn\\+ssh)://", lines
[0]))):
581 print "URL expansion failed for", other_url_path
582 raise svntest
.Failure
586 #----------------------------------------------------------------------
587 def cat_keyword_expansion(sbox
):
588 "keyword expanded on cat"
592 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
593 lambda_path
= os
.path
.join(wc_dir
, 'A', 'B', 'lambda')
595 # Set up A/mu to do $Rev$ keyword expansion
596 svntest
.main
.file_append(mu_path
, "$Rev$\n$Author$")
597 svntest
.actions
.run_and_verify_svn(None, None, [],
598 'propset', 'svn:keywords', 'Rev Author',
601 expected_output
= wc
.State(wc_dir
, {
602 'A/mu' : Item(verb
='Sending'),
604 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
605 expected_status
.tweak('A/mu', wc_rev
=2)
606 svntest
.actions
.run_and_verify_commit(wc_dir
,
607 expected_output
, expected_status
,
610 # Change the author to value which will get truncated on expansion
611 full_author
= "x" * 400
612 key_author
= "x" * 244
613 svntest
.actions
.enable_revprop_changes(sbox
.repo_dir
)
614 svntest
.actions
.run_and_verify_svn(None, None, [],
615 'propset', '--revprop', '-r2',
616 'svn:author', full_author
,
618 svntest
.actions
.run_and_verify_svn(None, [ full_author
], [],
619 'propget', '--revprop', '-r2',
620 'svn:author', '--strict',
623 # Make another commit so that the last changed revision for A/mu is
625 svntest
.actions
.run_and_verify_svn(None, None, [],
626 'propset', 'foo', 'bar', lambda_path
)
627 expected_output
= wc
.State(wc_dir
, {
628 'A/B/lambda' : Item(verb
='Sending'),
630 expected_status
.tweak('A/B/lambda', wc_rev
=3)
631 svntest
.actions
.run_and_verify_commit(wc_dir
,
632 expected_output
, expected_status
,
635 # At one stage the keywords were expanded to values for the requested
636 # revision, not to those committed revision
637 svntest
.actions
.run_and_verify_svn(None,
638 [ "This is the file 'mu'.\n",
640 "$Author: " + key_author
+ " $"], [],
641 'cat', '-r', 'HEAD', mu_path
)
644 #----------------------------------------------------------------------
645 def copy_propset_commit(sbox
):
646 "copy, propset svn:eol-style, commit"
650 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
651 mu2_path
= os
.path
.join(wc_dir
, 'A', 'mu2')
654 svntest
.actions
.run_and_verify_svn(None, None, [], 'copy', mu_path
, mu2_path
)
655 svntest
.actions
.run_and_verify_svn(None, None, [],
656 'propset', 'svn:eol-style', 'native',
658 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
659 expected_status
.add({
660 'A/mu2' : Item(status
='A ', wc_rev
='-', copied
='+')
662 svntest
.actions
.run_and_verify_status(wc_dir
, expected_status
)
664 # Commit, at one stage this dumped core
665 expected_output
= wc
.State(wc_dir
, {
666 'A/mu2' : Item(verb
='Adding'),
668 expected_status
.tweak('A/mu2', status
=' ', wc_rev
=2, copied
=None)
669 svntest
.actions
.run_and_verify_commit(wc_dir
,
670 expected_output
, expected_status
,
673 #----------------------------------------------------------------------
674 # Create a greek tree, commit a keyword into one file,
675 # then commit a keyword property (i.e., turn on keywords), then
676 # try to check out head somewhere else.
677 # This should not cause seg fault
678 def propset_commit_checkout_nocrash(sbox
):
679 "propset, commit, check out into another wc"
683 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
685 # Put a keyword in A/mu, commit
686 svntest
.main
.file_append(mu_path
, "$Rev$")
687 expected_output
= wc
.State(wc_dir
, {
688 'A/mu' : Item(verb
='Sending'),
690 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
691 expected_status
.tweak('A/mu', wc_rev
=2)
692 svntest
.actions
.run_and_verify_commit(wc_dir
,
693 expected_output
, expected_status
,
696 # Set property to do keyword expansion on A/mu, commit.
697 svntest
.actions
.run_and_verify_svn(None, None, [],
698 'propset', 'svn:keywords', 'Rev', mu_path
)
699 expected_output
= wc
.State(wc_dir
, {
700 'A/mu' : Item(verb
='Sending'),
702 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
703 expected_status
.tweak('A/mu', wc_rev
=3)
704 svntest
.actions
.run_and_verify_commit(wc_dir
,
705 expected_output
, expected_status
,
708 # Check out into another wc dir
709 other_wc_dir
= sbox
.add_wc_path('other')
710 mu_other_path
= os
.path
.join(other_wc_dir
, 'A', 'mu')
712 svntest
.actions
.run_and_verify_svn(None, None, [], 'checkout',
716 mu_other_contents
= svntest
.main
.file_read(mu_other_path
)
717 if mu_other_contents
!= "This is the file 'mu'.\n$Rev: 3 $":
718 print "'%s' does not have the expected contents" % mu_other_path
719 raise svntest
.Failure
722 #----------------------------------------------------------------------
723 # Add the keyword property to a file, svn revert the file
724 # This should not display any error message
725 def propset_revert_noerror(sbox
):
730 mu_path
= os
.path
.join(wc_dir
, 'A', 'mu')
732 # Set the Rev keyword for the mu file
733 # could use the keywords_on()/keywords_off() functions to
734 # set/del all svn:keywords
735 svntest
.actions
.run_and_verify_svn(None, None, [],
736 'propset', 'svn:keywords', 'Rev', mu_path
)
737 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
738 expected_status
.tweak('A/mu', status
=' M')
739 svntest
.actions
.run_and_verify_status(wc_dir
, expected_status
)
742 svntest
.actions
.run_and_verify_svn(None, None, [], 'revert', mu_path
)
743 expected_status
= svntest
.actions
.get_virginal_state(wc_dir
, 1)
744 svntest
.actions
.run_and_verify_status(wc_dir
, expected_status
)
747 ########################################################################
751 # list all tests here, starting with None:
754 # enable_translation,
755 # checkout_translated,
756 # disable_translation,
757 update_modified_with_translation
,
758 eol_change_is_text_mod
,
759 keyword_expanded_on_checkout
,
760 cat_keyword_expansion
,
762 propset_commit_checkout_nocrash
,
763 propset_revert_noerror
,
766 if __name__
== '__main__':
767 svntest
.main
.run_tests(test_list
)