Debian Codegraph @

subversion/tests/cmdline/svnadmin_tests.py

raw
1 #!/usr/bin/env python
2 #
3 # svnadmin_tests.py: testing the 'svnadmin' tool.
4 #
5 # Subversion is a tool for revision control.
6 # See http://subversion.apache.org for more information.
7 #
8 # ====================================================================
9 # Licensed to the Apache Software Foundation (ASF) under one
10 # or more contributor license agreements. See the NOTICE file
11 # distributed with this work for additional information
12 # regarding copyright ownership. The ASF licenses this file
13 # to you under the Apache License, Version 2.0 (the
14 # "License"); you may not use this file except in compliance
15 # with the License. You may obtain a copy of the License at
16 #
17 # http://www.apache.org/licenses/LICENSE-2.0
18 #
19 # Unless required by applicable law or agreed to in writing,
20 # software distributed under the License is distributed on an
21 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 # KIND, either express or implied. See the License for the
23 # specific language governing permissions and limitations
24 # under the License.
25 ######################################################################
26
27 # General modules
28 import os
29 import logging
30 import re
31 import shutil
32 import sys
33 import threading
34 import time
35 import gzip
36
37 logger = logging.getLogger()
38
39 # Our testing module
40 import svntest
41 from svntest.verify import SVNExpectedStdout, SVNExpectedStderr
42 from svntest.verify import SVNUnexpectedStderr
43 from svntest.verify import UnorderedOutput
44 from svntest.main import SVN_PROP_MERGEINFO
45
46 # (abbreviation)
47 Skip = svntest.testcase.Skip_deco
48 SkipUnless = svntest.testcase.SkipUnless_deco
49 XFail = svntest.testcase.XFail_deco
50 Issues = svntest.testcase.Issues_deco
51 Issue = svntest.testcase.Issue_deco
52 Wimp = svntest.testcase.Wimp_deco
53 SkipDumpLoadCrossCheck = svntest.testcase.SkipDumpLoadCrossCheck_deco
54 Item = svntest.wc.StateItem
55
56 def read_rep_cache(repo_dir):
57 """Return the rep-cache contents as a dict {hash: (rev, index, ...)}.
58 """
59 db_path = os.path.join(repo_dir, 'db', 'rep-cache.db')
60 db1 = svntest.sqlite3.connect(db_path)
61 try:
62 schema1 = db1.execute("pragma user_version").fetchone()[0]
63 # Can't test newer rep-cache schemas with an old built-in SQLite; see the
64 # documentation of STMT_CREATE_SCHEMA_V2 in ../../libsvn_fs_fs/rep-cache-db.sql
65 if schema1 >= 2 and svntest.sqlite3.sqlite_version_info < (3, 8, 2):
66 raise svntest.Failure("Can't read rep-cache schema %d using old "
67 "Python-SQLite version %s < (3,8,2)" %
68 (schema1,
69 svntest.sqlite3.sqlite_version_info))
70
71 content = { row[0]: row[1:] for row in
72 db1.execute("select * from rep_cache") }
73 finally:
74 db1.close()
75 return content
76
77 def check_hotcopy_bdb(src, dst):
78 "Verify that the SRC BDB repository has been correctly copied to DST."
79 ### TODO: This function should be extended to verify all hotcopied files,
80 ### not just compare the output of 'svnadmin dump'. See check_hotcopy_fsfs().
81 exit_code, origout, origerr = svntest.main.run_svnadmin("dump", src,
82 '--quiet')
83 exit_code, backout, backerr = svntest.main.run_svnadmin("dump", dst,
84 '--quiet')
85 if origerr or backerr or origout != backout:
86 raise svntest.Failure
87
88 def check_hotcopy_fsfs_fsx(src, dst):
89 # Walk the source and compare all files to the destination
90 for src_dirpath, src_dirs, src_files in os.walk(src):
91 # Verify that the current directory exists in the destination
92 dst_dirpath = src_dirpath.replace(src, dst)
93 if not os.path.isdir(dst_dirpath):
94 raise svntest.Failure("%s does not exist in hotcopy "
95 "destination" % dst_dirpath)
96 # Verify that all dirents in the current directory also exist in source
97 for dst_dirent in os.listdir(dst_dirpath):
98 # Ignore auto-created empty lock files as they may or may not
99 # be present and are neither required by nor do they harm to
100 # the destination repository.
101 if dst_dirent == 'pack-lock':
102 continue
103 if dst_dirent == 'write-lock':
104 continue
105
106 # Ignore auto-created rep-cache.db-journal file
107 if dst_dirent == 'rep-cache.db-journal':
108 continue
109
110 src_dirent = os.path.join(src_dirpath, dst_dirent)
111 if not os.path.exists(src_dirent):
112 raise svntest.Failure("%s does not exist in hotcopy "
113 "source" % src_dirent)
114 # Compare all files in this directory
115 for src_file in src_files:
116 # Ignore auto-created empty lock files as they may or may not
117 # be present and are neither required by nor do they harm to
118 # the destination repository.
119 if src_file == 'pack-lock':
120 continue
121 if src_file == 'write-lock':
122 continue
123
124 # Ignore auto-created rep-cache.db-journal file
125 if src_file == 'rep-cache.db-journal':
126 continue
127
128 src_path = os.path.join(src_dirpath, src_file)
129 dst_path = os.path.join(dst_dirpath, src_file)
130 if not os.path.isfile(dst_path):
131 raise svntest.Failure("%s does not exist in hotcopy "
132 "destination" % dst_path)
133
134 # Special case for db/uuid: Only the UUID in the first line needs
135 # to match. Source and target must have the same number of lines
136 # (due to having the same format).
137 if src_path == os.path.join(src, 'db', 'uuid'):
138 lines1 = open(src_path, 'rb').read().split(b"\n")
139 lines2 = open(dst_path, 'rb').read().split(b"\n")
140 if len(lines1) != len(lines2):
141 raise svntest.Failure("%s differs in number of lines"
142 % dst_path)
143 if lines1[0] != lines2[0]:
144 raise svntest.Failure("%s contains different uuid: '%s' vs. '%s'"
145 % (dst_path, lines1[0], lines2[0]))
146 continue
147
148 # Special case for rep-cache: It will always differ in a byte-by-byte
149 # comparison, so compare db tables instead.
150 if src_file == 'rep-cache.db':
151 db1 = svntest.sqlite3.connect(src_path)
152 db2 = svntest.sqlite3.connect(dst_path)
153 schema1 = db1.execute("pragma user_version").fetchone()[0]
154 schema2 = db2.execute("pragma user_version").fetchone()[0]
155 if schema1 != schema2:
156 raise svntest.Failure("rep-cache schema differs: '%s' vs. '%s'"
157 % (schema1, schema2))
158 # Can't test newer rep-cache schemas with an old built-in SQLite.
159 if schema1 >= 2 and svntest.sqlite3.sqlite_version_info < (3, 8, 2):
160 continue
161
162 rows1 = []
163 rows2 = []
164 for row in db1.execute("select * from rep_cache order by hash"):
165 rows1.append(row)
166 for row in db2.execute("select * from rep_cache order by hash"):
167 rows2.append(row)
168 if len(rows1) != len(rows2):
169 raise svntest.Failure("number of rows in rep-cache differs")
170 for i in range(len(rows1)):
171 if rows1[i] != rows2[i]:
172 raise svntest.Failure("rep-cache row %i differs: '%s' vs. '%s'"
173 % (i, rows1[i], rows2[i]))
174 continue
175
176 # Special case for revprop-generation: It will always be zero in
177 # the hotcopy destination (i.e. a fresh cache generation)
178 if src_file == 'revprop-generation':
179 f2 = open(dst_path, 'r')
180 revprop_gen = int(f2.read().strip())
181 if revprop_gen != 0:
182 raise svntest.Failure("Hotcopy destination has non-zero " +
183 "revprop generation")
184 continue
185
186 f1 = open(src_path, 'rb')
187 f2 = open(dst_path, 'rb')
188 while True:
189 offset = 0
190 BUFSIZE = 1024
191 buf1 = f1.read(BUFSIZE)
192 buf2 = f2.read(BUFSIZE)
193 if not buf1 or not buf2:
194 if not buf1 and not buf2:
195 # both at EOF
196 break
197 elif buf1:
198 raise svntest.Failure("%s differs at offset %i" %
199 (dst_path, offset))
200 elif buf2:
201 raise svntest.Failure("%s differs at offset %i" %
202 (dst_path, offset))
203 if len(buf1) != len(buf2):
204 raise svntest.Failure("%s differs in length" % dst_path)
205 for i in range(len(buf1)):
206 if buf1[i] != buf2[i]:
207 raise svntest.Failure("%s differs at offset %i"
208 % (dst_path, offset))
209 offset += 1
210 f1.close()
211 f2.close()
212
213 def check_hotcopy_fsfs(src, dst):
214 "Verify that the SRC FSFS repository has been correctly copied to DST."
215 check_hotcopy_fsfs_fsx(src, dst)
216
217 def check_hotcopy_fsx(src, dst):
218 "Verify that the SRC FSX repository has been correctly copied to DST."
219 check_hotcopy_fsfs_fsx(src, dst)
220
221 #----------------------------------------------------------------------
222
223 # How we currently test 'svnadmin' --
224 #
225 # 'svnadmin create': Create an empty repository, test that the
226 # root node has a proper created-revision,
227 # because there was once a bug where it
228 # didn't.
229 #
230 # Note also that "svnadmin create" is tested
231 # implicitly every time we run a python test
232 # script. (An empty repository is always
233 # created and then imported into; if this
234 # subcommand failed catastrophically, every
235 # test would fail and we would know instantly.)
236 #
237 # 'svnadmin createtxn'
238 # 'svnadmin rmtxn': See below.
239 #
240 # 'svnadmin lstxns': We don't care about the contents of transactions;
241 # we only care that they exist or not.
242 # Therefore, we can simply parse transaction headers.
243 #
244 # 'svnadmin dump': A couple regression tests that ensure dump doesn't
245 # error out, and one to check that the --quiet option
246 # really does what it's meant to do. The actual
247 # contents of the dump aren't verified at all.
248 #
249 # ### TODO: someday maybe we could parse the contents of trees too.
250 #
251 ######################################################################
252 # Helper routines
253
254
255 def get_txns(repo_dir):
256 "Get the txn names using 'svnadmin lstxns'."
257
258 exit_code, output_lines, error_lines = svntest.main.run_svnadmin('lstxns',
259 repo_dir)
260 txns = sorted([output_lines.strip(x) for x in output_lines])
261
262 return txns
263
264 def patch_format(repo_dir, shard_size):
265 """Rewrite the format of the FSFS or FSX repository REPO_DIR so
266 that it would use sharding with SHARDS revisions per shard."""
267
268 format_path = os.path.join(repo_dir, "db", "format")
269 contents = open(format_path, 'rb').read()
270 processed_lines = []
271
272 for line in contents.split(b"\n"):
273 if line.startswith(b"layout "):
274 processed_lines.append(("layout sharded %d" % shard_size).encode())
275 else:
276 processed_lines.append(line)
277
278 new_contents = b"\n".join(processed_lines)
279 os.chmod(format_path, svntest.main.S_ALL_RW)
280 with open(format_path, 'wb') as f:
281 f.write(new_contents)
282
283 def is_sharded(repo_dir):
284 """Return whether the FSFS repository REPO_DIR is sharded."""
285
286 format_path = os.path.join(repo_dir, "db", "format")
287 contents = open(format_path, 'rb').read()
288
289 for line in contents.split(b"\n"):
290 if line.startswith(b"layout sharded"):
291 return True
292
293 return False
294
295 def load_and_verify_dumpstream(sbox, expected_stdout, expected_stderr,
296 revs, check_props, dump, *varargs):
297 """Load the array of lines passed in DUMP into the current tests'
298 repository and verify the repository content using the array of
299 wc.States passed in REVS. If CHECK_PROPS is True, check properties
300 of each rev's items. VARARGS are optional arguments passed to the
301 'load' command."""
302
303 dump = svntest.main.ensure_list(dump)
304
305 exit_code, output, errput = svntest.main.run_command_stdin(
306 svntest.main.svnadmin_binary, expected_stderr, 0, True, dump,
307 'load', '--quiet', sbox.repo_dir, *varargs)
308
309 if expected_stdout:
310 if expected_stdout is svntest.verify.AnyOutput:
311 if len(output) == 0:
312 raise SVNExpectedStdout
313 else:
314 svntest.verify.compare_and_display_lines(
315 "Standard output", "STDOUT:", expected_stdout, output)
316
317 if expected_stderr:
318 if expected_stderr is svntest.verify.AnyOutput:
319 if len(errput) == 0:
320 raise SVNExpectedStderr
321 else:
322 svntest.verify.compare_and_display_lines(
323 "Standard error output", "STDERR:", expected_stderr, errput)
324 # The expected error occurred, so don't try to verify the result
325 return
326
327 if revs:
328 # verify revs as wc states
329 for rev in range(len(revs)):
330 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [],
331 "update", "-r%s" % (rev+1),
332 sbox.wc_dir)
333
334 rev_tree = revs[rev]
335 svntest.actions.verify_disk(sbox.wc_dir, rev_tree, check_props)
336
337 def load_dumpstream(sbox, dump, *varargs):
338 "Load dump text without verification."
339 return load_and_verify_dumpstream(sbox, None, None, None, False, dump,
340 *varargs)
341
342 class FSFS_Index:
343 """Manages indexes of a rev file in a FSFS format 7 repository.
344 The interface returns P2L information and allows for item offsets
345 and lengths to be modified. """
346
347 def __init__(self, sbox, revision):
348 self.by_item = { }
349 self.revision = revision
350 self.repo_dir = sbox.repo_dir
351
352 self._read()
353
354 def _read(self):
355 """ Read P2L index using svnfsfs. """
356 exit_code, output, errput = svntest.main.run_svnfsfs('dump-index',
357 '-r' + str(self.revision),
358 self.repo_dir)
359 svntest.verify.verify_outputs("Error while dumping index",
360 [], errput, [], [])
361 svntest.verify.verify_exit_code(None, exit_code, 0)
362
363 self.by_item.clear()
364 for line in output:
365 values = line.split()
366 if len(values) >= 4 and values[0] != 'Start':
367 item = int(values[4])
368 self.by_item[item] = values
369
370 def _write(self):
371 """ Rewrite indexes using svnfsfs. """
372 by_offset = {}
373 for key in self.by_item:
374 values = self.by_item[key]
375 by_offset[int(values[0], 16)] = values
376
377 lines = []
378 for (offset, values) in sorted(by_offset.items()):
379 values = by_offset[offset]
380 line = values[0] + ' ' + values[1] + ' ' + values[2] + ' ' + \
381 values[3] + ' ' + values[4] + '\n';
382 lines.append(line.encode())
383
384 exit_code, output, errput = svntest.main.run_command_stdin(
385 svntest.main.svnfsfs_binary, 0, 0, False, lines,
386 'load-index', self.repo_dir)
387
388 svntest.verify.verify_outputs("Error while rewriting index",
389 output, errput, [], [])
390 svntest.verify.verify_exit_code(None, exit_code, 0)
391
392 def get_item(self, item):
393 """ Return offset, length and type of ITEM. """
394 values = self.by_item[item]
395
396 offset = int(values[0], 16)
397 len = int(values[1], 16)
398 type = values[2]
399
400 return (offset, len, type)
401
402 def modify_item(self, item, offset, len):
403 """ Modify offset and length of ITEM. """
404 values = self.by_item[item]
405
406 values[0] = '%x' % offset
407 values[1] = '%x' % len
408
409 self._write()
410
411 def repo_format(sbox):
412 """ Return the repository format number for SBOX."""
413
414 format_file = open(os.path.join(sbox.repo_dir, "db", "format"))
415 format = int(format_file.read()[:1])
416 format_file.close()
417
418 return format
419
420 def set_changed_path_list(sbox, revision, changes):
421 """ Replace the changed paths list in the revision file REVISION in SBOX
422 with the text CHANGES."""
423
424 idx = None
425
426 # read full file
427 fp = open(fsfs_file(sbox.repo_dir, 'revs', str(revision)), 'r+b')
428 contents = fp.read()
429 length = len(contents)
430
431 if repo_format(sbox) < 7:
432 # replace the changed paths list
433 header = contents[contents.rfind(b'\n', length - 64, length - 1):]
434 body_len = int(header.split(b' ')[1])
435
436 else:
437 # read & parse revision file footer
438 footer_length = contents[length-1];
439 if isinstance(footer_length, str):
440 footer_length = ord(footer_length)
441
442 footer = contents[length - footer_length - 1:length-1]
443 l2p_offset = int(footer.split(b' ')[0])
444 l2p_checksum = footer.split(b' ')[1]
445 p2l_offset = int(footer.split(b' ')[2])
446 p2l_checksum = footer.split(b' ')[3]
447
448 idx = FSFS_Index(sbox, revision)
449 (offset, item_len, item_type) = idx.get_item(1)
450
451 # split file contents
452 body_len = offset
453 indexes = contents[l2p_offset:length - footer_length - 1]
454
455 # construct new footer, include indexes as are
456 file_len = body_len + len(changes) + 1
457 p2l_offset += file_len - l2p_offset
458
459 header = str(file_len).encode() + b' ' + l2p_checksum + b' ' \
460 + str(p2l_offset).encode() + b' ' + p2l_checksum
461 header += bytes([len(header)])
462 header = b'\n' + indexes + header
463
464 contents = contents[:body_len] + changes + header
465
466 # set new contents
467 fp.seek(0)
468 fp.write(contents)
469 fp.truncate()
470 fp.close()
471
472 if repo_format(sbox) >= 7:
473 idx.modify_item(1, offset, len(changes) + 1)
474
475 ######################################################################
476 # Tests
477
478
479 #----------------------------------------------------------------------
480
481 # dump stream tests need a dump file
482
483 def clean_dumpfile():
484 return \
485 [ b"SVN-fs-dump-format-version: 2\n\n",
486 b"UUID: 668cc64a-31ed-0310-8ccb-b75d75bb44e3\n\n",
487 b"Revision-number: 0\n",
488 b"Prop-content-length: 56\n",
489 b"Content-length: 56\n\n",
490 b"K 8\nsvn:date\nV 27\n2005-01-08T21:48:13.838745Z\nPROPS-END\n\n\n",
491 b"Revision-number: 1\n",
492 b"Prop-content-length: 98\n",
493 b"Content-length: 98\n\n",
494 b"K 7\nsvn:log\nV 0\n\nK 10\nsvn:author\nV 4\nerik\n",
495 b"K 8\nsvn:date\nV 27\n2005-01-08T21:51:16.313791Z\nPROPS-END\n\n\n",
496 b"Node-path: A\n",
497 b"Node-kind: file\n",
498 b"Node-action: add\n",
499 b"Prop-content-length: 35\n",
500 b"Text-content-length: 5\n",
501 b"Text-content-md5: e1cbb0c3879af8347246f12c559a86b5\n",
502 b"Content-length: 40\n\n",
503 b"K 12\nsvn:keywords\nV 2\nId\nPROPS-END\ntext\n\n\n"]
504
505 dumpfile_revisions = \
506 [ svntest.wc.State('', { 'A' : svntest.wc.StateItem(contents="text\n") }) ]
507
508 #----------------------------------------------------------------------
509 def extra_headers(sbox):
510 "loading of dumpstream with extra headers"
511
512 sbox.build(empty=True)
513
514 dumpfile = clean_dumpfile()
515
516 dumpfile[3:3] = \
517 [ b"X-Comment-Header: Ignored header normally not in dump stream\n" ]
518
519 load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, False, dumpfile,
520 '--ignore-uuid')
521
522 #----------------------------------------------------------------------
523 # Ensure loading continues after skipping a bit of unknown extra content.
524 def extra_blockcontent(sbox):
525 "load success on oversized Content-length"
526
527 sbox.build(empty=True)
528
529 dumpfile = clean_dumpfile()
530
531 # Replace "Content-length" line with two lines
532 dumpfile[8:9] = \
533 [ b"Extra-content-length: 10\n",
534 b"Content-length: 108\n\n" ]
535 # Insert the extra content after "PROPS-END\n"
536 dumpfile[11] = dumpfile[11][:-2] + b"extra text\n\n\n"
537
538 load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, False, dumpfile,
539 '--ignore-uuid')
540
541 #----------------------------------------------------------------------
542 def inconsistent_headers(sbox):
543 "load failure on undersized Content-length"
544
545 sbox.build(empty=True)
546
547 dumpfile = clean_dumpfile()
548
549 dumpfile[-2] = b"Content-length: 30\n\n"
550
551 load_and_verify_dumpstream(sbox, [], svntest.verify.AnyOutput,
552 dumpfile_revisions, False, dumpfile)
553
554 #----------------------------------------------------------------------
555 # Test for issue #2729: Datestamp-less revisions in dump streams do
556 # not remain so after load
557 @Issue(2729)
558 def empty_date(sbox):
559 "preserve date-less revisions in load"
560
561 sbox.build(empty=True)
562
563 dumpfile = clean_dumpfile()
564
565 # Replace portions of the revision data to drop the svn:date revprop.
566 dumpfile[7:11] = \
567 [ b"Prop-content-length: 52\n",
568 b"Content-length: 52\n\n",
569 b"K 7\nsvn:log\nV 0\n\nK 10\nsvn:author\nV 4\nerik\nPROPS-END\n\n\n"
570 ]
571
572 load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, False, dumpfile,
573 '--ignore-uuid')
574
575 # Verify that the revision still lacks the svn:date property.
576 svntest.actions.run_and_verify_svn([], '.*(E195011|E200017).*svn:date',
577 "propget", "--revprop", "-r1", "svn:date",
578 sbox.wc_dir)
579
580 #----------------------------------------------------------------------
581
582 def dump_copied_dir(sbox):
583 "'svnadmin dump' on copied directory"
584
585 sbox.build()
586 wc_dir = sbox.wc_dir
587 repo_dir = sbox.repo_dir
588
589 old_C_path = os.path.join(wc_dir, 'A', 'C')
590 new_C_path = os.path.join(wc_dir, 'A', 'B', 'C')
591 svntest.main.run_svn(None, 'cp', old_C_path, new_C_path)
592 sbox.simple_commit(message='log msg')
593
594 exit_code, output, errput = svntest.main.run_svnadmin("dump", repo_dir)
595 if svntest.verify.compare_and_display_lines(
596 "Output of 'svnadmin dump' is unexpected.",
597 'STDERR', ["* Dumped revision 0.\n",
598 "* Dumped revision 1.\n",
599 "* Dumped revision 2.\n"], errput):
600 raise svntest.Failure
601
602 #----------------------------------------------------------------------
603
604 def dump_move_dir_modify_child(sbox):
605 "'svnadmin dump' on modified child of copied dir"
606
607 sbox.build()
608 wc_dir = sbox.wc_dir
609 repo_dir = sbox.repo_dir
610
611 B_path = os.path.join(wc_dir, 'A', 'B')
612 Q_path = os.path.join(wc_dir, 'A', 'Q')
613 svntest.main.run_svn(None, 'cp', B_path, Q_path)
614 svntest.main.file_append(os.path.join(Q_path, 'lambda'), 'hello')
615 sbox.simple_commit(message='log msg')
616 exit_code, output, errput = svntest.main.run_svnadmin("dump", repo_dir)
617 svntest.verify.compare_and_display_lines(
618 "Output of 'svnadmin dump' is unexpected.",
619 'STDERR', ["* Dumped revision 0.\n",
620 "* Dumped revision 1.\n",
621 "* Dumped revision 2.\n"], errput)
622
623 exit_code, output, errput = svntest.main.run_svnadmin("dump", "-r",
624 "0:HEAD", repo_dir)
625 svntest.verify.compare_and_display_lines(
626 "Output of 'svnadmin dump' is unexpected.",
627 'STDERR', ["* Dumped revision 0.\n",
628 "* Dumped revision 1.\n",
629 "* Dumped revision 2.\n"], errput)
630
631 #----------------------------------------------------------------------
632
633 def dump_quiet(sbox):
634 "'svnadmin dump --quiet'"
635
636 sbox.build(create_wc = False)
637
638 exit_code, dump, errput = svntest.main.run_svnadmin("dump", sbox.repo_dir,
639 '--quiet')
640 svntest.verify.compare_and_display_lines(
641 "Output of 'svnadmin dump --quiet' is unexpected.",
642 'STDERR', [], errput)
643
644 #----------------------------------------------------------------------
645
646 def hotcopy_dot(sbox):
647 "'svnadmin hotcopy PATH .'"
648 sbox.build()
649
650 backup_dir, backup_url = sbox.add_repo_path('backup')
651 os.mkdir(backup_dir)
652 cwd = os.getcwd()
653
654 os.chdir(backup_dir)
655 svntest.actions.run_and_verify_svnadmin(
656 None, [],
657 "hotcopy", os.path.join(cwd, sbox.repo_dir), '.')
658
659 os.chdir(cwd)
660
661 if svntest.main.is_fs_type_fsfs():
662 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
663 if svntest.main.is_fs_type_bdb():
664 check_hotcopy_bdb(sbox.repo_dir, backup_dir)
665 if svntest.main.is_fs_type_fsx():
666 check_hotcopy_fsx(sbox.repo_dir, backup_dir)
667
668 #----------------------------------------------------------------------
669
670 # This test is redundant for FSFS. The hotcopy_dot and hotcopy_incremental
671 # tests cover this check for FSFS already.
672 @SkipUnless(svntest.main.is_fs_type_bdb)
673 def hotcopy_format(sbox):
674 "'svnadmin hotcopy' checking db/format file"
675 sbox.build()
676
677 backup_dir, backup_url = sbox.add_repo_path('backup')
678 exit_code, output, errput = svntest.main.run_svnadmin("hotcopy",
679 sbox.repo_dir,
680 backup_dir)
681 if errput:
682 logger.warn("Error: hotcopy failed")
683 raise svntest.Failure
684
685 # verify that the db/format files are the same
686 fp = open(os.path.join(sbox.repo_dir, "db", "format"))
687 contents1 = fp.read()
688 fp.close()
689
690 fp2 = open(os.path.join(backup_dir, "db", "format"))
691 contents2 = fp2.read()
692 fp2.close()
693
694 if contents1 != contents2:
695 logger.warn("Error: db/format file contents do not match after hotcopy")
696 raise svntest.Failure
697
698 #----------------------------------------------------------------------
699
700 def setrevprop(sbox):
701 "setlog, setrevprop, delrevprop; bypass hooks"
702 sbox.build()
703
704 # Try a simple log property modification.
705 iota_path = os.path.join(sbox.wc_dir, "iota")
706 mu_path = sbox.ospath('A/mu')
707 svntest.actions.run_and_verify_svnadmin([], [],
708 "setlog", sbox.repo_dir, "-r0",
709 "--bypass-hooks",
710 iota_path)
711
712 # Make sure it fails without --bypass-hooks. (We haven't called
713 # svntest.actions.enable_revprop_changes().)
714 #
715 # Note that we attempt to set the log message to a different value than the
716 # successful call.
717 svntest.actions.run_and_verify_svnadmin([], svntest.verify.AnyOutput,
718 "setlog", sbox.repo_dir, "-r0",
719 mu_path)
720
721 # Verify that the revprop value matches what we set when retrieved
722 # through the client.
723 svntest.actions.run_and_verify_svn([ "This is the file 'iota'.\n", "\n" ],
724 [], "propget", "--revprop", "-r0",
725 "svn:log", sbox.wc_dir)
726
727 # Try an author property modification.
728 foo_path = os.path.join(sbox.wc_dir, "foo")
729 svntest.main.file_write(foo_path, "foo")
730
731 exit_code, output, errput = svntest.main.run_svnadmin("setrevprop",
732 sbox.repo_dir,
733 "-r0", "svn:author",
734 foo_path)
735 if errput:
736 logger.warn("Error: 'setrevprop' failed")
737 raise svntest.Failure
738
739 # Verify that the revprop value matches what we set when retrieved
740 # through the client.
741 svntest.actions.run_and_verify_svn([ "foo\n" ], [], "propget",
742 "--revprop", "-r0", "svn:author",
743 sbox.wc_dir)
744
745 # Delete the property.
746 svntest.actions.run_and_verify_svnadmin([], [],
747 "delrevprop", "-r0", sbox.repo_dir,
748 "svn:author")
749 svntest.actions.run_and_verify_svnlook([], ".*E200017.*svn:author.*",
750 "propget", "--revprop", "-r0",
751 sbox.repo_dir, "svn:author")
752
753 def verify_windows_paths_in_repos(sbox):
754 "verify a repository containing paths like 'c:hi'"
755
756 # setup a repo with a directory 'c:hi'
757 sbox.build(create_wc = False)
758 repo_url = sbox.repo_url
759 chi_url = sbox.repo_url + '/c:hi'
760
761 svntest.actions.run_and_verify_svn(None, [],
762 'mkdir', '-m', 'log_msg',
763 chi_url)
764
765 exit_code, output, errput = svntest.main.run_svnadmin("verify",
766 sbox.repo_dir)
767 if errput:
768 raise SVNUnexpectedStderr(errput)
769
770 # unfortunately, some backends needs to do more checks than other
771 # resulting in different progress output
772 if svntest.main.is_fs_log_addressing():
773 svntest.verify.compare_and_display_lines(
774 "Error while running 'svnadmin verify'.",
775 'STDOUT', ["* Verifying metadata at revision 0 ...\n",
776 "* Verifying repository metadata ...\n",
777 "* Verified revision 0.\n",
778 "* Verified revision 1.\n",
779 "* Verified revision 2.\n"], output)
780 elif svntest.main.fs_has_rep_sharing() and not svntest.main.is_fs_type_bdb():
781 svntest.verify.compare_and_display_lines(
782 "Error while running 'svnadmin verify'.",
783 'STDOUT', ["* Verifying repository metadata ...\n",
784 "* Verified revision 0.\n",
785 "* Verified revision 1.\n",
786 "* Verified revision 2.\n"], output)
787 else:
788 svntest.verify.compare_and_display_lines(
789 "Error while running 'svnadmin verify'.",
790 'STDOUT', ["* Verified revision 0.\n",
791 "* Verified revision 1.\n",
792 "* Verified revision 2.\n"], output)
793
794 #----------------------------------------------------------------------
795
796 # Returns the filename of the rev or revprop file (according to KIND)
797 # numbered REV in REPO_DIR, which must be in the first shard if we're
798 # using a sharded repository.
799 def fsfs_file(repo_dir, kind, rev):
800 if svntest.main.options.server_minor_version >= 5:
801 if svntest.main.options.fsfs_sharding is None:
802 if svntest.main.is_fs_type_fsx():
803 rev = 'r' + rev
804 return os.path.join(repo_dir, 'db', kind, '0', rev)
805 else:
806 shard = int(rev) // svntest.main.options.fsfs_sharding
807 if svntest.main.is_fs_type_fsx():
808 rev = 'r' + rev
809 path = os.path.join(repo_dir, 'db', kind, str(shard), rev)
810
811 if svntest.main.options.fsfs_packing is None or kind == 'revprops':
812 # we don't pack revprops
813 return path
814 elif os.path.exists(path):
815 # rev exists outside a pack file.
816 return path
817 else:
818 # didn't find the plain file; assume it's in a pack file
819 return os.path.join(repo_dir, 'db', kind, ('%d.pack' % shard), 'pack')
820 else:
821 return os.path.join(repo_dir, 'db', kind, rev)
822
823
824 @SkipUnless(svntest.main.is_fs_type_fsfs)
825 def verify_incremental_fsfs(sbox):
826 """svnadmin verify detects corruption dump can't"""
827
828 if svntest.main.options.fsfs_version is not None and \
829 svntest.main.options.fsfs_version not in [4, 6]:
830 raise svntest.Skip("Unsupported prepackaged repository version")
831
832 # setup a repo with a directory 'c:hi'
833 # use physical addressing as this is hard to provoke with logical addressing
834 sbox.build(create_wc = False,
835 minor_version = min(svntest.main.options.server_minor_version,8))
836 repo_url = sbox.repo_url
837 E_url = sbox.repo_url + '/A/B/E'
838
839 # Create A/B/E/bravo in r2.
840 svntest.actions.run_and_verify_svn(None, [],
841 'mkdir', '-m', 'log_msg',
842 E_url + '/bravo')
843 # Corrupt r2's reference to A/C by replacing "dir 7-1.0.r1/1568" with
844 # "dir 7-1.0.r1/1569" (increment offset) and updating the checksum for
845 # this directory listing to "c9b5a2d26473a4e28088673dda9df804" so that
846 # the listing itself is valid.
847 r2 = fsfs_file(sbox.repo_dir, 'revs', '2')
848 if r2.endswith('pack'):
849 raise svntest.Skip("Test doesn't handle packed revisions")
850
851 fp = open(r2, 'wb')
852 fp.write(b"""id: 0-2.0.r2/0
853 type: dir
854 count: 0
855 cpath: /A/B/E/bravo
856 copyroot: 0 /
857
858 PLAIN
859 K 5
860 alpha
861 V 17
862 file 3-1.0.r1/719
863 K 4
864 beta
865 V 17
866 file 4-1.0.r1/840
867 K 5
868 bravo
869 V 14
870 dir 0-2.0.r2/0
871 END
872 ENDREP
873 id: 2-1.0.r2/181
874 type: dir
875 pred: 2-1.0.r1/1043
876 count: 1
877 text: 2 69 99 99 f63001f7fddd1842d8891474d0982111
878 cpath: /A/B/E
879 copyroot: 0 /
880
881 PLAIN
882 K 1
883 E
884 V 16
885 dir 2-1.0.r2/181
886 K 1
887 F
888 V 17
889 dir 5-1.0.r1/1160
890 K 6
891 lambda
892 V 17
893 file 6-1.0.r1/597
894 END
895 ENDREP
896 id: 1-1.0.r2/424
897 type: dir
898 pred: 1-1.0.r1/1335
899 count: 1
900 text: 2 316 95 95 bccb66379b4f825dac12b50d80211bae
901 cpath: /A/B
902 copyroot: 0 /
903
904 PLAIN
905 K 1
906 B
907 V 16
908 dir 1-1.0.r2/424
909 K 1
910 C
911 V 17
912 dir 7-1.0.r1/1569
913 K 1
914 D
915 V 17
916 dir 8-1.0.r1/3061
917 K 2
918 mu
919 V 18
920 file i-1.0.r1/1451
921 END
922 ENDREP
923 id: 0-1.0.r2/692
924 type: dir
925 pred: 0-1.0.r1/3312
926 count: 1
927 text: 2 558 121 121 c9b5a2d26473a4e28088673dda9df804
928 cpath: /A
929 copyroot: 0 /
930
931 PLAIN
932 K 1
933 A
934 V 16
935 dir 0-1.0.r2/692
936 K 4
937 iota
938 V 18
939 file j-1.0.r1/3428
940 END
941 ENDREP
942 id: 0.0.r2/904
943 type: dir
944 pred: 0.0.r1/3624
945 count: 2
946 text: 2 826 65 65 e44e4151d0d124533338619f082c8c9a
947 cpath: /
948 copyroot: 0 /
949
950 _0.0.t1-1 add false false /A/B/E/bravo
951
952
953 904 1031
954 """)
955 fp.close()
956
957 exit_code, output, errput = svntest.main.run_svnadmin("verify", "-r2",
958 sbox.repo_dir)
959 svntest.verify.verify_outputs(
960 message=None, actual_stdout=output, actual_stderr=errput,
961 expected_stdout=None,
962 expected_stderr=".*Found malformed header '[^']*' in revision file"
963 "|.*Missing id field in node-rev.*")
964
965 #----------------------------------------------------------------------
966
967 # Helper for two test functions.
968 def corrupt_and_recover_db_current(sbox, minor_version=None):
969 """Build up a MINOR_VERSION sandbox and test different recovery scenarios
970 with missing, out-of-date or even corrupt db/current files. Recovery should
971 behave the same way with all values of MINOR_VERSION, hence this helper
972 containing the common code that allows us to check it."""
973
974 sbox.build(minor_version=minor_version)
975 current_path = os.path.join(sbox.repo_dir, 'db', 'current')
976
977 # Commit up to r3, so we can test various recovery scenarios.
978 svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newer line\n')
979 sbox.simple_commit(message='log msg')
980
981 svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newest line\n')
982 sbox.simple_commit(message='log msg')
983
984 # Remember the contents of the db/current file.
985 expected_current_contents = open(current_path).read()
986
987 # Move aside the current file for r3.
988 os.rename(os.path.join(sbox.repo_dir, 'db','current'),
989 os.path.join(sbox.repo_dir, 'db','was_current'))
990
991 # Run 'svnadmin recover' and check that the current file is recreated.
992 exit_code, output, errput = svntest.main.run_svnadmin("recover",
993 sbox.repo_dir)
994 if errput:
995 raise SVNUnexpectedStderr(errput)
996
997 actual_current_contents = open(current_path).read()
998 svntest.verify.compare_and_display_lines(
999 "Contents of db/current is unexpected.",
1000 'db/current', expected_current_contents, actual_current_contents)
1001
1002 # Now try writing db/current to be one rev lower than it should be.
1003 svntest.main.file_write(current_path, '2\n')
1004
1005 # Run 'svnadmin recover' and check that the current file is fixed.
1006 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1007 sbox.repo_dir)
1008 if errput:
1009 raise SVNUnexpectedStderr(errput)
1010
1011 actual_current_contents = open(current_path).read()
1012 svntest.verify.compare_and_display_lines(
1013 "Contents of db/current is unexpected.",
1014 'db/current', expected_current_contents, actual_current_contents)
1015
1016 # Now try writing db/current to be *two* revs lower than it should be.
1017 svntest.main.file_write(current_path, '1\n')
1018
1019 # Run 'svnadmin recover' and check that the current file is fixed.
1020 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1021 sbox.repo_dir)
1022 if errput:
1023 raise SVNUnexpectedStderr(errput)
1024
1025 actual_current_contents = open(current_path).read()
1026 svntest.verify.compare_and_display_lines(
1027 "Contents of db/current is unexpected.",
1028 'db/current', expected_current_contents, actual_current_contents)
1029
1030 # Now try writing db/current to be fish revs lower than it should be.
1031 #
1032 # Note: I'm not actually sure it's wise to recover from this, but
1033 # detecting it would require rewriting fs_fs.c:get_youngest() to
1034 # check the actual contents of its buffer, since atol() will happily
1035 # convert "fish" to 0.
1036 svntest.main.file_write(current_path, 'fish\n')
1037
1038 # Run 'svnadmin recover' and check that the current file is fixed.
1039 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1040 sbox.repo_dir)
1041 if errput:
1042 raise SVNUnexpectedStderr(errput)
1043
1044 actual_current_contents = open(current_path).read()
1045 svntest.verify.compare_and_display_lines(
1046 "Contents of db/current is unexpected.",
1047 'db/current', expected_current_contents, actual_current_contents)
1048
1049
1050 @SkipUnless(svntest.main.is_fs_type_fsfs)
1051 def fsfs_recover_db_current(sbox):
1052 "fsfs recover db/current"
1053 corrupt_and_recover_db_current(sbox)
1054
1055
1056 @SkipUnless(svntest.main.is_fs_type_fsfs)
1057 def fsfs_recover_old_db_current(sbox):
1058 "fsfs recover db/current --compatible-version=1.3"
1059
1060 # Around trunk@1573728, 'svnadmin recover' wrongly errored out
1061 # for the --compatible-version=1.3 repositories with missing or
1062 # invalid db/current file:
1063 # svnadmin: E160006: No such revision 1
1064
1065 corrupt_and_recover_db_current(sbox, minor_version=3)
1066
1067 #----------------------------------------------------------------------
1068 @Issue(2983)
1069 def load_with_parent_dir(sbox):
1070 "'svnadmin load --parent-dir' reparents mergeinfo"
1071
1072 ## See https://issues.apache.org/jira/browse/SVN-2983. ##
1073 sbox.build(empty=True)
1074
1075 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
1076 'svnadmin_tests_data',
1077 'mergeinfo_included.dump')
1078 dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
1079
1080 # Create 'sample' dir in sbox.repo_url, and load the dump stream there.
1081 svntest.actions.run_and_verify_svn(['Committing transaction...\n',
1082 'Committed revision 1.\n'],
1083 [], "mkdir", sbox.repo_url + "/sample",
1084 "-m", "Create sample dir")
1085 load_dumpstream(sbox, dumpfile, '--parent-dir', '/sample')
1086
1087 # Verify the svn:mergeinfo properties for '--parent-dir'
1088 svntest.actions.run_and_verify_svn([sbox.repo_url +
1089 "/sample/branch - /sample/trunk:5-7\n"],
1090 [], 'propget', 'svn:mergeinfo', '-R',
1091 sbox.repo_url + '/sample/branch')
1092 svntest.actions.run_and_verify_svn([sbox.repo_url +
1093 "/sample/branch1 - " +
1094 "/sample/branch:6-9\n"],
1095 [], 'propget', 'svn:mergeinfo', '-R',
1096 sbox.repo_url + '/sample/branch1')
1097
1098 # Create 'sample-2' dir in sbox.repo_url, and load the dump stream again.
1099 # This time, don't include a leading slash on the --parent-dir argument.
1100 # See issue #3547.
1101 svntest.actions.run_and_verify_svn(['Committing transaction...\n',
1102 'Committed revision 11.\n'],
1103 [], "mkdir", sbox.repo_url + "/sample-2",
1104 "-m", "Create sample-2 dir")
1105 load_dumpstream(sbox, dumpfile, '--parent-dir', 'sample-2')
1106
1107 # Verify the svn:mergeinfo properties for '--parent-dir'.
1108 svntest.actions.run_and_verify_svn([sbox.repo_url +
1109 "/sample-2/branch - " +
1110 "/sample-2/trunk:15-17\n"],
1111 [], 'propget', 'svn:mergeinfo', '-R',
1112 sbox.repo_url + '/sample-2/branch')
1113 svntest.actions.run_and_verify_svn([sbox.repo_url +
1114 "/sample-2/branch1 - " +
1115 "/sample-2/branch:16-19\n"],
1116 [], 'propget', 'svn:mergeinfo', '-R',
1117 sbox.repo_url + '/sample-2/branch1')
1118
1119 #----------------------------------------------------------------------
1120
1121 def set_uuid(sbox):
1122 "test 'svnadmin setuuid'"
1123
1124 sbox.build(create_wc=False)
1125
1126 # Squirrel away the original repository UUID.
1127 exit_code, output, errput = svntest.main.run_svnlook('uuid', sbox.repo_dir)
1128 if errput:
1129 raise SVNUnexpectedStderr(errput)
1130 orig_uuid = output[0].rstrip()
1131
1132 # Try setting a new, bogus UUID.
1133 svntest.actions.run_and_verify_svnadmin(None, '^.*Malformed UUID.*$',
1134 'setuuid', sbox.repo_dir, 'abcdef')
1135
1136 # Try generating a brand new UUID.
1137 svntest.actions.run_and_verify_svnadmin([], None,
1138 'setuuid', sbox.repo_dir)
1139 exit_code, output, errput = svntest.main.run_svnlook('uuid', sbox.repo_dir)
1140 if errput:
1141 raise SVNUnexpectedStderr(errput)
1142 new_uuid = output[0].rstrip()
1143 if new_uuid == orig_uuid:
1144 logger.warn("Error: new UUID matches the original one")
1145 raise svntest.Failure
1146
1147 # Now, try setting the UUID back to the original value.
1148 svntest.actions.run_and_verify_svnadmin([], None,
1149 'setuuid', sbox.repo_dir, orig_uuid)
1150 exit_code, output, errput = svntest.main.run_svnlook('uuid', sbox.repo_dir)
1151 if errput:
1152 raise SVNUnexpectedStderr(errput)
1153 new_uuid = output[0].rstrip()
1154 if new_uuid != orig_uuid:
1155 logger.warn("Error: new UUID doesn't match the original one")
1156 raise svntest.Failure
1157
1158 #----------------------------------------------------------------------
1159 @Issue(3020)
1160 def reflect_dropped_renumbered_revs(sbox):
1161 "reflect dropped renumbered revs in svn:mergeinfo"
1162
1163 ## See https://issues.apache.org/jira/browse/SVN-3020. ##
1164
1165 sbox.build(empty=True)
1166
1167 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
1168 'svndumpfilter_tests_data',
1169 'with_merges.dump')
1170 dumpfile = svntest.actions.load_dumpfile(dumpfile_location)
1171
1172 # Create 'toplevel' dir in sbox.repo_url
1173 svntest.actions.run_and_verify_svn(['Committing transaction...\n',
1174 'Committed revision 1.\n'],
1175 [], "mkdir", sbox.repo_url + "/toplevel",
1176 "-m", "Create toplevel dir")
1177
1178 # Load the dump stream in sbox.repo_url
1179 load_dumpstream(sbox, dumpfile)
1180
1181 # Load the dump stream in toplevel dir
1182 load_dumpstream(sbox, dumpfile, '--parent-dir', '/toplevel')
1183
1184 # Verify the svn:mergeinfo properties
1185 url = sbox.repo_url
1186 expected_output = svntest.verify.UnorderedOutput([
1187 url + "/trunk - /branch1:5-9\n",
1188 url + "/toplevel/trunk - /toplevel/branch1:14-18\n",
1189 ])
1190 svntest.actions.run_and_verify_svn(expected_output, [],
1191 'propget', 'svn:mergeinfo', '-R',
1192 sbox.repo_url)
1193
1194 #----------------------------------------------------------------------
1195
1196 @SkipUnless(svntest.main.is_fs_type_fsfs)
1197 @Issue(2992)
1198 def fsfs_recover_handle_missing_revs_or_revprops_file(sbox):
1199 """fsfs recovery checks missing revs / revprops files"""
1200 # Set up a repository containing the greek tree.
1201 sbox.build()
1202
1203 # Commit up to r3, so we can test various recovery scenarios.
1204 svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newer line\n')
1205 sbox.simple_commit(message='log msg')
1206
1207 svntest.main.file_append(os.path.join(sbox.wc_dir, 'iota'), 'newest line\n')
1208 sbox.simple_commit(message='log msg')
1209
1210 rev_3 = fsfs_file(sbox.repo_dir, 'revs', '3')
1211 rev_was_3 = rev_3 + '.was'
1212
1213 # Move aside the revs file for r3.
1214 os.rename(rev_3, rev_was_3)
1215
1216 # Verify 'svnadmin recover' fails when youngest has a revprops
1217 # file but no revs file.
1218 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1219 sbox.repo_dir)
1220
1221 if svntest.verify.verify_outputs(
1222 "Output of 'svnadmin recover' is unexpected.", None, errput, None,
1223 ".*Expected current rev to be <= %s but found 3"
1224 # For example, if svntest.main.fsfs_sharding == 2, then rev_3 would
1225 # be the pack file for r2:r3, and the error message would report "<= 1".
1226 % (rev_3.endswith('pack') and '[012]' or '2')):
1227 raise svntest.Failure
1228
1229 # Restore the r3 revs file, thus repairing the repository.
1230 os.rename(rev_was_3, rev_3)
1231
1232 revprop_3 = fsfs_file(sbox.repo_dir, 'revprops', '3')
1233 revprop_was_3 = revprop_3 + '.was'
1234
1235 # Move aside the revprops file for r3.
1236 os.rename(revprop_3, revprop_was_3)
1237
1238 # Verify 'svnadmin recover' fails when youngest has a revs file
1239 # but no revprops file (issue #2992).
1240 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1241 sbox.repo_dir)
1242
1243 if svntest.verify.verify_outputs(
1244 "Output of 'svnadmin recover' is unexpected.", None, errput, None,
1245 ".*Revision 3 has a revs file but no revprops file"):
1246 raise svntest.Failure
1247
1248 # Restore the r3 revprops file, thus repairing the repository.
1249 os.rename(revprop_was_3, revprop_3)
1250
1251 # Change revprops file to a directory for revision 3
1252 os.rename(revprop_3, revprop_was_3)
1253 os.mkdir(revprop_3)
1254
1255 # Verify 'svnadmin recover' fails when youngest has a revs file
1256 # but revprops file is not a file (another aspect of issue #2992).
1257 exit_code, output, errput = svntest.main.run_svnadmin("recover",
1258 sbox.repo_dir)
1259
1260 if svntest.verify.verify_outputs(
1261 "Output of 'svnadmin recover' is unexpected.", None, errput, None,
1262 ".*Revision 3 has a non-file where its revprops file should be.*"):
1263 raise svntest.Failure
1264
1265 # Restore the r3 revprops file, thus repairing the repository.
1266 os.rmdir(revprop_3)
1267 os.rename(revprop_was_3, revprop_3)
1268
1269
1270 #----------------------------------------------------------------------
1271
1272 @Skip(svntest.main.tests_use_prepackaged_repository)
1273 def create_in_repo_subdir(sbox):
1274 "'svnadmin create /path/to/repo/subdir'"
1275
1276 sbox.build(create_wc=False, empty=True)
1277 repo_dir = sbox.repo_dir
1278
1279 success = False
1280 try:
1281 # This should fail
1282 subdir = os.path.join(repo_dir, 'Z')
1283 svntest.main.create_repos(subdir)
1284 except svntest.main.SVNRepositoryCreateFailure:
1285 success = True
1286 if not success:
1287 raise svntest.Failure
1288
1289 cwd = os.getcwd()
1290 success = False
1291 try:
1292 # This should fail, too
1293 subdir = os.path.join(repo_dir, 'conf')
1294 os.chdir(subdir)
1295 svntest.main.create_repos('Z')
1296 os.chdir(cwd)
1297 except svntest.main.SVNRepositoryCreateFailure:
1298 success = True
1299 os.chdir(cwd)
1300 if not success:
1301 raise svntest.Failure
1302
1303
1304 @SkipUnless(svntest.main.is_fs_type_fsfs)
1305 @SkipDumpLoadCrossCheck()
1306 def verify_with_invalid_revprops(sbox):
1307 "svnadmin verify detects invalid revprops file"
1308
1309 sbox.build(create_wc=False, empty=True)
1310 repo_dir = sbox.repo_dir
1311
1312 # Run a test verify
1313 exit_code, output, errput = svntest.main.run_svnadmin("verify",
1314 sbox.repo_dir)
1315
1316 if errput:
1317 raise SVNUnexpectedStderr(errput)
1318 if svntest.verify.verify_outputs(
1319 "Output of 'svnadmin verify' is unexpected.", None, output, None,
1320 ".*Verified revision 0*"):
1321 raise svntest.Failure
1322
1323 # Empty the revprops file
1324 rp_file = open(os.path.join(repo_dir, 'db', 'revprops', '0', '0'), 'w')
1325
1326 rp_file.write('')
1327 rp_file.close()
1328
1329 exit_code, output, errput = svntest.main.run_svnadmin("verify",
1330 sbox.repo_dir)
1331
1332 if svntest.verify.verify_outputs(
1333 "Output of 'svnadmin verify' is unexpected.", None, errput, None,
1334 ".*svnadmin: E200002:.*"):
1335 raise svntest.Failure
1336
1337 #----------------------------------------------------------------------
1338 # Even *more* testing for issue #3020 'Reflect dropped/renumbered
1339 # revisions in svn:mergeinfo data during svnadmin load'
1340 #
1341 # Full or incremental dump-load cycles should result in the same
1342 # mergeinfo in the loaded repository.
1343 #
1344 # Given a repository 'SOURCE-REPOS' with mergeinfo, and a repository
1345 # 'TARGET-REPOS' (which may or may not be empty), either of the following
1346 # methods to move 'SOURCE-REPOS' to 'TARGET-REPOS' should result in
1347 # the same mergeinfo on 'TARGET-REPOS':
1348 #
1349 # 1) Dump -r1:HEAD from 'SOURCE-REPOS' and load it in one shot to
1350 # 'TARGET-REPOS'.
1351 #
1352 # 2) Dump 'SOURCE-REPOS' in a series of incremental dumps and load
1353 # each of them to 'TARGET-REPOS'.
1354 #
1355 # See https://issues.apache.org/jira/browse/SVN-3020#desc13
1356 @Issue(3020)
1357 def dont_drop_valid_mergeinfo_during_incremental_loads(sbox):
1358 "don't filter mergeinfo revs from incremental dump"
1359
1360 # Create an empty repos.
1361 sbox.build(empty=True)
1362
1363 # PART 1: Load a full dump to an empty repository.
1364 #
1365 # The test repository used here, 'mergeinfo_included_full.dump', is
1366 # this repos:
1367 # __________________________________________
1368 # | |
1369 # | ____________________________|_____
1370 # | | | |
1371 # trunk---r2---r3-----r5---r6-------r8---r9---------------> | |
1372 # r1 | | | | | |
1373 # initial | | | |______ | |
1374 # import copy | copy | merge merge
1375 # | | | merge (r5) (r8)
1376 # | | | (r9) | |
1377 # | | | | | |
1378 # | | V V | |
1379 # | | branches/B2-------r11---r12----> | |
1380 # | | r7 |____| | |
1381 # | | | | |
1382 # | merge |___ | |
1383 # | (r6) | | |
1384 # | |_________________ | | |
1385 # | | merge | |
1386 # | | (r11-12) | |
1387 # | | | | |
1388 # V V V | |
1389 # branches/B1-------------------r10--------r13--> | |
1390 # r4 | |
1391 # | V V
1392 # branches/B1/B/E------------------------------r14---r15->
1393 #
1394 #
1395 # The mergeinfo on this repos@15 is:
1396 #
1397 # Properties on 'branches/B1':
1398 # svn:mergeinfo
1399 # /branches/B2:11-12
1400 # /trunk:6,9
1401 # Properties on 'branches/B1/B/E':
1402 # svn:mergeinfo
1403 # /branches/B2/B/E:11-12
1404 # /trunk/B/E:5-6,8-9
1405 # Properties on 'branches/B2':
1406 # svn:mergeinfo
1407 # /trunk:9
1408 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
1409 'svnadmin_tests_data',
1410 'mergeinfo_included_full.dump')
1411 dumpfile_full = svntest.actions.load_dumpfile(dumpfile_location)
1412 load_dumpstream(sbox, dumpfile_full, '--ignore-uuid')
1413
1414 # Check that the mergeinfo is as expected.
1415 url = sbox.repo_url + '/branches/'
1416 expected_output = svntest.verify.UnorderedOutput([
1417 url + "B1 - /branches/B2:11-12\n",
1418 "/trunk:6,9\n",
1419 url + "B2 - /trunk:9\n",
1420 url + "B1/B/E - /branches/B2/B/E:11-12\n",
1421 "/trunk/B/E:5-6,8-9\n"])
1422 svntest.actions.run_and_verify_svn(expected_output, [],
1423 'propget', 'svn:mergeinfo', '-R',
1424 sbox.repo_url)
1425
1426 # PART 2: Load a a series of incremental dumps to an empty repository.
1427 #
1428 # Incrementally dump the repository into three dump files:
1429 dump_file_r1_10 = sbox.get_tempname("r1-10-dump")
1430 exit_code, output, errput = svntest.main.run_svnadmin(
1431 'dump', sbox.repo_dir, '-r1:10')
1432 dump_fp = open(dump_file_r1_10, 'wb')
1433 dump_fp.writelines(output)
1434 dump_fp.close()
1435
1436 dump_file_r11_13 = sbox.get_tempname("r11-13-dump")
1437 exit_code, output, errput = svntest.main.run_svnadmin(
1438 'dump', sbox.repo_dir, '--incremental', '-r11:13')
1439 dump_fp = open(dump_file_r11_13, 'wb')
1440 dump_fp.writelines(output)
1441 dump_fp.close()
1442
1443 dump_file_r14_15 = sbox.get_tempname("r14-15-dump")
1444 exit_code, output, errput = svntest.main.run_svnadmin(
1445 'dump', sbox.repo_dir, '--incremental', '-r14:15')
1446 dump_fp = open(dump_file_r14_15, 'wb')
1447 dump_fp.writelines(output)
1448 dump_fp.close()
1449
1450 # Blow away the current repos and create an empty one in its place.
1451 sbox.build(empty=True)
1452
1453 # Load the three incremental dump files in sequence.
1454 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r1_10),
1455 '--ignore-uuid')
1456 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r11_13),
1457 '--ignore-uuid')
1458 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r14_15),
1459 '--ignore-uuid')
1460
1461 # Check the mergeinfo, we use the same expected output as before,
1462 # as it (duh!) should be exactly the same as when we loaded the
1463 # repos in one shot.
1464 svntest.actions.run_and_verify_svn(expected_output, [],
1465 'propget', 'svn:mergeinfo', '-R',
1466 sbox.repo_url)
1467
1468 # Now repeat the above two scenarios, but with an initially non-empty target
1469 # repository. First, try the full dump-load in one shot.
1470 #
1471 # PART 3: Load a full dump to an non-empty repository.
1472 #
1473 # Reset our sandbox.
1474 sbox.build(empty=True)
1475
1476 # Load this skeleton repos into the empty target:
1477 #
1478 # Projects/ (Added r1)
1479 # README (Added r2)
1480 # Project-X (Added r3)
1481 # Project-Y (Added r4)
1482 # Project-Z (Added r5)
1483 # docs/ (Added r6)
1484 # README (Added r6)
1485 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
1486 'svnadmin_tests_data',
1487 'skeleton_repos.dump')
1488 dumpfile_skeleton = svntest.actions.load_dumpfile(dumpfile_location)
1489 load_dumpstream(sbox, dumpfile_skeleton, '--ignore-uuid')
1490
1491 # Load 'svnadmin_tests_data/mergeinfo_included_full.dump' in one shot:
1492 load_dumpstream(sbox, dumpfile_full, '--parent-dir', 'Projects/Project-X',
1493 '--ignore-uuid')
1494
1495 # Check that the mergeinfo is as expected. This is exactly the
1496 # same expected mergeinfo we previously checked, except that the
1497 # revisions are all offset +6 to reflect the revions already in
1498 # the skeleton target before we began loading and the leading source
1499 # paths are adjusted by the --parent-dir:
1500 #
1501 # Properties on 'branches/B1':
1502 # svn:mergeinfo
1503 # /Projects/Project-X/branches/B2:17-18
1504 # /Projects/Project-X/trunk:12,15
1505 # Properties on 'branches/B1/B/E':
1506 # svn:mergeinfo
1507 # /Projects/Project-X/branches/B2/B/E:17-18
1508 # /Projects/Project-X/trunk/B/E:11-12,14-15
1509 # Properties on 'branches/B2':
1510 # svn:mergeinfo
1511 # /Projects/Project-X/trunk:15
1512 url = sbox.repo_url + '/Projects/Project-X/branches/'
1513 expected_output = svntest.verify.UnorderedOutput([
1514 url + "B1 - /Projects/Project-X/branches/B2:17-18\n",
1515 "/Projects/Project-X/trunk:12,15\n",
1516 url + "B2 - /Projects/Project-X/trunk:15\n",
1517 url + "B1/B/E - /Projects/Project-X/branches/B2/B/E:17-18\n",
1518 "/Projects/Project-X/trunk/B/E:11-12,14-15\n"])
1519 svntest.actions.run_and_verify_svn(expected_output, [],
1520 'propget', 'svn:mergeinfo', '-R',
1521 sbox.repo_url)
1522
1523 # PART 4: Load a a series of incremental dumps to an non-empty repository.
1524 #
1525 # Reset our sandbox.
1526 sbox.build(empty=True)
1527
1528 # Load this skeleton repos into the empty target:
1529 load_dumpstream(sbox, dumpfile_skeleton, '--ignore-uuid')
1530
1531 # Load the three incremental dump files in sequence.
1532 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r1_10),
1533 '--parent-dir', 'Projects/Project-X', '--ignore-uuid')
1534 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r11_13),
1535 '--parent-dir', 'Projects/Project-X', '--ignore-uuid')
1536 load_dumpstream(sbox, svntest.actions.load_dumpfile(dump_file_r14_15),
1537 '--parent-dir', 'Projects/Project-X', '--ignore-uuid')
1538
1539 # Check the resulting mergeinfo. We expect the exact same results
1540 # as Part 3.
1541 # See https://issues.apache.org/jira/browse/SVN-3020#desc16.
1542 svntest.actions.run_and_verify_svn(expected_output, [],
1543 'propget', 'svn:mergeinfo', '-R',
1544 sbox.repo_url)
1545
1546
1547 @SkipUnless(svntest.main.is_posix_os)
1548 @Issue(2591)
1549 def hotcopy_symlink(sbox):
1550 "'svnadmin hotcopy' replicates symlink"
1551
1552 ## See https://issues.apache.org/jira/browse/SVN-2591. ##
1553
1554 # Create a repository.
1555 sbox.build(create_wc=False, empty=True)
1556 original_repo = sbox.repo_dir
1557
1558 hotcopy_repo, hotcopy_url = sbox.add_repo_path('hotcopy')
1559
1560 # Create a file, a dir and a missing path outside the repoitory.
1561 svntest.main.safe_rmtree(sbox.wc_dir, 1)
1562 os.mkdir(sbox.wc_dir)
1563 external_file_path = os.path.join(sbox.wc_dir, "file")
1564 svntest.main.file_write(external_file_path, "An existing file")
1565 external_dir_path = os.path.join(sbox.wc_dir, "dir")
1566 os.mkdir(external_dir_path)
1567 external_missing_path = os.path.join(sbox.wc_dir, "missing")
1568
1569 # Symlink definitions: base name -> target relpath.
1570 # Check both existing and nonexistent targets.
1571 # Check targets both within and outside the source repository.
1572 symlinks = [
1573 ('in_repos_file', 'format'),
1574 ('in_repos_dir', 'conf'),
1575 ('in_repos_missing', 'missing'),
1576 ('external_file', os.path.join('..', '..', '..', external_file_path)),
1577 ('external_dir', os.path.join('..', '..', '..', external_dir_path)),
1578 ('external_missing', os.path.join('..', '..', '..', external_missing_path)),
1579 ]
1580
1581 # Create symlinks within the repository directory.
1582 for name, target_relpath in symlinks:
1583 target_path = os.path.join(original_repo, target_relpath)
1584 target_abspath = os.path.abspath(target_path)
1585
1586 # Create two symlinks to each target - one relative, one absolute.
1587 symlink_path = os.path.join(original_repo, name)
1588 os.symlink(target_relpath, symlink_path + '_rel')
1589 os.symlink(target_abspath, symlink_path + '_abs')
1590
1591 svntest.actions.run_and_verify_svnadmin(
1592 None, [],
1593 "hotcopy", original_repo, hotcopy_repo)
1594
1595 # Check if the symlinks were copied correctly.
1596 for name, target_relpath in symlinks:
1597 target_path = os.path.join(original_repo, target_relpath)
1598 target_abspath = os.path.abspath(target_path)
1599
1600 # Check two symlinks to each target - one relative, one absolute.
1601 symlink_path = os.path.join(hotcopy_repo, name)
1602 if os.readlink(symlink_path + '_rel') != target_relpath:
1603 raise svntest.Failure
1604 if os.readlink(symlink_path + '_abs') != target_abspath:
1605 raise svntest.Failure
1606
1607 def load_bad_props(sbox):
1608 "svnadmin load with invalid svn: props"
1609
1610 dump_str = b"""SVN-fs-dump-format-version: 2
1611
1612 UUID: dc40867b-38f6-0310-9f5f-f81aa277e06f
1613
1614 Revision-number: 0
1615 Prop-content-length: 56
1616 Content-length: 56
1617
1618 K 8
1619 svn:date
1620 V 27
1621 2005-05-03T19:09:41.129900Z
1622 PROPS-END
1623
1624 Revision-number: 1
1625 Prop-content-length: 99
1626 Content-length: 99
1627
1628 K 7
1629 svn:log
1630 V 3
1631 \n\r\n
1632 K 10
1633 svn:author
1634 V 2
1635 pl
1636 K 8
1637 svn:date
1638 V 27
1639 2005-05-03T19:10:19.975578Z
1640 PROPS-END
1641
1642 Node-path: file
1643 Node-kind: file
1644 Node-action: add
1645 Prop-content-length: 10
1646 Text-content-length: 5
1647 Text-content-md5: e1cbb0c3879af8347246f12c559a86b5
1648 Content-length: 15
1649
1650 PROPS-END
1651 text
1652
1653
1654 """
1655 sbox.build(empty=True)
1656
1657 # Try to load the dumpstream, expecting a failure (because of mixed EOLs).
1658 exp_err = svntest.verify.RegexListOutput(['svnadmin: E125005:.*',
1659 'svnadmin: E125005:.*',
1660 'svnadmin: E125017:.*'],
1661 match_all=False)
1662 load_and_verify_dumpstream(sbox, [], exp_err, dumpfile_revisions,
1663 False, dump_str, '--ignore-uuid')
1664
1665 # Now try it again bypassing prop validation. (This interface takes
1666 # care of the removal and recreation of the original repository.)
1667 svntest.actions.load_repo(sbox, dump_str=dump_str,
1668 bypass_prop_validation=True)
1669 # Getting the property should fail.
1670 svntest.actions.run_and_verify_svn(None, 'svn: E135000: ',
1671 'pg', 'svn:log', '--revprop', '-r1',
1672 sbox.repo_url)
1673
1674 # Now try it again with prop normalization.
1675 svntest.actions.load_repo(sbox, dump_str=dump_str,
1676 bypass_prop_validation=False,
1677 normalize_props=True)
1678 # We should get the expected property value.
1679 exit_code, output, _ = svntest.main.run_svn(None, 'pg', 'svn:log',
1680 '--revprop', '-r1',
1681 '--no-newline',
1682 sbox.repo_url)
1683 svntest.verify.verify_exit_code(None, exit_code, 0)
1684 if output != ['\n', '\n']:
1685 raise svntest.Failure("Unexpected property value %s" % output)
1686
1687 # This test intentionally corrupts a revision and assumes an FSFS
1688 # repository. If you can make it work with BDB please do so.
1689 # However, the verification triggered by this test is in the repos layer
1690 # so it will trigger with either backend anyway.
1691 @SkipUnless(svntest.main.is_fs_type_fsfs)
1692 @SkipUnless(svntest.main.server_enforces_UTF8_fspaths_in_verify)
1693 def verify_non_utf8_paths(sbox):
1694 "svnadmin verify with non-UTF-8 paths"
1695
1696 if svntest.main.options.fsfs_version is not None and \
1697 svntest.main.options.fsfs_version not in [4, 6]:
1698 raise svntest.Skip("Unsupported prepackaged repository version")
1699
1700 dumpfile = clean_dumpfile()
1701
1702 # Corruption only possible in physically addressed revisions created
1703 # with pre-1.6 servers.
1704 sbox.build(empty=True,
1705 minor_version=min(svntest.main.options.server_minor_version,8))
1706
1707 # Load the dumpstream
1708 load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False,
1709 dumpfile, '--ignore-uuid')
1710
1711 # Replace the path 'A' in revision 1 with a non-UTF-8 sequence.
1712 # This has been observed in repositories in the wild, though Subversion
1713 # 1.6 and greater should prevent such filenames from entering the repository.
1714 path1 = os.path.join(sbox.repo_dir, "db", "revs", "0", "1")
1715 path_new = os.path.join(sbox.repo_dir, "db", "revs", "0", "1.new")
1716 fp1 = open(path1, 'rb')
1717 fp_new = open(path_new, 'wb')
1718 for line in fp1.readlines():
1719 if line == b"A\n":
1720 # replace 'A' with a latin1 character -- the new path is not valid UTF-8
1721 fp_new.write(b"\xE6\n")
1722 elif line == b"text: 1 340 32 32 a6be7b4cf075fd39e6a99eb69a31232b\n":
1723 # phys, PLAIN directories: fix up the representation checksum
1724 fp_new.write(b"text: 1 340 32 32 f2e93e73272cac0f18fccf16f224eb93\n")
1725 elif line == b"text: 1 340 44 32 a6be7b4cf075fd39e6a99eb69a31232b\n":
1726 # phys, deltified directories: fix up the representation checksum
1727 fp_new.write(b"text: 1 340 44 32 f2e93e73272cac0f18fccf16f224eb93\n")
1728 elif line == b"cpath: /A\n":
1729 # also fix up the 'created path' field
1730 fp_new.write(b"cpath: /\xE6\n")
1731 elif line == b"_0.0.t0-0 add-file true true /A\n":
1732 # and another occurrance
1733 fp_new.write(b"_0.0.t0-0 add-file true true /\xE6\n")
1734 else:
1735 fp_new.write(line)
1736 fp1.close()
1737 fp_new.close()
1738 os.remove(path1)
1739 os.rename(path_new, path1)
1740
1741 # Verify the repository, expecting failure
1742 exit_code, output, errput = svntest.main.run_svnadmin("verify",
1743 sbox.repo_dir)
1744 svntest.verify.verify_outputs(
1745 "Unexpected error while running 'svnadmin verify'.",
1746 [], errput, None, ".*Path '.*' is not in UTF-8.*")
1747
1748 # Make sure the repository can still be dumped so that the
1749 # encoding problem can be fixed in a dump/edit/load cycle.
1750 expected_stderr = [
1751 "* Dumped revision 0.\n",
1752 "WARNING 0x0002: E160005: "
1753 "While validating fspath '?\\E6': "
1754 "Path '?\\E6' is not in UTF-8"
1755 "\n",
1756 "* Dumped revision 1.\n",
1757 ]
1758 exit_code, output, errput = svntest.main.run_svnadmin("dump", sbox.repo_dir)
1759 if svntest.verify.compare_and_display_lines(
1760 "Output of 'svnadmin dump' is unexpected.",
1761 'STDERR', expected_stderr, errput):
1762 raise svntest.Failure
1763
1764 def test_lslocks_and_rmlocks(sbox):
1765 "test 'svnadmin lslocks' and 'svnadmin rmlocks'"
1766
1767 sbox.build(create_wc=False)
1768 iota_url = sbox.repo_url + '/iota'
1769 lambda_url = sbox.repo_url + '/A/B/lambda'
1770
1771 exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
1772 sbox.repo_dir)
1773
1774 if exit_code or errput or output:
1775 raise svntest.Failure("Error: 'lslocks' failed")
1776
1777 expected_output = svntest.verify.UnorderedRegexListOutput(
1778 ["'.*lambda' locked by user 'jrandom'.\n",
1779 "'.*iota' locked by user 'jrandom'.\n"])
1780
1781 # Lock iota and A/B/lambda using svn client
1782 svntest.actions.run_and_verify_svn(expected_output,
1783 [], "lock", "-m", "Locking files",
1784 iota_url, lambda_url)
1785
1786 def expected_output_list(path):
1787 return [
1788 "Path: " + path,
1789 "UUID Token: opaquelocktoken:.*",
1790 "Owner: jrandom",
1791 "Created:.*",
1792 "Expires:.*",
1793 r"Comment \(1 line\):",
1794 "Locking files",
1795 "\n", # empty line
1796 ]
1797
1798 # List all locks
1799 exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
1800 sbox.repo_dir)
1801 if errput:
1802 raise SVNUnexpectedStderr(errput)
1803 svntest.verify.verify_exit_code(None, exit_code, 0)
1804
1805 expected_output = svntest.verify.UnorderedRegexListOutput(
1806 expected_output_list('/A/B/lambda') +
1807 expected_output_list('/iota'))
1808 svntest.verify.compare_and_display_lines('lslocks output mismatch',
1809 'output',
1810 expected_output, output)
1811
1812 # List lock in path /A
1813 exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
1814 sbox.repo_dir,
1815 "A")
1816 if errput:
1817 raise SVNUnexpectedStderr(errput)
1818
1819 expected_output = svntest.verify.RegexListOutput(
1820 expected_output_list('/A/B/lambda'))
1821 svntest.verify.compare_and_display_lines('lslocks output mismatch',
1822 'output',
1823 expected_output, output)
1824 svntest.verify.verify_exit_code(None, exit_code, 0)
1825
1826 # Remove locks
1827 exit_code, output, errput = svntest.main.run_svnadmin("rmlocks",
1828 sbox.repo_dir,
1829 "iota",
1830 "A/B/lambda")
1831 expected_output = UnorderedOutput(["Removed lock on '/iota'.\n",
1832 "Removed lock on '/A/B/lambda'.\n"])
1833
1834 svntest.verify.verify_outputs(
1835 "Unexpected output while running 'svnadmin rmlocks'.",
1836 output, [], expected_output, None)
1837
1838 #----------------------------------------------------------------------
1839 @Issue(3734)
1840 def load_ranges(sbox):
1841 "'svnadmin load --revision X:Y'"
1842
1843 ## See https://issues.apache.org/jira/browse/SVN-3734. ##
1844 sbox.build(empty=True)
1845
1846 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
1847 'svnadmin_tests_data',
1848 'skeleton_repos.dump')
1849 dumplines = svntest.actions.load_dumpfile(dumpfile_location)
1850
1851 # Load our dumpfile, 2 revisions at a time, verifying that we have
1852 # the correct youngest revision after each load.
1853 load_dumpstream(sbox, dumplines, '-r0:2')
1854 svntest.actions.run_and_verify_svnlook(['2\n'],
1855 None, 'youngest', sbox.repo_dir)
1856 load_dumpstream(sbox, dumplines, '-r3:4')
1857 svntest.actions.run_and_verify_svnlook(['4\n'],
1858 None, 'youngest', sbox.repo_dir)
1859 load_dumpstream(sbox, dumplines, '-r5:6')
1860 svntest.actions.run_and_verify_svnlook(['6\n'],
1861 None, 'youngest', sbox.repo_dir)
1862
1863 # There are ordering differences in the property blocks.
1864 if (svntest.main.options.server_minor_version < 6):
1865 temp = []
1866
1867 for line in dumplines:
1868 if not "Text-content-sha1:" in line:
1869 temp.append(line)
1870
1871 expected_dump = UnorderedOutput(temp)
1872 else:
1873 expected_dump = UnorderedOutput(dumplines)
1874
1875 new_dumpdata = svntest.actions.run_and_verify_dump(sbox.repo_dir)
1876 svntest.verify.compare_and_display_lines("Dump files", "DUMP",
1877 expected_dump, new_dumpdata)
1878
1879 @SkipUnless(svntest.main.is_fs_type_fsfs)
1880 def hotcopy_incremental(sbox):
1881 "'svnadmin hotcopy --incremental PATH .'"
1882 sbox.build()
1883
1884 backup_dir, backup_url = sbox.add_repo_path('backup')
1885 os.mkdir(backup_dir)
1886 cwd = os.getcwd()
1887
1888 for i in [1, 2, 3]:
1889 os.chdir(backup_dir)
1890 svntest.actions.run_and_verify_svnadmin(
1891 None, [],
1892 "hotcopy", "--incremental", os.path.join(cwd, sbox.repo_dir), '.')
1893
1894 os.chdir(cwd)
1895
1896 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
1897
1898 if i < 3:
1899 sbox.simple_mkdir("newdir-%i" % i)
1900 sbox.simple_commit()
1901
1902 @SkipUnless(svntest.main.is_fs_type_fsfs)
1903 @SkipUnless(svntest.main.fs_has_pack)
1904 def hotcopy_incremental_packed(sbox):
1905 "'svnadmin hotcopy --incremental' with packing"
1906
1907 # Configure two files per shard to trigger packing.
1908 sbox.build()
1909 patch_format(sbox.repo_dir, shard_size=2)
1910
1911 backup_dir, backup_url = sbox.add_repo_path('backup')
1912 os.mkdir(backup_dir)
1913 cwd = os.getcwd()
1914
1915 # Pack revisions 0 and 1 if not already packed.
1916 if not (svntest.main.is_fs_type_fsfs and svntest.main.options.fsfs_packing
1917 and svntest.main.options.fsfs_sharding == 2):
1918 svntest.actions.run_and_verify_svnadmin(
1919 ['Packing revisions in shard 0...done.\n'], [], "pack",
1920 os.path.join(cwd, sbox.repo_dir))
1921
1922 # Commit 5 more revs, hotcopy and pack after each commit.
1923 for i in [1, 2, 3, 4, 5]:
1924 os.chdir(backup_dir)
1925 svntest.actions.run_and_verify_svnadmin(
1926 None, [],
1927 "hotcopy", "--incremental", os.path.join(cwd, sbox.repo_dir), '.')
1928
1929 os.chdir(cwd)
1930
1931 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
1932
1933 if i < 5:
1934 sbox.simple_mkdir("newdir-%i" % i)
1935 sbox.simple_commit()
1936 if (svntest.main.is_fs_type_fsfs and not svntest.main.options.fsfs_packing
1937 and not i % 2):
1938 expected_output = ['Packing revisions in shard %d...done.\n' % (i/2)]
1939 else:
1940 expected_output = []
1941 svntest.actions.run_and_verify_svnadmin(
1942 expected_output, [], "pack", os.path.join(cwd, sbox.repo_dir))
1943
1944
1945 def locking(sbox):
1946 "svnadmin lock tests"
1947 sbox.build(create_wc=False)
1948
1949 comment_path = os.path.join(svntest.main.temp_dir, "comment")
1950 svntest.main.file_write(comment_path, "dummy comment")
1951
1952 invalid_comment_path = os.path.join(svntest.main.temp_dir, "invalid_comment")
1953 svntest.main.file_write(invalid_comment_path, "character is invalid")
1954
1955 # Test illegal character in comment file.
1956 expected_error = ".*svnadmin: E130004:.*"
1957 svntest.actions.run_and_verify_svnadmin(None,
1958 expected_error, "lock",
1959 sbox.repo_dir,
1960 "iota", "jrandom",
1961 invalid_comment_path)
1962
1963 # Test locking path with --bypass-hooks
1964 expected_output = "'/iota' locked by user 'jrandom'."
1965 svntest.actions.run_and_verify_svnadmin(expected_output,
1966 None, "lock",
1967 sbox.repo_dir,
1968 "iota", "jrandom",
1969 comment_path,
1970 "--bypass-hooks")
1971
1972 # Remove lock
1973 svntest.actions.run_and_verify_svnadmin(None,
1974 None, "rmlocks",
1975 sbox.repo_dir, "iota")
1976
1977 # Test locking path without --bypass-hooks
1978 expected_output = "'/iota' locked by user 'jrandom'."
1979 svntest.actions.run_and_verify_svnadmin(expected_output,
1980 None, "lock",
1981 sbox.repo_dir,
1982 "iota", "jrandom",
1983 comment_path)
1984
1985 # Test locking already locked path.
1986 expected_error = ".*svnadmin: E160035:.*"
1987 svntest.actions.run_and_verify_svnadmin(None,
1988 expected_error, "lock",
1989 sbox.repo_dir,
1990 "iota", "jrandom",
1991 comment_path)
1992
1993 # Test locking non-existent path.
1994 expected_error = ".*svnadmin: E160013:.*"
1995 svntest.actions.run_and_verify_svnadmin(None,
1996 expected_error, "lock",
1997 sbox.repo_dir,
1998 "non-existent", "jrandom",
1999 comment_path)
2000
2001 # Test locking a path while specifying a lock token.
2002 expected_output = "'/A/D/G/rho' locked by user 'jrandom'."
2003 lock_token = "opaquelocktoken:01234567-89ab-cdef-89ab-cdef01234567"
2004 svntest.actions.run_and_verify_svnadmin(expected_output,
2005 None, "lock",
2006 sbox.repo_dir,
2007 "A/D/G/rho", "jrandom",
2008 comment_path, lock_token)
2009
2010 # Test unlocking a path, but provide the wrong lock token.
2011 expected_error = ".*svnadmin: E160040:.*"
2012 wrong_lock_token = "opaquelocktoken:12345670-9ab8-defc-9ab8-def01234567c"
2013 svntest.actions.run_and_verify_svnadmin(None,
2014 expected_error, "unlock",
2015 sbox.repo_dir,
2016 "A/D/G/rho", "jrandom",
2017 wrong_lock_token)
2018
2019 # Test unlocking the path again, but this time provide the correct
2020 # lock token.
2021 expected_output = "'/A/D/G/rho' unlocked by user 'jrandom'."
2022 svntest.actions.run_and_verify_svnadmin(expected_output,
2023 None, "unlock",
2024 sbox.repo_dir,
2025 "A/D/G/rho", "jrandom",
2026 lock_token)
2027
2028 # Install lock/unlock prevention hooks.
2029 hook_path = svntest.main.get_pre_lock_hook_path(sbox.repo_dir)
2030 svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
2031 hook_path = svntest.main.get_pre_unlock_hook_path(sbox.repo_dir)
2032 svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
2033
2034 # Test locking a path. Don't use --bypass-hooks, though, as we wish
2035 # to verify that hook script is really getting executed.
2036 expected_error = ".*svnadmin: E165001:.*"
2037 svntest.actions.run_and_verify_svnadmin(None,
2038 expected_error, "lock",
2039 sbox.repo_dir,
2040 "iota", "jrandom",
2041 comment_path)
2042
2043 # Fetch the lock token for our remaining locked path. (We didn't
2044 # explicitly set it, so it will vary from test run to test run.)
2045 exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
2046 sbox.repo_dir,
2047 "iota")
2048 iota_token = None
2049 for line in output:
2050 if line.startswith("UUID Token: opaquelocktoken:"):
2051 iota_token = line[12:].rstrip()
2052 break
2053 if iota_token is None:
2054 raise svntest.Failure("Unable to lookup lock token for 'iota'")
2055
2056 # Try to unlock a path while providing the correct lock token but
2057 # with a preventative hook in place.
2058 expected_error = ".*svnadmin: E165001:.*"
2059 svntest.actions.run_and_verify_svnadmin(None,
2060 expected_error, "unlock",
2061 sbox.repo_dir,
2062 "iota", "jrandom",
2063 iota_token)
2064
2065 # Finally, use --bypass-hooks to unlock the path (again using the
2066 # correct lock token).
2067 expected_output = "'/iota' unlocked by user 'jrandom'."
2068 svntest.actions.run_and_verify_svnadmin(expected_output,
2069 None, "unlock",
2070 "--bypass-hooks",
2071 sbox.repo_dir,
2072 "iota", "jrandom",
2073 iota_token)
2074
2075
2076 @SkipUnless(svntest.main.is_threaded_python)
2077 @Issue(4129)
2078 def mergeinfo_race(sbox):
2079 "concurrent mergeinfo commits invalidate pred-count"
2080 sbox.build()
2081
2082 # This test exercises two commit-time race condition bugs:
2083 #
2084 # (a) metadata corruption when concurrent commits change svn:mergeinfo (issue #4129)
2085 # (b) false positive SVN_ERR_FS_CONFLICT error with httpv1 commits
2086 # https://mail-archives.apache.org/mod_mbox/subversion-dev/201507.mbox/%[email protected]%3E
2087 #
2088 # Both bugs are timing-dependent and might not reproduce 100% of the time.
2089
2090 wc_dir = sbox.wc_dir
2091 wc2_dir = sbox.add_wc_path('2')
2092
2093 ## Create wc2.
2094 svntest.main.run_svn(None, 'checkout', '-q', sbox.repo_url, wc2_dir)
2095
2096 ## Some random edits.
2097 svntest.main.run_svn(None, 'mkdir', sbox.ospath('d1', wc_dir))
2098 svntest.main.run_svn(None, 'mkdir', sbox.ospath('d2', wc2_dir))
2099
2100 ## Set random mergeinfo properties.
2101 svntest.main.run_svn(None, 'ps', 'svn:mergeinfo', '/P:42', sbox.ospath('A', wc_dir))
2102 svntest.main.run_svn(None, 'ps', 'svn:mergeinfo', '/Q:42', sbox.ospath('iota', wc2_dir))
2103
2104 def makethread(some_wc_dir):
2105 def worker():
2106 svntest.main.run_svn(None, 'commit', '-mm', some_wc_dir)
2107 return worker
2108
2109 t1 = threading.Thread(None, makethread(wc_dir))
2110 t2 = threading.Thread(None, makethread(wc2_dir))
2111
2112 # t2 will trigger the issue #4129 sanity check in fs_fs.c
2113 t1.start(); t2.start()
2114
2115 t1.join(); t2.join()
2116
2117 # Crude attempt to make sure everything worked.
2118 # TODO: better way to catch exceptions in the thread
2119 if svntest.actions.run_and_parse_info(sbox.repo_url)[0]['Revision'] != '3':
2120 raise svntest.Failure("one or both commits failed")
2121
2122
2123 @Issue(4213)
2124 @Skip(svntest.main.is_fs_type_fsx)
2125 def recover_old_empty(sbox):
2126 "recover empty --compatible-version=1.3"
2127 sbox.build(create_wc=False, empty=True, minor_version=3)
2128 svntest.actions.run_and_verify_svnadmin(None, [],
2129 "recover", sbox.repo_dir)
2130
2131
2132 @SkipUnless(svntest.main.is_fs_type_fsfs)
2133 def verify_keep_going(sbox):
2134 "svnadmin verify --keep-going test"
2135
2136 # No support for modifying pack files
2137 if svntest.main.options.fsfs_packing:
2138 raise svntest.Skip('fsfs packing set')
2139
2140 sbox.build(create_wc = False)
2141 repo_url = sbox.repo_url
2142 B_url = sbox.repo_url + '/B'
2143 C_url = sbox.repo_url + '/C'
2144
2145 # Create A/B/E/bravo in r2.
2146 svntest.actions.run_and_verify_svn(None, [],
2147 'mkdir', '-m', 'log_msg',
2148 B_url)
2149
2150 svntest.actions.run_and_verify_svn(None, [],
2151 'mkdir', '-m', 'log_msg',
2152 C_url)
2153
2154 r2 = fsfs_file(sbox.repo_dir, 'revs', '2')
2155 fp = open(r2, 'r+b')
2156 fp.write(b"inserting junk to corrupt the rev")
2157 fp.close()
2158 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2159 "--keep-going",
2160 sbox.repo_dir)
2161
2162 exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
2163 ".*Verified revision 1.",
2164 ".*",
2165 ".*Summary.*",
2166 ".*r2: E160004:.*",
2167 ".*r2: E160004:.*",
2168 ".*r3: E160004:.*",
2169 ".*r3: E160004:.*"])
2170
2171 if (svntest.main.fs_has_rep_sharing()):
2172 exp_out.insert(0, ".*Verifying.*metadata.*")
2173
2174 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2175 "svnadmin: E160004:.*",
2176 "svnadmin: E160004:.*",
2177 ".*Error verifying revision 3.",
2178 "svnadmin: E160004:.*",
2179 "svnadmin: E160004:.*",
2180 "svnadmin: E205012:.*"], False)
2181
2182 if (svntest.main.is_fs_log_addressing()):
2183 exp_err.insert(0, ".*Error verifying repository metadata.")
2184 exp_err.insert(1, "svnadmin: E160004:.*")
2185
2186 if svntest.verify.verify_outputs("Unexpected error while running 'svnadmin verify'.",
2187 output, errput, exp_out, exp_err):
2188 raise svntest.Failure
2189
2190 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2191 sbox.repo_dir)
2192
2193 if (svntest.main.is_fs_log_addressing()):
2194 exp_out = svntest.verify.RegexListOutput([".*Verifying metadata at revision 0.*"])
2195 else:
2196 exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
2197 ".*Verified revision 1."])
2198 if (svntest.main.fs_has_rep_sharing()):
2199 exp_out.insert(0, ".*Verifying repository metadata.*")
2200
2201 if (svntest.main.is_fs_log_addressing()):
2202 exp_err = svntest.verify.RegexListOutput([
2203 ".*Error verifying repository metadata.",
2204 "svnadmin: E160004:.*"], False)
2205 else:
2206 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2207 "svnadmin: E160004:.*",
2208 "svnadmin: E160004:.*"], False)
2209
2210 if svntest.verify.verify_outputs("Unexpected error while running 'svnadmin verify'.",
2211 output, errput, exp_out, exp_err):
2212 raise svntest.Failure
2213
2214
2215 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2216 "--quiet",
2217 sbox.repo_dir)
2218
2219 if (svntest.main.is_fs_log_addressing()):
2220 exp_err = svntest.verify.RegexListOutput([
2221 ".*Error verifying repository metadata.",
2222 "svnadmin: E160004:.*"], False)
2223 else:
2224 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2225 "svnadmin: E160004:.*",
2226 "svnadmin: E160004:.*"], False)
2227
2228 if svntest.verify.verify_outputs("Output of 'svnadmin verify' is unexpected.",
2229 None, errput, None, exp_err):
2230 raise svntest.Failure
2231
2232 # Don't leave a corrupt repository
2233 svntest.main.safe_rmtree(sbox.repo_dir, True)
2234
2235
2236 @SkipUnless(svntest.main.is_fs_type_fsfs)
2237 def verify_keep_going_quiet(sbox):
2238 "svnadmin verify --keep-going --quiet test"
2239
2240 # No support for modifying pack files
2241 if svntest.main.options.fsfs_packing:
2242 raise svntest.Skip('fsfs packing set')
2243
2244 sbox.build(create_wc = False)
2245 repo_url = sbox.repo_url
2246 B_url = sbox.repo_url + '/B'
2247 C_url = sbox.repo_url + '/C'
2248
2249 # Create A/B/E/bravo in r2.
2250 svntest.actions.run_and_verify_svn(None, [],
2251 'mkdir', '-m', 'log_msg',
2252 B_url)
2253
2254 svntest.actions.run_and_verify_svn(None, [],
2255 'mkdir', '-m', 'log_msg',
2256 C_url)
2257
2258 r2 = fsfs_file(sbox.repo_dir, 'revs', '2')
2259 fp = open(r2, 'r+b')
2260 fp.write(b"inserting junk to corrupt the rev")
2261 fp.close()
2262
2263 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2264 "--keep-going",
2265 "--quiet",
2266 sbox.repo_dir)
2267
2268 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2269 "svnadmin: E160004:.*",
2270 "svnadmin: E160004:.*",
2271 ".*Error verifying revision 3.",
2272 "svnadmin: E160004:.*",
2273 "svnadmin: E160004:.*",
2274 "svnadmin: E205012:.*"], False)
2275
2276 # Insert another expected error from checksum verification
2277 if (svntest.main.is_fs_log_addressing()):
2278 exp_err.insert(0, ".*Error verifying repository metadata.")
2279 exp_err.insert(1, "svnadmin: E160004:.*")
2280
2281 if svntest.verify.verify_outputs(
2282 "Unexpected error while running 'svnadmin verify'.",
2283 output, errput, None, exp_err):
2284 raise svntest.Failure
2285
2286 # Don't leave a corrupt repository
2287 svntest.main.safe_rmtree(sbox.repo_dir, True)
2288
2289
2290 @SkipUnless(svntest.main.is_fs_type_fsfs)
2291 def verify_invalid_path_changes(sbox):
2292 "detect invalid changed path list entries"
2293
2294 # No support for modifying pack files
2295 if svntest.main.options.fsfs_packing:
2296 raise svntest.Skip('fsfs packing set')
2297
2298 sbox.build(create_wc = False)
2299 repo_url = sbox.repo_url
2300
2301 # Create a number of revisions each adding a single path
2302 for r in range(2,20):
2303 svntest.actions.run_and_verify_svn(None, [],
2304 'mkdir', '-m', 'log_msg',
2305 sbox.repo_url + '/B' + str(r))
2306
2307 # modify every other revision to make sure that errors are not simply
2308 # "carried over" but that all corrupts we get detected independently
2309
2310 # add existing node
2311 set_changed_path_list(sbox, 2,
2312 b"_0.0.t1-1 add-dir false false /A\n\n")
2313
2314 # add into non-existent parent
2315 set_changed_path_list(sbox, 4,
2316 b"_0.0.t3-2 add-dir false false /C/X\n\n")
2317
2318 # del non-existent node
2319 set_changed_path_list(sbox, 6,
2320 b"_0.0.t5-2 delete-dir false false /C\n\n")
2321
2322 # del existent node of the wrong kind
2323 #
2324 # THIS WILL NOT BE DETECTED
2325 # since dump mechanism and file don't care about the types of deleted nodes
2326 set_changed_path_list(sbox, 8,
2327 b"_0.0.t7-2 delete-file false false /B3\n\n")
2328
2329 # copy from non-existent node
2330 set_changed_path_list(sbox, 10,
2331 b"_0.0.t9-2 add-dir false false /B10\n6 /B8\n")
2332
2333 # copy from existing node of the wrong kind
2334 set_changed_path_list(sbox, 12,
2335 b"_0.0.t11-2 add-file false false /B12\n9 /B8\n")
2336
2337 # modify non-existent node
2338 set_changed_path_list(sbox, 14,
2339 b"_0.0.t13-2 modify-file false false /A/D/H/foo\n\n")
2340
2341 # modify existent node of the wrong kind
2342 set_changed_path_list(sbox, 16,
2343 b"_0.0.t15-2 modify-file false false /B12\n\n")
2344
2345 # replace non-existent node
2346 set_changed_path_list(sbox, 18,
2347 b"_0.0.t17-2 replace-file false false /A/D/H/foo\n\n")
2348
2349 # find corruptions
2350 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2351 "--keep-going",
2352 sbox.repo_dir)
2353
2354 # Errors generated by FSFS when CHANGED_PATHS is not forced into emulation
2355 exp_out1 = svntest.verify.RegexListOutput([".*Verified revision 0.",
2356 ".*Verified revision 1.",
2357 ".*Verified revision 3.",
2358 ".*Verified revision 5.",
2359 ".*Verified revision 7.",
2360 ".*Verified revision 8.",
2361 ".*Verified revision 9.",
2362 ".*Verified revision 11.",
2363 ".*Verified revision 13.",
2364 ".*Verified revision 15.",
2365 ".*Verified revision 17.",
2366 ".*Verified revision 19.",
2367 ".*",
2368 ".*Summary.*",
2369 ".*r2: E160020:.*",
2370 ".*r2: E160020:.*",
2371 ".*r4: E160013:.*",
2372 ".*r6: E160013:.*",
2373 ".*r6: E160013:.*",
2374 ".*r10: E160013:.*",
2375 ".*r10: E160013:.*",
2376 ".*r12: E145001:.*",
2377 ".*r12: E145001:.*",
2378 ".*r14: E160013:.*",
2379 ".*r14: E160013:.*",
2380 ".*r16: E145001:.*",
2381 ".*r16: E145001:.*",
2382 ".*r18: E160013:.*",
2383 ".*r18: E160013:.*"])
2384
2385 exp_err1 = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2386 "svnadmin: E160020:.*",
2387 "svnadmin: E160020:.*",
2388 ".*Error verifying revision 4.",
2389 "svnadmin: E160013:.*",
2390 ".*Error verifying revision 6.",
2391 "svnadmin: E160013:.*",
2392 "svnadmin: E160013:.*",
2393 ".*Error verifying revision 10.",
2394 "svnadmin: E160013:.*",
2395 "svnadmin: E160013:.*",
2396 ".*Error verifying revision 12.",
2397 "svnadmin: E145001:.*",
2398 "svnadmin: E145001:.*",
2399 ".*Error verifying revision 14.",
2400 "svnadmin: E160013:.*",
2401 "svnadmin: E160013:.*",
2402 ".*Error verifying revision 16.",
2403 "svnadmin: E145001:.*",
2404 "svnadmin: E145001:.*",
2405 ".*Error verifying revision 18.",
2406 "svnadmin: E160013:.*",
2407 "svnadmin: E160013:.*",
2408 "svnadmin: E205012:.*"], False)
2409
2410 # If CHANGED_PATHS is emulated, FSFS fails earlier, generating fewer
2411 # of the same messages per revision.
2412 exp_out2 = svntest.verify.RegexListOutput([".*Verified revision 0.",
2413 ".*Verified revision 1.",
2414 ".*Verified revision 3.",
2415 ".*Verified revision 5.",
2416 ".*Verified revision 7.",
2417 ".*Verified revision 8.",
2418 ".*Verified revision 9.",
2419 ".*Verified revision 11.",
2420 ".*Verified revision 13.",
2421 ".*Verified revision 15.",
2422 ".*Verified revision 17.",
2423 ".*Verified revision 19.",
2424 ".*",
2425 ".*Summary.*",
2426 ".*r2: E160020:.*",
2427 ".*r2: E160020:.*",
2428 ".*r4: E160013:.*",
2429 ".*r6: E160013:.*",
2430 ".*r10: E160013:.*",
2431 ".*r10: E160013:.*",
2432 ".*r12: E145001:.*",
2433 ".*r12: E145001:.*",
2434 ".*r14: E160013:.*",
2435 ".*r16: E145001:.*",
2436 ".*r16: E145001:.*",
2437 ".*r18: E160013:.*"])
2438
2439 exp_err2 = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2440 "svnadmin: E160020:.*",
2441 "svnadmin: E160020:.*",
2442 ".*Error verifying revision 4.",
2443 "svnadmin: E160013:.*",
2444 ".*Error verifying revision 6.",
2445 "svnadmin: E160013:.*",
2446 ".*Error verifying revision 10.",
2447 "svnadmin: E160013:.*",
2448 "svnadmin: E160013:.*",
2449 ".*Error verifying revision 12.",
2450 "svnadmin: E145001:.*",
2451 "svnadmin: E145001:.*",
2452 ".*Error verifying revision 14.",
2453 "svnadmin: E160013:.*",
2454 ".*Error verifying revision 16.",
2455 "svnadmin: E145001:.*",
2456 "svnadmin: E145001:.*",
2457 ".*Error verifying revision 18.",
2458 "svnadmin: E160013:.*",
2459 "svnadmin: E205012:.*"], False)
2460
2461 # Determine which pattern to use.
2462 # Note that index() will throw an exception if the string can't be found.
2463 try:
2464 rev6_line = errput.index('* Error verifying revision 6.\n');
2465 rev10_line = errput.index('* Error verifying revision 10.\n');
2466
2467 error_count = 0
2468 for line in errput[rev6_line+1:rev10_line]:
2469 if "svnadmin: E" in line:
2470 error_count = error_count + 1
2471
2472 if error_count == 1:
2473 exp_out = exp_out2
2474 exp_err = exp_err2
2475 else:
2476 exp_out = exp_out1
2477 exp_err = exp_err1
2478 except ValueError:
2479 exp_out = exp_out1
2480 exp_err = exp_err1
2481
2482 if (svntest.main.fs_has_rep_sharing()):
2483 exp_out.insert(0, ".*Verifying.*metadata.*")
2484 if svntest.main.options.fsfs_sharding is not None:
2485 for x in range(0, 19 / svntest.main.options.fsfs_sharding):
2486 exp_out.insert(0, ".*Verifying.*metadata.*")
2487 if svntest.main.is_fs_log_addressing():
2488 exp_out.insert(0, ".*Verifying.*metadata.*")
2489
2490 if svntest.verify.verify_outputs("Unexpected error while running 'svnadmin verify'.",
2491 output, errput, exp_out, exp_err):
2492 raise svntest.Failure
2493
2494 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2495 sbox.repo_dir)
2496
2497 exp_out = svntest.verify.RegexListOutput([".*Verified revision 0.",
2498 ".*Verified revision 1."])
2499 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2500 "svnadmin: E160020:.*",
2501 "svnadmin: E160020:.*"], False)
2502
2503 if (svntest.main.fs_has_rep_sharing()):
2504 exp_out.insert(0, ".*Verifying.*metadata.*")
2505 if svntest.main.options.fsfs_sharding is not None:
2506 for x in range(0, 19 / svntest.main.options.fsfs_sharding):
2507 exp_out.insert(0, ".*Verifying.*metadata.*")
2508 if svntest.main.is_fs_log_addressing():
2509 exp_out.insert(0, ".*Verifying.*metadata.*")
2510
2511 if svntest.verify.verify_outputs("Unexpected error while running 'svnadmin verify'.",
2512 output, errput, exp_out, exp_err):
2513 raise svntest.Failure
2514
2515
2516 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2517 "--quiet",
2518 sbox.repo_dir)
2519
2520 exp_out = []
2521 exp_err = svntest.verify.RegexListOutput([".*Error verifying revision 2.",
2522 "svnadmin: E160020:.*",
2523 "svnadmin: E160020:.*"], False)
2524
2525 if svntest.verify.verify_outputs("Output of 'svnadmin verify' is unexpected.",
2526 output, errput, exp_out, exp_err):
2527 raise svntest.Failure
2528
2529 # Don't leave a corrupt repository
2530 svntest.main.safe_rmtree(sbox.repo_dir, True)
2531
2532
2533 def verify_denormalized_names(sbox):
2534 "detect denormalized names and name collisions"
2535
2536 sbox.build(create_wc=False, empty=True)
2537
2538 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
2539 'svnadmin_tests_data',
2540 'normalization_check.dump')
2541 load_dumpstream(sbox, svntest.actions.load_dumpfile(dumpfile_location))
2542
2543 exit_code, output, errput = svntest.main.run_svnadmin(
2544 "verify", "--check-normalization", sbox.repo_dir)
2545
2546 expected_output_regex_list = [
2547 ".*Verified revision 0.",
2548 ".*Verified revision 1.",
2549 ".*Verified revision 2.",
2550 ".*Verified revision 3.",
2551 # A/{Eacute}/{aring}lpha
2552 "WARNING 0x0003: Duplicate representation of path 'A/.*/.*lpha'",
2553 ".*Verified revision 4.",
2554 ".*Verified revision 5.",
2555 # Q/{aring}lpha
2556 "WARNING 0x0004: Duplicate representation of path '/Q/.*lpha'"
2557 # A/{Eacute}
2558 " in svn:mergeinfo property of 'A/.*'",
2559 ".*Verified revision 6.",
2560 ".*Verified revision 7."]
2561
2562 # The BDB backend doesn't do global metadata verification.
2563 if (svntest.main.fs_has_rep_sharing() and not svntest.main.is_fs_type_bdb()):
2564 expected_output_regex_list.insert(0, ".*Verifying repository metadata.*")
2565
2566 if svntest.main.options.fsfs_sharding is not None:
2567 for x in range(0, 7 / svntest.main.options.fsfs_sharding):
2568 expected_output_regex_list.insert(0, ".*Verifying.*metadata.*")
2569
2570 if svntest.main.is_fs_log_addressing():
2571 expected_output_regex_list.insert(0, ".* Verifying metadata at revision 0.*")
2572
2573 exp_out = svntest.verify.RegexListOutput(expected_output_regex_list)
2574 exp_err = svntest.verify.ExpectedOutput([])
2575
2576 svntest.verify.verify_outputs(
2577 "Unexpected error while running 'svnadmin verify'.",
2578 output, errput, exp_out, exp_err)
2579
2580
2581 @SkipUnless(svntest.main.is_fs_type_fsfs)
2582 def fsfs_recover_old_non_empty(sbox):
2583 "fsfs recover non-empty --compatible-version=1.3"
2584
2585 # Around trunk@1560210, 'svnadmin recover' wrongly errored out
2586 # for the --compatible-version=1.3 Greek tree repository:
2587 # svnadmin: E200002: Serialized hash missing terminator
2588
2589 sbox.build(create_wc=False, minor_version=3)
2590 svntest.actions.run_and_verify_svnadmin(None, [], "recover",
2591 sbox.repo_dir)
2592
2593
2594 @SkipUnless(svntest.main.is_fs_type_fsfs)
2595 def fsfs_hotcopy_old_non_empty(sbox):
2596 "fsfs hotcopy non-empty --compatible-version=1.3"
2597
2598 # Around trunk@1560210, 'svnadmin hotcopy' wrongly errored out
2599 # for the --compatible-version=1.3 Greek tree repository:
2600 # svnadmin: E160006: No such revision 1
2601
2602 sbox.build(create_wc=False, minor_version=3)
2603 backup_dir, backup_url = sbox.add_repo_path('backup')
2604 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2605 sbox.repo_dir, backup_dir)
2606
2607 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2608
2609
2610 def load_ignore_dates(sbox):
2611 "svnadmin load --ignore-dates"
2612
2613 # All revisions in the loaded repository should come after this time.
2614 start_time = time.localtime()
2615 time.sleep(1)
2616
2617 sbox.build(create_wc=False, empty=True)
2618
2619 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
2620 'svnadmin_tests_data',
2621 'skeleton_repos.dump')
2622 dumpfile_skeleton = svntest.actions.load_dumpfile(dumpfile_location)
2623
2624 load_dumpstream(sbox, dumpfile_skeleton, '--ignore-dates')
2625 svntest.actions.run_and_verify_svnlook(['6\n'],
2626 None, 'youngest', sbox.repo_dir)
2627 for rev in range(1, 6):
2628 exit_code, output, errput = svntest.main.run_svnlook('date', '-r', rev,
2629 sbox.repo_dir)
2630 if errput:
2631 raise SVNUnexpectedStderr(errput)
2632 rev_time = time.strptime(output[0].rstrip()[:19], '%Y-%m-%d %H:%M:%S')
2633 if rev_time < start_time:
2634 raise svntest.Failure("Revision time for r%d older than load start time\n"
2635 " rev_time: %s\n"
2636 " start_time: %s"
2637 % (rev, str(rev_time), str(start_time)))
2638
2639
2640 @SkipUnless(svntest.main.is_fs_type_fsfs)
2641 def fsfs_hotcopy_old_with_id_changes(sbox):
2642 "fsfs hotcopy old with node-id and copy-id changes"
2643
2644 # Around trunk@1573728, running 'svnadmin hotcopy' for the
2645 # --compatible-version=1.3 repository with certain node-id and copy-id
2646 # changes ended with mismatching db/current in source and destination:
2647 #
2648 # source: "2 l 1" destination: "2 k 1",
2649 # "3 l 2" "3 4 2"
2650 # (and so on...)
2651 #
2652 # We test this case by creating a --compatible-version=1.3 repository
2653 # and committing things that result in node-id and copy-id changes.
2654 # After every commit, we hotcopy the repository to a new destination
2655 # and check whether the source of the backup and the backup itself are
2656 # identical. We also maintain a separate --incremental backup, which
2657 # is updated and checked after every commit.
2658 sbox.build(create_wc=True, minor_version=3)
2659
2660 inc_backup_dir, inc_backup_url = sbox.add_repo_path('incremental-backup')
2661
2662 # r1 = Initial greek tree sandbox.
2663 backup_dir, backup_url = sbox.add_repo_path('backup-after-r1')
2664 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2665 sbox.repo_dir, backup_dir)
2666 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2667 "--incremental",
2668 sbox.repo_dir, inc_backup_dir)
2669 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2670 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2671
2672 # r2 = Add a new property.
2673 sbox.simple_propset('foo', 'bar', 'A/mu')
2674 sbox.simple_commit(message='r2')
2675
2676 backup_dir, backup_url = sbox.add_repo_path('backup-after-r2')
2677 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2678 sbox.repo_dir, backup_dir)
2679 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2680 "--incremental",
2681 sbox.repo_dir, inc_backup_dir)
2682 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2683 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2684
2685 # r3 = Copy a file.
2686 sbox.simple_copy('A/B/E', 'A/B/E1')
2687 sbox.simple_commit(message='r3')
2688
2689 backup_dir, backup_url = sbox.add_repo_path('backup-after-r3')
2690 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2691 sbox.repo_dir, backup_dir)
2692 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2693 "--incremental",
2694 sbox.repo_dir, inc_backup_dir)
2695 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2696 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2697
2698 # r4 = Remove an existing file ...
2699 sbox.simple_rm('A/D/gamma')
2700 sbox.simple_commit(message='r4')
2701
2702 backup_dir, backup_url = sbox.add_repo_path('backup-after-r4')
2703 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2704 sbox.repo_dir, backup_dir)
2705 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2706 "--incremental",
2707 sbox.repo_dir, inc_backup_dir)
2708 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2709 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2710
2711 # r5 = ...and replace it with a new file here.
2712 sbox.simple_add_text("This is the replaced file.\n", 'A/D/gamma')
2713 sbox.simple_commit(message='r5')
2714
2715 backup_dir, backup_url = sbox.add_repo_path('backup-after-r5')
2716 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2717 sbox.repo_dir, backup_dir)
2718 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2719 "--incremental",
2720 sbox.repo_dir, inc_backup_dir)
2721 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2722 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2723
2724 # r6 = Add an entirely new file.
2725 sbox.simple_add_text('This is an entirely new file.\n', 'A/C/mu1')
2726 sbox.simple_commit(message='r6')
2727
2728 backup_dir, backup_url = sbox.add_repo_path('backup-after-r6')
2729 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2730 sbox.repo_dir, backup_dir)
2731 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2732 "--incremental",
2733 sbox.repo_dir, inc_backup_dir)
2734 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2735 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2736
2737 # r7 = Change the content of the existing file (this changeset does
2738 # not bump the next-id and copy-id counters in the repository).
2739 sbox.simple_append('A/mu', 'This is change in the existing file.\n')
2740 sbox.simple_commit(message='r7')
2741
2742 backup_dir, backup_url = sbox.add_repo_path('backup-after-r7')
2743 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2744 sbox.repo_dir, backup_dir)
2745 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2746 "--incremental",
2747 sbox.repo_dir, inc_backup_dir)
2748 check_hotcopy_fsfs(sbox.repo_dir, backup_dir)
2749 check_hotcopy_fsfs(sbox.repo_dir, inc_backup_dir)
2750
2751
2752 @SkipUnless(svntest.main.fs_has_pack)
2753 def verify_packed(sbox):
2754 "verify packed with small shards"
2755
2756 # Configure two files per shard to trigger packing.
2757 sbox.build()
2758 patch_format(sbox.repo_dir, shard_size=2)
2759
2760 # Play with our greek tree. These changesets fall into two
2761 # separate shards with r2 and r3 being in shard 1 ...
2762 sbox.simple_append('iota', "Line.\n")
2763 sbox.simple_append('A/D/gamma', "Another line.\n")
2764 sbox.simple_commit(message='r2')
2765 sbox.simple_propset('foo', 'bar', 'iota')
2766 sbox.simple_propset('foo', 'baz', 'A/mu')
2767 sbox.simple_commit(message='r3')
2768
2769 # ...and r4 and r5 being in shard 2.
2770 sbox.simple_rm('A/C')
2771 sbox.simple_copy('A/B/E', 'A/B/E1')
2772 sbox.simple_move('A/mu', 'A/B/mu')
2773 sbox.simple_commit(message='r4')
2774 sbox.simple_propdel('foo', 'A/B/mu')
2775 sbox.simple_commit(message='r5')
2776
2777 if svntest.main.is_fs_type_fsfs and svntest.main.options.fsfs_packing:
2778 # With --fsfs-packing, everything is already packed and we
2779 # can skip this part.
2780 pass
2781 else:
2782 expected_output = ["Packing revisions in shard 0...done.\n",
2783 "Packing revisions in shard 1...done.\n",
2784 "Packing revisions in shard 2...done.\n"]
2785 svntest.actions.run_and_verify_svnadmin(expected_output, [],
2786 "pack", sbox.repo_dir)
2787
2788 if svntest.main.is_fs_log_addressing():
2789 expected_output = ["* Verifying metadata at revision 0 ...\n",
2790 "* Verifying metadata at revision 2 ...\n",
2791 "* Verifying metadata at revision 4 ...\n",
2792 "* Verifying repository metadata ...\n",
2793 "* Verified revision 0.\n",
2794 "* Verified revision 1.\n",
2795 "* Verified revision 2.\n",
2796 "* Verified revision 3.\n",
2797 "* Verified revision 4.\n",
2798 "* Verified revision 5.\n"]
2799 else:
2800 expected_output = ["* Verifying repository metadata ...\n",
2801 "* Verified revision 0.\n",
2802 "* Verified revision 1.\n",
2803 "* Verified revision 2.\n",
2804 "* Verified revision 3.\n",
2805 "* Verified revision 4.\n",
2806 "* Verified revision 5.\n"]
2807
2808 svntest.actions.run_and_verify_svnadmin(expected_output, [],
2809 "verify", sbox.repo_dir)
2810
2811 # Test that 'svnadmin freeze' is nestable. (For example, this ensures it
2812 # won't take system-global locks, only repository-scoped ones.)
2813 #
2814 # This could be useful to easily freeze a small number of repositories at once.
2815 #
2816 # ### We don't actually test that freeze takes a write lock anywhere (not even
2817 # ### in C tests.)
2818 def freeze_freeze(sbox):
2819 "svnadmin freeze svnadmin freeze (some-cmd)"
2820
2821 sbox.build(create_wc=False, read_only=True)
2822 second_repo_dir, _ = sbox.add_repo_path('backup')
2823 svntest.actions.run_and_verify_svnadmin(None, [], "hotcopy",
2824 sbox.repo_dir, second_repo_dir)
2825
2826 if svntest.main.is_fs_type_fsx() or \
2827 (svntest.main.is_fs_type_fsfs() and \
2828 svntest.main.options.server_minor_version < 9):
2829 # FSFS repositories created with --compatible-version=1.8 and less
2830 # erroneously share the filesystem data (locks, shared transaction
2831 # data, ...) between hotcopy source and destination. This is fixed
2832 # for new FS formats, but in order to avoid a deadlock for old formats,
2833 # we have to manually assign a new UUID for the hotcopy destination.
2834 # As of trunk@1618024, the same applies to FSX repositories.
2835 svntest.actions.run_and_verify_svnadmin([], None,
2836 'setuuid', second_repo_dir)
2837
2838 svntest.actions.run_and_verify_svnadmin(None, [],
2839 'freeze', '--', sbox.repo_dir,
2840 svntest.main.svnadmin_binary, 'freeze', '--', second_repo_dir,
2841 sys.executable, '-c', 'True')
2842
2843 arg_file = sbox.get_tempname()
2844 svntest.main.file_write(arg_file,
2845 "%s\n%s\n" % (sbox.repo_dir, second_repo_dir))
2846
2847 svntest.actions.run_and_verify_svnadmin(None, [],
2848 'freeze', '-F', arg_file, '--',
2849 sys.executable, '-c', 'True')
2850
2851 def verify_metadata_only(sbox):
2852 "verify metadata only"
2853
2854 sbox.build(create_wc = False)
2855 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2856 sbox.repo_dir,
2857 "--metadata-only")
2858 if errput:
2859 raise SVNUnexpectedStderr(errput)
2860
2861 # Unfortunately, older formats won't test as thoroughly than newer ones
2862 # resulting in different progress output. BDB will do a full check but
2863 # not produce any output.
2864 if svntest.main.is_fs_log_addressing():
2865 svntest.verify.compare_and_display_lines(
2866 "Unexpected error while running 'svnadmin verify'.",
2867 'STDOUT', ["* Verifying metadata at revision 0 ...\n",
2868 "* Verifying repository metadata ...\n"], output)
2869 elif svntest.main.fs_has_rep_sharing() \
2870 and not svntest.main.is_fs_type_bdb():
2871 svntest.verify.compare_and_display_lines(
2872 "Unexpected error while running 'svnadmin verify'.",
2873 'STDOUT', ["* Verifying repository metadata ...\n"], output)
2874 else:
2875 svntest.verify.compare_and_display_lines(
2876 "Unexpected error while running 'svnadmin verify'.",
2877 'STDOUT', [], output)
2878
2879
2880 @Skip(svntest.main.is_fs_type_bdb)
2881 def verify_quickly(sbox):
2882 "verify quickly using metadata"
2883
2884 sbox.build(create_wc = False)
2885 rev_file = open(fsfs_file(sbox.repo_dir, 'revs', '1'), 'r+b')
2886
2887 # set new contents
2888 rev_file.seek(8)
2889 rev_file.write(b'#')
2890 rev_file.close()
2891
2892 exit_code, output, errput = svntest.main.run_svnadmin("verify",
2893 sbox.repo_dir,
2894 "--metadata-only")
2895
2896 # unfortunately, some backends needs to do more checks than other
2897 # resulting in different progress output
2898 if svntest.main.is_fs_log_addressing():
2899 exp_out = svntest.verify.RegexListOutput([])
2900 exp_err = svntest.verify.RegexListOutput(["svnadmin: E160004:.*"], False)
2901 else:
2902 exp_out = svntest.verify.RegexListOutput([])
2903 exp_err = svntest.verify.RegexListOutput([])
2904
2905 if (svntest.main.fs_has_rep_sharing()):
2906 exp_out.insert(0, ".*Verifying.*metadata.*")
2907 if svntest.verify.verify_outputs("Unexpected error while running 'svnadmin verify'.",
2908 output, errput, exp_out, exp_err):
2909 raise svntest.Failure
2910
2911 # Don't leave a corrupt repository
2912 svntest.main.safe_rmtree(sbox.repo_dir, True)
2913
2914
2915 @SkipUnless(svntest.main.is_fs_type_fsfs)
2916 @SkipUnless(svntest.main.fs_has_pack)
2917 def fsfs_hotcopy_progress(sbox):
2918 "hotcopy progress reporting"
2919
2920 # Check how 'svnadmin hotcopy' reports progress for non-incremental
2921 # and incremental scenarios. The progress output can be affected by
2922 # the --fsfs-packing option, so skip the test if that is the case.
2923 if svntest.main.options.fsfs_packing:
2924 raise svntest.Skip('fsfs packing set')
2925
2926 # Create an empty repository, configure three files per shard.
2927 sbox.build(create_wc=False, empty=True)
2928 patch_format(sbox.repo_dir, shard_size=3)
2929
2930 inc_backup_dir, inc_backup_url = sbox.add_repo_path('incremental-backup')
2931
2932 # Nothing really exciting for the empty repository.
2933 expected_full = [
2934 "* Copied revision 0.\n"
2935 ]
2936 expected_incremental = [
2937 "* Copied revision 0.\n",
2938 ]
2939
2940 backup_dir, backup_url = sbox.add_repo_path('backup-0')
2941 svntest.actions.run_and_verify_svnadmin(expected_full, [],
2942 'hotcopy',
2943 sbox.repo_dir, backup_dir)
2944 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
2945 'hotcopy', '--incremental',
2946 sbox.repo_dir, inc_backup_dir)
2947
2948 # Commit three revisions. After this step we have a full shard
2949 # (r0, r1, r2) and the second shard (r3) with a single revision.
2950 for i in range(3):
2951 svntest.actions.run_and_verify_svn(None, [], 'mkdir',
2952 '-m', svntest.main.make_log_msg(),
2953 sbox.repo_url + '/dir-%i' % i)
2954 expected_full = [
2955 "* Copied revision 0.\n",
2956 "* Copied revision 1.\n",
2957 "* Copied revision 2.\n",
2958 "* Copied revision 3.\n",
2959 ]
2960 expected_incremental = [
2961 "* Copied revision 1.\n",
2962 "* Copied revision 2.\n",
2963 "* Copied revision 3.\n",
2964 ]
2965
2966 backup_dir, backup_url = sbox.add_repo_path('backup-1')
2967 svntest.actions.run_and_verify_svnadmin(expected_full, [],
2968 'hotcopy',
2969 sbox.repo_dir, backup_dir)
2970 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
2971 'hotcopy', '--incremental',
2972 sbox.repo_dir, inc_backup_dir)
2973
2974 # Pack everything (r3 is still unpacked) and hotcopy again. In this case,
2975 # the --incremental output should track the incoming (r0, r1, r2) pack and
2976 # should not mention r3, because it is already a part of the destination
2977 # and is *not* a part of the incoming pack.
2978 svntest.actions.run_and_verify_svnadmin(None, [], 'pack',
2979 sbox.repo_dir)
2980 expected_full = [
2981 "* Copied revisions from 0 to 2.\n",
2982 "* Copied revision 3.\n",
2983 ]
2984 expected_incremental = [
2985 "* Copied revisions from 0 to 2.\n",
2986 ]
2987
2988 backup_dir, backup_url = sbox.add_repo_path('backup-2')
2989 svntest.actions.run_and_verify_svnadmin(expected_full, [],
2990 'hotcopy',
2991 sbox.repo_dir, backup_dir)
2992 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
2993 'hotcopy', '--incremental',
2994 sbox.repo_dir, inc_backup_dir)
2995
2996 # Fill the second shard, pack again, commit several unpacked revisions
2997 # on top of it. Rerun the hotcopy and check the progress output.
2998 for i in range(4, 6):
2999 svntest.actions.run_and_verify_svn(None, [], 'mkdir',
3000 '-m', svntest.main.make_log_msg(),
3001 sbox.repo_url + '/dir-%i' % i)
3002
3003 svntest.actions.run_and_verify_svnadmin(None, [], 'pack',
3004 sbox.repo_dir)
3005
3006 for i in range(6, 8):
3007 svntest.actions.run_and_verify_svn(None, [], 'mkdir',
3008 '-m', svntest.main.make_log_msg(),
3009 sbox.repo_url + '/dir-%i' % i)
3010 expected_full = [
3011 "* Copied revisions from 0 to 2.\n",
3012 "* Copied revisions from 3 to 5.\n",
3013 "* Copied revision 6.\n",
3014 "* Copied revision 7.\n",
3015 ]
3016 expected_incremental = [
3017 "* Copied revisions from 3 to 5.\n",
3018 "* Copied revision 6.\n",
3019 "* Copied revision 7.\n",
3020 ]
3021
3022 backup_dir, backup_url = sbox.add_repo_path('backup-3')
3023 svntest.actions.run_and_verify_svnadmin(expected_full, [],
3024 'hotcopy',
3025 sbox.repo_dir, backup_dir)
3026 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
3027 'hotcopy', '--incremental',
3028 sbox.repo_dir, inc_backup_dir)
3029
3030
3031 @SkipUnless(svntest.main.is_fs_type_fsfs)
3032 def fsfs_hotcopy_progress_with_revprop_changes(sbox):
3033 "incremental hotcopy progress with changed revprops"
3034
3035 # The progress output can be affected by the --fsfs-packing
3036 # option, so skip the test if that is the case.
3037 if svntest.main.options.fsfs_packing:
3038 raise svntest.Skip('fsfs packing set')
3039
3040 # Create an empty repository, commit several revisions and hotcopy it.
3041 sbox.build(create_wc=False, empty=True)
3042
3043 for i in range(6):
3044 svntest.actions.run_and_verify_svn(None, [], 'mkdir',
3045 '-m', svntest.main.make_log_msg(),
3046 sbox.repo_url + '/dir-%i' % i)
3047 expected_output = [
3048 "* Copied revision 0.\n",
3049 "* Copied revision 1.\n",
3050 "* Copied revision 2.\n",
3051 "* Copied revision 3.\n",
3052 "* Copied revision 4.\n",
3053 "* Copied revision 5.\n",
3054 "* Copied revision 6.\n",
3055 ]
3056
3057 backup_dir, backup_url = sbox.add_repo_path('backup')
3058 svntest.actions.run_and_verify_svnadmin(expected_output, [],
3059 'hotcopy',
3060 sbox.repo_dir, backup_dir)
3061
3062 # Amend a few log messages in the source, run the --incremental hotcopy.
3063 # The progress output should only mention the corresponding revisions.
3064 revprop_file = sbox.get_tempname()
3065 svntest.main.file_write(revprop_file, "Modified log message.")
3066
3067 for i in [1, 3, 6]:
3068 svntest.actions.run_and_verify_svnadmin(None, [],
3069 'setrevprop',
3070 sbox.repo_dir, '-r', i,
3071 'svn:log', revprop_file)
3072 expected_output = [
3073 "* Copied revision 1.\n",
3074 "* Copied revision 3.\n",
3075 "* Copied revision 6.\n",
3076 ]
3077 svntest.actions.run_and_verify_svnadmin(expected_output, [],
3078 'hotcopy', '--incremental',
3079 sbox.repo_dir, backup_dir)
3080
3081
3082 @SkipUnless(svntest.main.is_fs_type_fsfs)
3083 def fsfs_hotcopy_progress_old(sbox):
3084 "hotcopy --compatible-version=1.3 progress"
3085
3086 sbox.build(create_wc=False, empty=True, minor_version=3)
3087
3088 inc_backup_dir, inc_backup_url = sbox.add_repo_path('incremental-backup')
3089
3090 # Nothing really exciting for the empty repository.
3091 expected_full = [
3092 "* Copied revision 0.\n"
3093 ]
3094 expected_incremental = [
3095 "* Copied revision 0.\n",
3096 ]
3097
3098 backup_dir, backup_url = sbox.add_repo_path('backup-0')
3099 svntest.actions.run_and_verify_svnadmin(expected_full, [],
3100 'hotcopy',
3101 sbox.repo_dir, backup_dir)
3102 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
3103 'hotcopy', '--incremental',
3104 sbox.repo_dir, inc_backup_dir)
3105
3106 # Commit three revisions, hotcopy and check the progress output.
3107 for i in range(3):
3108 svntest.actions.run_and_verify_svn(None, [], 'mkdir',
3109 '-m', svntest.main.make_log_msg(),
3110 sbox.repo_url + '/dir-%i' % i)
3111
3112 expected_full = [
3113 "* Copied revision 0.\n",
3114 "* Copied revision 1.\n",
3115 "* Copied revision 2.\n",
3116 "* Copied revision 3.\n",
3117 ]
3118 expected_incremental = [
3119 "* Copied revision 1.\n",
3120 "* Copied revision 2.\n",
3121 "* Copied revision 3.\n",
3122 ]
3123
3124 backup_dir, backup_url = sbox.add_repo_path('backup-1')
3125 svntest.actions.run_and_verify_svnadmin(expected_full, [],
3126 'hotcopy',
3127 sbox.repo_dir, backup_dir)
3128 svntest.actions.run_and_verify_svnadmin(expected_incremental, [],
3129 'hotcopy', '--incremental',
3130 sbox.repo_dir, inc_backup_dir)
3131
3132
3133 @SkipUnless(svntest.main.fs_has_unique_freeze)
3134 def freeze_same_uuid(sbox):
3135 "freeze multiple repositories with same UUID"
3136
3137 sbox.build(create_wc=False)
3138
3139 first_repo_dir, _ = sbox.add_repo_path('first')
3140 second_repo_dir, _ = sbox.add_repo_path('second')
3141
3142 # Test that 'svnadmin freeze A (svnadmin freeze B)' does not deadlock for
3143 # new FSFS formats, even if 'A' and 'B' share the same UUID. Create two
3144 # repositories by loading the same dump file, ...
3145 svntest.main.create_repos(first_repo_dir)
3146 svntest.main.create_repos(second_repo_dir)
3147
3148 dump_path = os.path.join(os.path.dirname(sys.argv[0]),
3149 'svnadmin_tests_data',
3150 'skeleton_repos.dump')
3151 dump_contents = open(dump_path, 'rb').readlines()
3152 svntest.actions.run_and_verify_load(first_repo_dir, dump_contents)
3153 svntest.actions.run_and_verify_load(second_repo_dir, dump_contents)
3154
3155 # ...and execute the 'svnadmin freeze -F' command.
3156 arg_file = sbox.get_tempname()
3157 svntest.main.file_write(arg_file,
3158 "%s\n%s\n" % (first_repo_dir, second_repo_dir))
3159
3160 svntest.actions.run_and_verify_svnadmin(None, None,
3161 'freeze', '-F', arg_file, '--',
3162 sys.executable, '-c', 'True')
3163
3164
3165 @Skip(svntest.main.is_fs_type_fsx)
3166 def upgrade(sbox):
3167 "upgrade --compatible-version=1.3"
3168
3169 sbox.build(create_wc=False, minor_version=3)
3170 svntest.actions.run_and_verify_svnadmin(None, [], "upgrade",
3171 sbox.repo_dir)
3172 # Does the repository work after upgrade?
3173 svntest.actions.run_and_verify_svn(['Committing transaction...\n',
3174 'Committed revision 2.\n'], [], 'mkdir',
3175 '-m', svntest.main.make_log_msg(),
3176 sbox.repo_url + '/dir')
3177
3178 def load_txdelta(sbox):
3179 "exercising svn_txdelta_target on BDB"
3180
3181 sbox.build(empty=True)
3182
3183 # This dumpfile produced a BDB repository that generated cheksum
3184 # mismatches on read caused by the improper handling of
3185 # svn_txdelta_target ops. The bug was fixed by r1640832.
3186
3187 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
3188 'svnadmin_tests_data',
3189 'load_txdelta.dump.gz')
3190 dumpfile = gzip.open(dumpfile_location, "rb").readlines()
3191
3192 load_dumpstream(sbox, dumpfile)
3193
3194 # Verify would fail with a checksum mismatch:
3195 # * Error verifying revision 14.
3196 # svnadmin: E200014: MD5 checksum mismatch on representation 'r':
3197 # expected: 5182e8876ed894dc7fe28f6ff5b2fee6
3198 # actual: 5121f82875508863ad70daa8244e6947
3199
3200 exit_code, output, errput = svntest.main.run_svnadmin("verify", sbox.repo_dir)
3201 if errput:
3202 raise SVNUnexpectedStderr(errput)
3203 if svntest.verify.verify_outputs(
3204 "Output of 'svnadmin verify' is unexpected.", None, output, None,
3205 ".*Verified revision *"):
3206 raise svntest.Failure
3207
3208 @Issues(4563)
3209 def load_no_svndate_r0(sbox):
3210 "load without svn:date on r0"
3211
3212 sbox.build(create_wc=False, empty=True)
3213
3214 # svn:date exits
3215 svntest.actions.run_and_verify_svnlook([' svn:date\n'], [],
3216 'proplist', '--revprop', '-r0',
3217 sbox.repo_dir)
3218
3219 dump_old = [b"SVN-fs-dump-format-version: 2\n", b"\n",
3220 b"UUID: bf52886d-358d-4493-a414-944a6e5ad4f5\n", b"\n",
3221 b"Revision-number: 0\n",
3222 b"Prop-content-length: 10\n",
3223 b"Content-length: 10\n", b"\n",
3224 b"PROPS-END\n", b"\n"]
3225 svntest.actions.run_and_verify_load(sbox.repo_dir, dump_old)
3226
3227 # svn:date should have been removed
3228 svntest.actions.run_and_verify_svnlook([], [],
3229 'proplist', '--revprop', '-r0',
3230 sbox.repo_dir)
3231
3232 # This is only supported for FSFS
3233 # The port to FSX is still pending, BDB won't support it.
3234 @SkipUnless(svntest.main.is_fs_type_fsfs)
3235 def hotcopy_read_only(sbox):
3236 "'svnadmin hotcopy' a read-only source repository"
3237 sbox.build()
3238 svntest.main.chmod_tree(sbox.repo_dir, 0, svntest.main.S_ALL_WRITE)
3239
3240 backup_dir, backup_url = sbox.add_repo_path('backup')
3241 exit_code, output, errput = svntest.main.run_svnadmin("hotcopy",
3242 sbox.repo_dir,
3243 backup_dir)
3244
3245 # r/o repos are hard to clean up. Make it writable again.
3246 svntest.main.chmod_tree(sbox.repo_dir, svntest.main.S_ALL_WRITE,
3247 svntest.main.S_ALL_WRITE)
3248 if errput:
3249 logger.warn("Error: hotcopy failed")
3250 raise SVNUnexpectedStderr(errput)
3251
3252 @SkipUnless(svntest.main.is_fs_type_fsfs)
3253 @SkipUnless(svntest.main.fs_has_pack)
3254 def fsfs_pack_non_sharded(sbox):
3255 "'svnadmin pack' on a non-sharded repository"
3256
3257 # Configure two files per shard to trigger packing.
3258 sbox.build(create_wc = False,
3259 minor_version = min(svntest.main.options.server_minor_version,3))
3260
3261 # Skip for pre-cooked sharded repositories
3262 if is_sharded(sbox.repo_dir):
3263 raise svntest.Skip('sharded pre-cooked repository')
3264
3265 svntest.actions.run_and_verify_svnadmin(
3266 None, [], "upgrade", sbox.repo_dir)
3267 svntest.actions.run_and_verify_svnadmin(
3268 ['svnadmin: Warning - this repository is not sharded. Packing has no effect.\n'],
3269 [], "pack", sbox.repo_dir)
3270
3271 def load_revprops(sbox):
3272 "svnadmin load-revprops"
3273
3274 sbox.build(create_wc=False, empty=True)
3275
3276 dump_path = os.path.join(os.path.dirname(sys.argv[0]),
3277 'svnadmin_tests_data',
3278 'skeleton_repos.dump')
3279 dump_contents = open(dump_path, 'rb').readlines()
3280 load_and_verify_dumpstream(sbox, None, [], None, False, dump_contents)
3281
3282 svntest.actions.run_and_verify_svnlook(['Initial setup...\n', '\n'],
3283 [], 'log', '-r1', sbox.repo_dir)
3284
3285 # After loading the dump, amend one of the log message in the repository.
3286 input_file = sbox.get_tempname()
3287 svntest.main.file_write(input_file, 'Modified log message...\n')
3288
3289 svntest.actions.run_and_verify_svnadmin([], [], 'setlog', '--bypass-hooks',
3290 '-r1', sbox.repo_dir, input_file)
3291 svntest.actions.run_and_verify_svnlook(['Modified log message...\n', '\n'],
3292 [], 'log', '-r1', sbox.repo_dir)
3293
3294 # Load the same dump, but with 'svnadmin load-revprops'. Doing so should
3295 # restore the log message to its original state.
3296 svntest.main.run_command_stdin(svntest.main.svnadmin_binary, None, 0,
3297 True, dump_contents, 'load-revprops',
3298 sbox.repo_dir)
3299
3300 svntest.actions.run_and_verify_svnlook(['Initial setup...\n', '\n'],
3301 [], 'log', '-r1', sbox.repo_dir)
3302
3303 def dump_revprops(sbox):
3304 "svnadmin dump-revprops"
3305
3306 sbox.build(create_wc=False)
3307
3308 # Dump revprops only.
3309 exit_code, dump_contents, errput = \
3310 svntest.actions.run_and_verify_svnadmin(None, [], "dump-revprops", "-q",
3311 sbox.repo_dir)
3312
3313 # We expect the dump to contain no path changes
3314 for line in dump_contents:
3315 if line.find(b"Node-path: ") > -1:
3316 logger.warn("Error: path change found in revprops-only dump.")
3317 raise svntest.Failure
3318
3319 # Remember the current log message for r1
3320 exit_code, log_msg, errput = \
3321 svntest.actions.run_and_verify_svnlook(None, [], 'log', '-r1',
3322 sbox.repo_dir)
3323
3324 # Now, change the log message in the repository.
3325 input_file = sbox.get_tempname()
3326 svntest.main.file_write(input_file, 'Modified log message...\n')
3327
3328 svntest.actions.run_and_verify_svnadmin([], [], 'setlog', '--bypass-hooks',
3329 '-r1', sbox.repo_dir, input_file)
3330 svntest.actions.run_and_verify_svnlook(['Modified log message...\n', '\n'],
3331 [], 'log', '-r1', sbox.repo_dir)
3332
3333 # Load the same dump with 'svnadmin load-revprops'. Doing so should
3334 # restore the log message to its original state.
3335 svntest.main.run_command_stdin(svntest.main.svnadmin_binary, None, 0,
3336 True, dump_contents, 'load-revprops',
3337 sbox.repo_dir)
3338
3339 svntest.actions.run_and_verify_svnlook(log_msg, [], 'log', '-r1',
3340 sbox.repo_dir)
3341
3342 @XFail(svntest.main.is_fs_type_fsx)
3343 @Issue(4598)
3344 def dump_no_op_change(sbox):
3345 "svnadmin dump with no-op changes"
3346
3347 sbox.build(create_wc=False, empty=True)
3348 empty_file = sbox.get_tempname()
3349 svntest.main.file_write(empty_file, '')
3350
3351 svntest.actions.run_and_verify_svnmucc(None, [],
3352 '-U', sbox.repo_url,
3353 '-m', svntest.main.make_log_msg(),
3354 'put', empty_file, 'bar')
3355 # Commit a no-op change.
3356 svntest.actions.run_and_verify_svnmucc(None, [],
3357 '-U', sbox.repo_url,
3358 '-m', svntest.main.make_log_msg(),
3359 'put', empty_file, 'bar')
3360 # Dump and load the repository.
3361 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3362 'dump', '-q',
3363 sbox.repo_dir)
3364 sbox2 = sbox.clone_dependent()
3365 sbox2.build(create_wc=False, empty=True)
3366 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3367
3368 # We expect svn log -v to yield identical results for both original and
3369 # reconstructed repositories. This used to fail as described in the
3370 # Issue 4598 (https://issues.apache.org/jira/browse/SVN-4598), at least
3371 # around r1706415.
3372 #
3373 # Test svn log -v for r2:
3374 _, expected, _ = svntest.actions.run_and_verify_svn(None, [], 'log', '-v',
3375 '-r2', sbox.repo_url)
3376 found = [True for line in expected if line.find('M /bar\n') != -1]
3377 if not found:
3378 raise svntest.Failure
3379 svntest.actions.run_and_verify_svn(expected, [], 'log', '-v',
3380 '-r2', sbox2.repo_url)
3381 # Test svn log -v for /bar:
3382 _, expected, _ = svntest.actions.run_and_verify_svn(None, [], 'log', '-v',
3383 sbox.repo_url + '/bar')
3384 found = [True for line in expected if line.find('M /bar\n') != -1]
3385 if not found:
3386 raise svntest.Failure
3387 svntest.actions.run_and_verify_svn(expected, [], 'log', '-v',
3388 sbox2.repo_url + '/bar')
3389
3390 @XFail(svntest.main.is_fs_type_bdb)
3391 @XFail(svntest.main.is_fs_type_fsx)
3392 @Issue(4623)
3393 def dump_no_op_prop_change(sbox):
3394 "svnadmin dump with no-op property change"
3395
3396 sbox.build(create_wc=False, empty=True)
3397 empty_file = sbox.get_tempname()
3398 svntest.main.file_write(empty_file, '')
3399
3400 svntest.actions.run_and_verify_svnmucc(None, [],
3401 '-U', sbox.repo_url,
3402 '-m', svntest.main.make_log_msg(),
3403 'put', empty_file, 'bar',
3404 'propset', 'pname', 'pval', 'bar')
3405 # Commit a no-op property change.
3406 svntest.actions.run_and_verify_svnmucc(None, [],
3407 '-U', sbox.repo_url,
3408 '-m', svntest.main.make_log_msg(),
3409 'propset', 'pname', 'pval', 'bar')
3410 # Dump and load the repository.
3411 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3412 'dump', '-q',
3413 sbox.repo_dir)
3414 sbox2 = sbox.clone_dependent()
3415 sbox2.build(create_wc=False, empty=True)
3416 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3417
3418 # Test svn log -v for r2:
3419 _, expected, _ = svntest.actions.run_and_verify_svn(None, [], 'log', '-v',
3420 '-r2', sbox.repo_url)
3421 found = [True for line in expected if line.find('M /bar\n') != -1]
3422 if not found:
3423 raise svntest.Failure
3424 svntest.actions.run_and_verify_svn(expected, [], 'log', '-v',
3425 '-r2', sbox2.repo_url)
3426 # Test svn log -v for /bar:
3427 _, expected, _ = svntest.actions.run_and_verify_svn(None, [], 'log', '-v',
3428 sbox.repo_url + '/bar')
3429 found = [True for line in expected if line.find('M /bar\n') != -1]
3430 if not found:
3431 raise svntest.Failure
3432 svntest.actions.run_and_verify_svn(expected, [], 'log', '-v',
3433 sbox2.repo_url + '/bar')
3434
3435 def load_no_flush_to_disk(sbox):
3436 "svnadmin load --no-flush-to-disk"
3437
3438 sbox.build(empty=True)
3439
3440 # Can't test the "not flushing to disk part", but loading the
3441 # dump should work.
3442 dump = clean_dumpfile()
3443 expected = [
3444 svntest.wc.State('', {
3445 'A' : svntest.wc.StateItem(contents="text\n",
3446 props={'svn:keywords': 'Id'})
3447 })
3448 ]
3449 load_and_verify_dumpstream(sbox, [], [], expected, True, dump,
3450 '--no-flush-to-disk', '--ignore-uuid')
3451
3452 def dump_to_file(sbox):
3453 "svnadmin dump --file ARG"
3454
3455 sbox.build(create_wc=False, empty=False)
3456 expected_dump = svntest.actions.run_and_verify_dump(sbox.repo_dir)
3457
3458 file = sbox.get_tempname()
3459 svntest.actions.run_and_verify_svnadmin2([],
3460 ["* Dumped revision 0.\n",
3461 "* Dumped revision 1.\n"],
3462 0, 'dump', '--file', file,
3463 sbox.repo_dir)
3464 actual_dump = open(file, 'rb').readlines()
3465 svntest.verify.compare_dump_files(None, None, expected_dump, actual_dump)
3466
3467 # Test that svnadmin dump --file overwrites existing files.
3468 file = sbox.get_tempname()
3469 svntest.main.file_write(file, '')
3470 svntest.actions.run_and_verify_svnadmin2([],
3471 ["* Dumped revision 0.\n",
3472 "* Dumped revision 1.\n"],
3473 0, 'dump', '--file', file,
3474 sbox.repo_dir)
3475 actual_dump = open(file, 'rb').readlines()
3476 svntest.verify.compare_dump_files(None, None, expected_dump, actual_dump)
3477
3478 def load_from_file(sbox):
3479 "svnadmin load --file ARG"
3480
3481 sbox.build(empty=True)
3482
3483 file = sbox.get_tempname()
3484 with open(file, 'wb') as f:
3485 f.writelines(clean_dumpfile())
3486 svntest.actions.run_and_verify_svnadmin2(None, [],
3487 0, 'load', '--file', file,
3488 '--ignore-uuid', sbox.repo_dir)
3489 expected_tree = \
3490 svntest.wc.State('', {
3491 'A' : svntest.wc.StateItem(contents="text\n",
3492 props={'svn:keywords': 'Id'})
3493 })
3494 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [],
3495 'update', sbox.wc_dir)
3496 svntest.actions.verify_disk(sbox.wc_dir, expected_tree, check_props=True)
3497
3498 def dump_exclude(sbox):
3499 "svnadmin dump with excluded paths"
3500
3501 sbox.build(create_wc=False)
3502
3503 # Dump repository with /A/D/H and /A/B/E paths excluded.
3504 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3505 'dump', '-q',
3506 '--exclude', '/A/D/H',
3507 '--exclude', '/A/B/E',
3508 sbox.repo_dir)
3509
3510 # Load repository from dump.
3511 sbox2 = sbox.clone_dependent()
3512 sbox2.build(create_wc=False, empty=True)
3513 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3514
3515 # Check log.
3516 expected_output = svntest.verify.RegexListOutput([
3517 r'-+\n',
3518 r'r1 .*\n',
3519 # '/A/D/H' and '/A/B/E' is not added.
3520 re.escape('Changed paths:\n'),
3521 re.escape(' A /A\n'),
3522 re.escape(' A /A/B\n'),
3523 re.escape(' A /A/B/F\n'),
3524 re.escape(' A /A/B/lambda\n'),
3525 re.escape(' A /A/C\n'),
3526 re.escape(' A /A/D\n'),
3527 re.escape(' A /A/D/G\n'),
3528 re.escape(' A /A/D/G/pi\n'),
3529 re.escape(' A /A/D/G/rho\n'),
3530 re.escape(' A /A/D/G/tau\n'),
3531 re.escape(' A /A/D/gamma\n'),
3532 re.escape(' A /A/mu\n'),
3533 re.escape(' A /iota\n'),
3534 r'-+\n',
3535 ])
3536 svntest.actions.run_and_verify_svn(expected_output, [],
3537 'log', '-v', '-q', sbox2.repo_url)
3538
3539 def dump_exclude_copysource(sbox):
3540 "svnadmin dump with excluded copysource"
3541
3542 sbox.build(create_wc=False, empty=True)
3543
3544 # Create default repository structure.
3545 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3546 sbox.repo_url + '/trunk',
3547 sbox.repo_url + '/branches',
3548 sbox.repo_url + '/tags',
3549 "-m", "Create repository structure.")
3550
3551 # Create a branch.
3552 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "copy",
3553 sbox.repo_url + '/trunk',
3554 sbox.repo_url + '/branches/branch1',
3555 "-m", "Create branch.")
3556
3557 # Dump repository with /trunk excluded.
3558 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3559 'dump', '-q',
3560 '--exclude', '/trunk',
3561 sbox.repo_dir)
3562
3563 # Load repository from dump.
3564 sbox2 = sbox.clone_dependent()
3565 sbox2.build(create_wc=False, empty=True)
3566 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3567
3568 # Check log.
3569 expected_output = svntest.verify.RegexListOutput([
3570 r'-+\n',
3571 r'r2 .*\n',
3572 re.escape('Changed paths:\n'),
3573 # Simple add, not copy.
3574 re.escape(' A /branches/branch1\n'),
3575 r'-+\n',
3576 r'r1 .*\n',
3577 # '/trunk' is not added.
3578 re.escape('Changed paths:\n'),
3579 re.escape(' A /branches\n'),
3580 re.escape(' A /tags\n'),
3581 r'-+\n',
3582 ])
3583 svntest.actions.run_and_verify_svn(expected_output, [],
3584 'log', '-v', '-q', sbox2.repo_url)
3585
3586 def dump_include(sbox):
3587 "svnadmin dump with included paths"
3588
3589 sbox.build(create_wc=False, empty=True)
3590
3591 # Create a couple of directories.
3592 # Note that we can't use greek tree as it contains only two top-level
3593 # nodes. Including non top-level nodes (e.g. '--include /A/B/E') will
3594 # produce unloadable dump for now.
3595 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3596 sbox.repo_url + '/A',
3597 sbox.repo_url + '/B',
3598 sbox.repo_url + '/C',
3599 "-m", "Create folder.")
3600
3601 # Dump repository with /A and /C paths included.
3602 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3603 'dump', '-q',
3604 '--include', '/A',
3605 '--include', '/C',
3606 sbox.repo_dir)
3607
3608 # Load repository from dump.
3609 sbox2 = sbox.clone_dependent()
3610 sbox2.build(create_wc=False, empty=True)
3611 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3612
3613 # Check log.
3614 expected_output = svntest.verify.RegexListOutput([
3615 r'-+\n',
3616 r'r1 .*\n',
3617 # '/B' is not added.
3618 re.escape('Changed paths:\n'),
3619 re.escape(' A /A\n'),
3620 re.escape(' A /C\n'),
3621 r'-+\n',
3622 ])
3623 svntest.actions.run_and_verify_svn(expected_output, [],
3624 'log', '-v', '-q', sbox2.repo_url)
3625
3626 def dump_not_include_copysource(sbox):
3627 "svnadmin dump with not included copysource"
3628
3629 sbox.build(create_wc=False, empty=True)
3630
3631 # Create default repository structure.
3632 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3633 sbox.repo_url + '/trunk',
3634 sbox.repo_url + '/branches',
3635 sbox.repo_url + '/tags',
3636 "-m", "Create repository structure.")
3637
3638 # Create a branch.
3639 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "copy",
3640 sbox.repo_url + '/trunk',
3641 sbox.repo_url + '/branches/branch1',
3642 "-m", "Create branch.")
3643
3644 # Dump repository with only /branches included.
3645 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3646 'dump', '-q',
3647 '--include', '/branches',
3648 sbox.repo_dir)
3649
3650 # Load repository from dump.
3651 sbox2 = sbox.clone_dependent()
3652 sbox2.build(create_wc=False, empty=True)
3653 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3654
3655 # Check log.
3656 expected_output = svntest.verify.RegexListOutput([
3657 r'-+\n',
3658 r'r2 .*\n',
3659 re.escape('Changed paths:\n'),
3660 # Simple add, not copy.
3661 re.escape(' A /branches/branch1\n'),
3662 r'-+\n',
3663 r'r1 .*\n',
3664 # Only '/branches' is added in r1.
3665 re.escape('Changed paths:\n'),
3666 re.escape(' A /branches\n'),
3667 r'-+\n',
3668 ])
3669 svntest.actions.run_and_verify_svn(expected_output, [],
3670 'log', '-v', '-q', sbox2.repo_url)
3671
3672 def dump_exclude_by_pattern(sbox):
3673 "svnadmin dump with paths excluded by pattern"
3674
3675 sbox.build(create_wc=False, empty=True)
3676
3677 # Create a couple of directories.
3678 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3679 sbox.repo_url + '/aaa',
3680 sbox.repo_url + '/aab',
3681 sbox.repo_url + '/aac',
3682 sbox.repo_url + '/bbc',
3683 "-m", "Create repository structure.")
3684
3685 # Dump with paths excluded by pattern.
3686 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3687 'dump', '-q',
3688 '--exclude', '/aa?',
3689 '--pattern',
3690 sbox.repo_dir)
3691
3692 # Load repository from dump.
3693 sbox2 = sbox.clone_dependent()
3694 sbox2.build(create_wc=False, empty=True)
3695 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3696
3697 # Check log.
3698 expected_output = svntest.verify.RegexListOutput([
3699 r'-+\n',
3700 r'r1 .*\n',
3701 re.escape('Changed paths:\n'),
3702 # Only '/bbc' is added in r1.
3703 re.escape(' A /bbc\n'),
3704 r'-+\n',
3705 ])
3706 svntest.actions.run_and_verify_svn(expected_output, [],
3707 'log', '-v', '-q', sbox2.repo_url)
3708
3709 def dump_include_by_pattern(sbox):
3710 "svnadmin dump with paths included by pattern"
3711
3712 sbox.build(create_wc=False, empty=True)
3713
3714 # Create a couple of directories.
3715 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3716 sbox.repo_url + '/aaa',
3717 sbox.repo_url + '/aab',
3718 sbox.repo_url + '/aac',
3719 sbox.repo_url + '/bbc',
3720 "-m", "Create repository structure.")
3721
3722 # Dump with paths included by pattern.
3723 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3724 'dump', '-q',
3725 '--include', '/aa?',
3726 '--pattern',
3727 sbox.repo_dir)
3728
3729 # Load repository from dump.
3730 sbox2 = sbox.clone_dependent()
3731 sbox2.build(create_wc=False, empty=True)
3732 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3733
3734 # Check log.
3735 expected_output = svntest.verify.RegexListOutput([
3736 r'-+\n',
3737 r'r1 .*\n',
3738 # '/bbc' is not added.
3739 re.escape('Changed paths:\n'),
3740 re.escape(' A /aaa\n'),
3741 re.escape(' A /aab\n'),
3742 re.escape(' A /aac\n'),
3743 r'-+\n',
3744 ])
3745 svntest.actions.run_and_verify_svn(expected_output, [],
3746 'log', '-v', '-q', sbox2.repo_url)
3747
3748 def dump_exclude_all_rev_changes(sbox):
3749 "svnadmin dump with all revision changes excluded"
3750
3751 sbox.build(create_wc=False, empty=True)
3752
3753 # Create a couple of directories (r1).
3754 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3755 sbox.repo_url + '/r1a',
3756 sbox.repo_url + '/r1b',
3757 sbox.repo_url + '/r1c',
3758 "-m", "Revision 1.")
3759
3760 # Create a couple of directories (r2).
3761 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3762 sbox.repo_url + '/r2a',
3763 sbox.repo_url + '/r2b',
3764 sbox.repo_url + '/r2c',
3765 "-m", "Revision 2.")
3766
3767 # Create a couple of directories (r3).
3768 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "mkdir",
3769 sbox.repo_url + '/r3a',
3770 sbox.repo_url + '/r3b',
3771 sbox.repo_url + '/r3c',
3772 "-m", "Revision 3.")
3773
3774 # Dump with paths excluded by pattern.
3775 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3776 'dump', '-q',
3777 '--exclude', '/r2?',
3778 '--pattern',
3779 sbox.repo_dir)
3780
3781 # Load repository from dump.
3782 sbox2 = sbox.clone_dependent()
3783 sbox2.build(create_wc=False, empty=True)
3784 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3785
3786 # Check log. Revision properties ('svn:log' etc.) should be empty for r2.
3787 expected_output = svntest.verify.RegexListOutput([
3788 r'-+\n',
3789 r'r3 \| jrandom \| .* \| 1 line\n',
3790 re.escape('Changed paths:'),
3791 re.escape(' A /r3a'),
3792 re.escape(' A /r3b'),
3793 re.escape(' A /r3c'),
3794 '',
3795 re.escape('Revision 3.'),
3796 r'-+\n',
3797 re.escape('r2 | (no author) | (no date) | 1 line'),
3798 '',
3799 '',
3800 r'-+\n',
3801 r'r1 | jrandom | .* | 1 line\n',
3802 re.escape('Changed paths:'),
3803 re.escape(' A /r1a'),
3804 re.escape(' A /r1b'),
3805 re.escape(' A /r1c'),
3806 '',
3807 re.escape('Revision 1.'),
3808 r'-+\n',
3809 ])
3810 svntest.actions.run_and_verify_svn(expected_output, [],
3811 'log', '-v', sbox2.repo_url)
3812
3813 def dump_invalid_filtering_option(sbox):
3814 "dump with --include and --exclude simultaneously"
3815
3816 sbox.build(create_wc=False, empty=False)
3817
3818 # Attempt to dump repository with '--include' and '--exclude' options
3819 # specified simultaneously.
3820 expected_error = ".*: '--exclude' and '--include' options cannot be used " \
3821 "simultaneously"
3822 svntest.actions.run_and_verify_svnadmin(None, expected_error,
3823 'dump', '-q',
3824 '--exclude', '/A/D/H',
3825 '--include', '/A/B/E',
3826 sbox.repo_dir)
3827
3828 @Issue(4725)
3829 def load_issue4725(sbox):
3830 """load that triggers issue 4725"""
3831
3832 sbox.build(empty=True)
3833
3834 sbox.simple_mkdir('subversion')
3835 sbox.simple_commit()
3836 sbox.simple_mkdir('subversion/trunk')
3837 sbox.simple_mkdir('subversion/branches')
3838 sbox.simple_commit()
3839 sbox.simple_mkdir('subversion/trunk/src')
3840 sbox.simple_commit()
3841
3842 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3843 'dump', '-q',
3844 sbox.repo_dir)
3845
3846 sbox2 = sbox.clone_dependent()
3847 sbox2.build(create_wc=False, empty=True)
3848 load_and_verify_dumpstream(sbox2, None, [], None, False, dump, '-M100')
3849
3850 @Issue(4767)
3851 def dump_no_canonicalize_svndate(sbox):
3852 "svnadmin dump shouldn't canonicalize svn:date"
3853
3854 sbox.build(create_wc=False, empty=True)
3855 svntest.actions.enable_revprop_changes(sbox.repo_dir)
3856
3857 # set svn:date in a non-canonical format (not six decimal places)
3858 propval = "2015-01-01T00:00:00.0Z"
3859 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [],
3860 "propset", "--revprop", "-r0", "svn:date",
3861 propval,
3862 sbox.repo_url)
3863
3864 dump_lines = svntest.actions.run_and_verify_dump(sbox.repo_dir)
3865 assert propval.encode() + b'\n' in dump_lines
3866
3867 def check_recover_prunes_rep_cache(sbox, enable_rep_sharing):
3868 """Check 'recover' prunes the rep-cache while enable-rep-sharing is
3869 true/false.
3870 """
3871 # Remember the initial rep cache content.
3872 rep_cache_r1 = read_rep_cache(sbox.repo_dir)
3873 #print '\n'.join([h + ": " + repr(ref) for h, ref in rep_cache_r1.items()])
3874
3875 # Commit one new rep and check the rep-cache is extended.
3876 sbox.simple_append('iota', 'New line.\n')
3877 sbox.simple_commit()
3878 rep_cache_r2 = read_rep_cache(sbox.repo_dir)
3879 if not (len(rep_cache_r2) == len(rep_cache_r1) + 1):
3880 raise svntest.Failure
3881
3882 fsfs_conf = svntest.main.get_fsfs_conf_file_path(sbox.repo_dir)
3883 svntest.main.file_append(fsfs_conf,
3884 # Add a newline in case the existing file doesn't
3885 # end with one.
3886 "\n"
3887 "[rep-sharing]\n"
3888 "enable-rep-sharing = %s\n"
3889 % (('true' if enable_rep_sharing else 'false'),))
3890
3891 # Break r2 in such a way that 'recover' will discard it
3892 head_rev_path = fsfs_file(sbox.repo_dir, 'revs', '2')
3893 os.remove(head_rev_path)
3894 current_path = os.path.join(sbox.repo_dir, 'db', 'current')
3895 svntest.main.file_write(current_path, '1\n')
3896
3897 # Recover back to r1.
3898 svntest.actions.run_and_verify_svnadmin(None, [],
3899 "recover", sbox.repo_dir)
3900 svntest.actions.run_and_verify_svnlook(['1\n'], [], 'youngest',
3901 sbox.repo_dir)
3902
3903 # Check the rep-cache is pruned.
3904 rep_cache_recovered = read_rep_cache(sbox.repo_dir)
3905 if not (rep_cache_recovered == rep_cache_r1):
3906 raise svntest.Failure
3907
3908 @Issue(4077)
3909 @SkipUnless(svntest.main.is_fs_type_fsfs)
3910 @SkipUnless(svntest.main.python_sqlite_can_read_without_rowid)
3911 def recover_prunes_rep_cache_when_enabled(sbox):
3912 "recover prunes rep cache when enabled"
3913 sbox.build()
3914
3915 check_recover_prunes_rep_cache(sbox, enable_rep_sharing=True)
3916
3917 @Issue(4077)
3918 @SkipUnless(svntest.main.is_fs_type_fsfs)
3919 @SkipUnless(svntest.main.python_sqlite_can_read_without_rowid)
3920 def recover_prunes_rep_cache_when_disabled(sbox):
3921 "recover prunes rep cache when disabled"
3922 sbox.build()
3923
3924 check_recover_prunes_rep_cache(sbox, enable_rep_sharing=False)
3925
3926 @Issue(4760)
3927 def dump_include_copied_directory(sbox):
3928 "include copied directory with nested nodes"
3929
3930 sbox.build(create_wc=False)
3931
3932 svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "copy",
3933 sbox.repo_url + '/A/D',
3934 sbox.repo_url + '/COPY',
3935 "-m", "Create branch.")
3936
3937 # Dump repository with only /COPY path included.
3938 _, dump, _ = svntest.actions.run_and_verify_svnadmin(None, [],
3939 'dump', '-q',
3940 '--include', '/COPY',
3941 sbox.repo_dir)
3942
3943 # Load repository from dump.
3944 sbox2 = sbox.clone_dependent()
3945 sbox2.build(create_wc=False, empty=True)
3946 load_and_verify_dumpstream(sbox2, None, [], None, False, dump)
3947
3948 # Check log.
3949 expected_output = svntest.verify.RegexListOutput([
3950 r'-+\n',
3951 r'r2 .*\n',
3952 # Only '/COPY' is added
3953 re.escape('Changed paths:\n'),
3954 re.escape(' A /COPY'),
3955 re.escape(' A /COPY/G'),
3956 re.escape(' A /COPY/G/pi'),
3957 re.escape(' A /COPY/G/rho'),
3958 re.escape(' A /COPY/G/tau'),
3959 re.escape(' A /COPY/H'),
3960 re.escape(' A /COPY/H/chi'),
3961 re.escape(' A /COPY/H/omega'),
3962 re.escape(' A /COPY/H/psi'),
3963 re.escape(' A /COPY/gamma'),
3964 r'-+\n',
3965 r'r1 .*\n',
3966 r'-+\n',
3967 ])
3968 svntest.actions.run_and_verify_svn(expected_output, [],
3969 'log', '-v', '-q', sbox2.repo_url)
3970
3971 def load_normalize_node_props(sbox):
3972 "svnadmin load --normalize node props"
3973
3974 dump_str = b"""SVN-fs-dump-format-version: 2
3975
3976 UUID: dc40867b-38f6-0310-9f5f-f81aa277e06f
3977
3978 Revision-number: 0
3979 Prop-content-length: 56
3980 Content-length: 56
3981
3982 K 8
3983 svn:date
3984 V 27
3985 2005-05-03T19:09:41.129900Z
3986 PROPS-END
3987
3988 Revision-number: 1
3989 Prop-content-length: 99
3990 Content-length: 99
3991
3992 K 7
3993 svn:log
3994 V 0
3995
3996 K 10
3997 svn:author
3998 V 2
3999 pl
4000 K 8
4001 svn:date
4002 V 27
4003 2005-05-03T19:10:19.975578Z
4004 PROPS-END
4005
4006 Node-path:\x20
4007 Node-kind: dir
4008 Node-action: change
4009 Prop-content-length: 32
4010 Content-length: 32
4011
4012 K 10
4013 svn:ignore
4014 V 3
4015 \n\r\n
4016 PROPS-END
4017
4018
4019 """
4020 sbox.build(empty=True)
4021
4022 # Try to load the dumpstream, expecting a failure (because of mixed
4023 # EOLs in the svn:ignore property value).
4024 exp_err = svntest.verify.RegexListOutput(['svnadmin: E125005:.*',
4025 'svnadmin: E125017:.*'],
4026 match_all=False)
4027 load_and_verify_dumpstream(sbox, [], exp_err, dumpfile_revisions,
4028 False, dump_str, '--ignore-uuid')
4029
4030 # Now try it again with prop normalization.
4031 svntest.actions.load_repo(sbox, dump_str=dump_str,
4032 bypass_prop_validation=False,
4033 normalize_props=True)
4034 # We should get the normalized property value.
4035 exit_code, output, _ = svntest.main.run_svn(None, 'pg', 'svn:ignore',
4036 '--no-newline',
4037 sbox.repo_url)
4038 svntest.verify.verify_exit_code(None, exit_code, 0)
4039 if output != ['\n', '\n']:
4040 raise svntest.Failure("Unexpected property value %s" % output)
4041
4042 @SkipUnless(svntest.main.is_fs_type_fsfs)
4043 @SkipUnless(svntest.main.fs_has_rep_sharing)
4044 @SkipUnless(svntest.main.python_sqlite_can_read_without_rowid)
4045 def build_repcache(sbox):
4046 "svnadmin build-repcache"
4047
4048 sbox.build(create_wc = False)
4049
4050 # Remember and remove the existing rep-cache.
4051 rep_cache = read_rep_cache(sbox.repo_dir)
4052 rep_cache_path = os.path.join(sbox.repo_dir, 'db', 'rep-cache.db')
4053 os.remove(rep_cache_path)
4054
4055 # Build a new rep-cache and compare with the original one.
4056 expected_output = ["* Processed revision 1.\n"]
4057 svntest.actions.run_and_verify_svnadmin(expected_output, [],
4058 "build-repcache", sbox.repo_dir)
4059
4060 new_rep_cache = read_rep_cache(sbox.repo_dir)
4061 if new_rep_cache != rep_cache:
4062 raise svntest.Failure
4063
4064
4065 ########################################################################
4066 # Run the tests
4067
4068
4069 # list all tests here, starting with None:
4070 test_list = [ None,
4071 extra_headers,
4072 extra_blockcontent,
4073 inconsistent_headers,
4074 empty_date,
4075 dump_copied_dir,
4076 dump_move_dir_modify_child,
4077 dump_quiet,
4078 hotcopy_dot,
4079 hotcopy_format,
4080 setrevprop,
4081 verify_windows_paths_in_repos,
4082 verify_incremental_fsfs,
4083 fsfs_recover_db_current,
4084 fsfs_recover_old_db_current,
4085 load_with_parent_dir,
4086 set_uuid,
4087 reflect_dropped_renumbered_revs,
4088 fsfs_recover_handle_missing_revs_or_revprops_file,
4089 create_in_repo_subdir,
4090 verify_with_invalid_revprops,
4091 dont_drop_valid_mergeinfo_during_incremental_loads,
4092 hotcopy_symlink,
4093 load_bad_props,
4094 verify_non_utf8_paths,
4095 test_lslocks_and_rmlocks,
4096 load_ranges,
4097 hotcopy_incremental,
4098 hotcopy_incremental_packed,
4099 locking,
4100 mergeinfo_race,
4101 recover_old_empty,
4102 verify_keep_going,
4103 verify_keep_going_quiet,
4104 verify_invalid_path_changes,
4105 verify_denormalized_names,
4106 fsfs_recover_old_non_empty,
4107 fsfs_hotcopy_old_non_empty,
4108 load_ignore_dates,
4109 fsfs_hotcopy_old_with_id_changes,
4110 verify_packed,
4111 freeze_freeze,
4112 verify_metadata_only,
4113 verify_quickly,
4114 fsfs_hotcopy_progress,
4115 fsfs_hotcopy_progress_with_revprop_changes,
4116 fsfs_hotcopy_progress_old,
4117 freeze_same_uuid,
4118 upgrade,
4119 load_txdelta,
4120 load_no_svndate_r0,
4121 hotcopy_read_only,
4122 fsfs_pack_non_sharded,
4123 load_revprops,
4124 dump_revprops,
4125 dump_no_op_change,
4126 dump_no_op_prop_change,
4127 load_no_flush_to_disk,
4128 dump_to_file,
4129 load_from_file,
4130 dump_exclude,
4131 dump_exclude_copysource,
4132 dump_include,
4133 dump_not_include_copysource,
4134 dump_exclude_by_pattern,
4135 dump_include_by_pattern,
4136 dump_exclude_all_rev_changes,
4137 dump_invalid_filtering_option,
4138 load_issue4725,
4139 dump_no_canonicalize_svndate,
4140 recover_prunes_rep_cache_when_enabled,
4141 recover_prunes_rep_cache_when_disabled,
4142 dump_include_copied_directory,
4143 load_normalize_node_props,
4144 build_repcache,
4145 ]
4146
4147 if __name__ == '__main__':
4148 svntest.main.run_tests(test_list)
4149 # NOTREACHED
4150
4151
4152 ### End of file.