39
39
from bzrlib.weavestore import WeaveStore
40
40
from bzrlib.store import copy_all
41
41
from bzrlib.store.compressed_text import CompressedTextStore
42
from bzrlib.store.text import TextStore
42
43
from bzrlib.transport import Transport
232
233
self._make_control()
233
234
self._check_format(relax_version_check)
234
cfn = self.controlfilename
236
def get_store(name, compressed=True):
237
relpath = self._rel_controlfilename(name)
239
store = CompressedTextStore(self._transport.clone(relpath))
241
store = TextStore(self._transport.clone(relpath))
242
if self._transport.should_cache():
243
from meta_store import CachedStore
244
cache_path = os.path.join(self.cache_root, name)
246
store = CachedStore(store, cache_path)
249
relpath = self._rel_controlfilename(name)
250
ws = WeaveStore(self._transport.clone(relpath))
251
if self._transport.should_cache():
252
ws.enable_cache = True
235
255
if self._branch_format == 4:
236
self.inventory_store = CompressedTextStore(cfn('inventory-store'))
237
self.text_store = CompressedTextStore(cfn('text-store'))
256
self.inventory_store = get_store('inventory-store')
257
self.text_store = get_store('text-store')
258
self.revision_store = get_store('revision-store')
238
259
elif self._branch_format == 5:
239
self.control_weaves = WeaveStore(cfn([]))
240
self.weave_store = WeaveStore(cfn('weaves'))
242
# FIXME: Unify with make_control_files
243
self.control_weaves.put_empty_weave('inventory')
244
self.control_weaves.put_empty_weave('ancestry')
245
self.revision_store = CompressedTextStore(cfn('revision-store'))
260
self.control_weaves = get_weave([]))
261
self.weave_store = get_weave('weaves'))
262
self.revision_store = get_store('revision-store', compressed=False)
247
264
def __str__(self):
248
265
return '%s(%r)' % (self.__class__.__name__, self._transport.base)
403
422
# them; they're not needed for now and so ommitted for
405
424
bzrlib.xml5.serializer_v5.write_inventory(Inventory(), sio)
425
empty_inv = sio.getvalue()
427
bzrlib.weavefile.write_weave_v5(Weave(), sio)
428
empty_weave = sio.getvalue()
407
430
dirs = [[], 'revision-store', 'weaves']
408
431
files = [('README',
413
436
('branch-name', ''),
414
437
('branch-lock', ''),
415
438
('pending-merges', ''),
416
('inventory', sio.getvalue())
439
('inventory', empty_inv),
440
('inventory.weave', empty_weave),
441
('ancestry.weave', empty_weave)
418
443
cfn = self._rel_controlfilename
419
444
self._transport.mkdir_multi([cfn(d) for d in dirs])