1310
1310
# existing knit to be changed - its all behind 'repo.add_inventory'.
1313
class GraphKnitRepository1(KnitRepository):
1313
class GraphKnitRepository(KnitRepository):
1314
1314
"""Experimental graph-knit using repository."""
1316
_commit_builder_class = PackCommitBuilder
1318
1316
def __init__(self, _format, a_bzrdir, control_files, _revision_store,
1319
control_store, text_store):
1317
control_store, text_store, _commit_builder_class, _serializer):
1320
1318
KnitRepository.__init__(self, _format, a_bzrdir, control_files,
1321
_revision_store, control_store, text_store)
1319
_revision_store, control_store, text_store, _commit_builder_class,
1322
1321
index_transport = control_files._transport.clone('indices')
1323
1322
self._packs = RepositoryPackCollection(self, control_files._transport,
1324
1323
index_transport,
1367
1366
reconciler.reconcile()
1368
1367
return reconciler
1370
def reconcile_actions(self):
1371
"""Return a set of actions taken by reconcile on this repository.
1373
Pack repositories currently perform no reconciliation.
1375
:return: A set of actions. e.g. set(['inventory_gc']).
1380
class GraphKnitRepository3(KnitRepository3):
1381
"""Experimental graph-knit using subtrees repository."""
1383
_commit_builder_class = PackRootCommitBuilder
1385
def __init__(self, _format, a_bzrdir, control_files, _revision_store,
1386
control_store, text_store):
1387
KnitRepository3.__init__(self, _format, a_bzrdir, control_files,
1388
_revision_store, control_store, text_store)
1389
index_transport = control_files._transport.clone('indices')
1390
self._packs = RepositoryPackCollection(self, control_files._transport,
1392
control_files._transport.clone('upload'),
1393
control_files._transport.clone('packs'))
1394
self._revision_store = GraphKnitRevisionStore(self, index_transport, self._revision_store)
1395
self.weave_store = GraphKnitTextStore(self, index_transport, self.weave_store)
1396
self._inv_thunk = InventoryKnitThunk(self, index_transport)
1398
self._reconcile_does_inventory_gc = False
1400
def _abort_write_group(self):
1401
return self._packs._abort_write_group()
1403
def _refresh_data(self):
1404
if self.control_files._lock_count==1:
1405
self._revision_store.reset()
1406
self.weave_store.reset()
1407
self._inv_thunk.reset()
1408
# forget what names there are
1411
def _start_write_group(self):
1412
self._packs._start_write_group()
1414
def _commit_write_group(self):
1415
return self._packs._commit_write_group()
1417
def get_inventory_weave(self):
1418
return self._inv_thunk.get_weave()
1422
"""Compress the data within the repository.
1424
This will pack all the data to a single pack. In future it may
1425
recompress deltas or do other such expensive operations.
1430
def reconcile(self, other=None, thorough=False):
1431
"""Reconcile this repository."""
1432
from bzrlib.reconcile import PackReconciler
1433
reconciler = PackReconciler(self, thorough=thorough)
1434
reconciler.reconcile()
1437
def reconcile_actions(self):
1438
"""Return a set of actions taken by reconcile on this repository.
1440
:return: A set of actions. e.g. set(['inventory_gc']).
1445
1370
class RepositoryFormatPack(MetaDirRepositoryFormat):
1446
1371
"""Format logic for pack structured repositories.
1457
1382
- a LockDir lock
1385
# Set this attribute in derived classes to control the repository class
1386
# created by open and initialize.
1387
repository_class = None
1388
# Set this attribute in derived classes to control the
1389
# _commit_builder_class that the repository objects will have passed to
1390
# their constructor.
1391
_commit_builder_class = None
1392
# Set this attribute in derived clases to control the _serializer that the
1393
# repository objects will have passed to their constructor.
1460
1396
def _get_control_store(self, repo_transport, control_files):
1461
1397
"""Return the control store for this repository."""
1462
1398
return VersionedFileStore(
1536
1472
control_files=control_files,
1537
1473
_revision_store=_revision_store,
1538
1474
control_store=control_store,
1539
text_store=text_store)
1475
text_store=text_store,
1476
_commit_builder_class=self._commit_builder_class,
1477
_serializer=self._serializer)
1542
1480
class RepositoryFormatGraphKnit1(RepositoryFormatPack):
1598
1538
- support for recording tree-references
1601
repository_class = GraphKnitRepository3
1541
repository_class = GraphKnitRepository
1542
_commit_builder_class = PackRootCommitBuilder
1602
1543
rich_root_data = True
1603
1544
supports_tree_reference = True
1545
_serializer = xml7.serializer_v7
1605
1547
def _get_matching_bzrdir(self):
1606
1548
return bzrdir.format_registry.make_bzrdir('experimental-subtree')