71
68
from bzrlib.weave import WeaveFile
72
69
from bzrlib.weavefile import read_weave, write_weave
75
def load_tests(standard_tests, module, loader):
76
"""Parameterize VersionedFiles tests for different implementations."""
77
to_adapt, result = split_suite_by_condition(
78
standard_tests, condition_isinstance(TestVersionedFiles))
79
# We want to be sure of behaviour for:
80
# weaves prefix layout (weave texts)
81
# individually named weaves (weave inventories)
82
# annotated knits - prefix|hash|hash-escape layout, we test the third only
83
# as it is the most complex mapper.
84
# individually named knits
85
# individual no-graph knits in packs (signatures)
86
# individual graph knits in packs (inventories)
87
# individual graph nocompression knits in packs (revisions)
88
# plain text knits in packs (texts)
92
'factory':make_versioned_files_factory(WeaveFile,
93
ConstantMapper('inventory')),
96
'support_partial_insertion': False,
100
'factory':make_file_factory(False, ConstantMapper('revisions')),
103
'support_partial_insertion': False,
105
('named-nograph-nodelta-knit-pack', {
106
'cleanup':cleanup_pack_knit,
107
'factory':make_pack_factory(False, False, 1),
110
'support_partial_insertion': False,
112
('named-graph-knit-pack', {
113
'cleanup':cleanup_pack_knit,
114
'factory':make_pack_factory(True, True, 1),
117
'support_partial_insertion': True,
119
('named-graph-nodelta-knit-pack', {
120
'cleanup':cleanup_pack_knit,
121
'factory':make_pack_factory(True, False, 1),
124
'support_partial_insertion': False,
126
('groupcompress-nograph', {
127
'cleanup':groupcompress.cleanup_pack_group,
128
'factory':groupcompress.make_pack_factory(False, False, 1),
131
'support_partial_insertion':False,
134
len_two_scenarios = [
137
'factory':make_versioned_files_factory(WeaveFile,
141
'support_partial_insertion': False,
143
('annotated-knit-escape', {
145
'factory':make_file_factory(True, HashEscapedPrefixMapper()),
148
'support_partial_insertion': False,
150
('plain-knit-pack', {
151
'cleanup':cleanup_pack_knit,
152
'factory':make_pack_factory(True, True, 2),
155
'support_partial_insertion': True,
158
'cleanup':groupcompress.cleanup_pack_group,
159
'factory':groupcompress.make_pack_factory(True, False, 1),
162
'support_partial_insertion':False,
165
scenarios = len_one_scenarios + len_two_scenarios
166
return multiply_tests(to_adapt, scenarios, result)
70
from bzrlib.tests.scenarios import load_tests_apply_scenarios
73
load_tests = load_tests_apply_scenarios
169
76
def get_diamond_vf(f, trailing_eol=True, left_only=False):
1475
1382
class TestVersionedFiles(TestCaseWithMemoryTransport):
1476
1383
"""Tests for the multiple-file variant of VersionedFile."""
1385
# We want to be sure of behaviour for:
1386
# weaves prefix layout (weave texts)
1387
# individually named weaves (weave inventories)
1388
# annotated knits - prefix|hash|hash-escape layout, we test the third only
1389
# as it is the most complex mapper.
1390
# individually named knits
1391
# individual no-graph knits in packs (signatures)
1392
# individual graph knits in packs (inventories)
1393
# individual graph nocompression knits in packs (revisions)
1394
# plain text knits in packs (texts)
1395
len_one_scenarios = [
1398
'factory':make_versioned_files_factory(WeaveFile,
1399
ConstantMapper('inventory')),
1402
'support_partial_insertion': False,
1406
'factory':make_file_factory(False, ConstantMapper('revisions')),
1409
'support_partial_insertion': False,
1411
('named-nograph-nodelta-knit-pack', {
1412
'cleanup':cleanup_pack_knit,
1413
'factory':make_pack_factory(False, False, 1),
1416
'support_partial_insertion': False,
1418
('named-graph-knit-pack', {
1419
'cleanup':cleanup_pack_knit,
1420
'factory':make_pack_factory(True, True, 1),
1423
'support_partial_insertion': True,
1425
('named-graph-nodelta-knit-pack', {
1426
'cleanup':cleanup_pack_knit,
1427
'factory':make_pack_factory(True, False, 1),
1430
'support_partial_insertion': False,
1432
('groupcompress-nograph', {
1433
'cleanup':groupcompress.cleanup_pack_group,
1434
'factory':groupcompress.make_pack_factory(False, False, 1),
1437
'support_partial_insertion':False,
1440
len_two_scenarios = [
1443
'factory':make_versioned_files_factory(WeaveFile,
1447
'support_partial_insertion': False,
1449
('annotated-knit-escape', {
1451
'factory':make_file_factory(True, HashEscapedPrefixMapper()),
1454
'support_partial_insertion': False,
1456
('plain-knit-pack', {
1457
'cleanup':cleanup_pack_knit,
1458
'factory':make_pack_factory(True, True, 2),
1461
'support_partial_insertion': True,
1464
'cleanup':groupcompress.cleanup_pack_group,
1465
'factory':groupcompress.make_pack_factory(True, False, 1),
1468
'support_partial_insertion':False,
1472
scenarios = len_one_scenarios + len_two_scenarios
1478
1474
def get_versionedfiles(self, relpath='files'):
1479
1475
transport = self.get_transport(relpath)
1480
1476
if relpath != '.':