17
17
"""Reconcilers are able to fix some potential data errors in a branch."""
20
__all__ = ['reconcile', 'Reconciler', 'RepoReconciler', 'KnitReconciler']
23
29
from bzrlib import (
29
from bzrlib import errors
31
34
from bzrlib.trace import mutter, note
32
from bzrlib.tsort import TopoSorter, topo_sort
35
from bzrlib.tsort import TopoSorter
35
38
def reconcile(dir, other=None):
398
401
parents = vf.get_parents(version)
399
402
new_parents[version] = parents
400
for version in topo_sort(new_parents.items()):
403
for version in TopoSorter(new_parents.items()).iter_topo_order():
401
404
new_vf.add_lines(version, new_parents[version],
402
405
vf.get_lines(version))
403
406
self.repo.weave_store.copy(new_vf, file_id, self.transaction)
404
407
self.repo.weave_store.delete('temp:%s' % file_id, self.transaction)
410
class PackReconciler(RepoReconciler):
411
"""Reconciler that reconciles a pack based repository.
413
Garbage inventories do not affect ancestry queries, and removal is
414
considerably more expensive as there is no separate versioned file for
415
them, so they are not cleaned. In short it is currently a no-op.
417
In future this may be a good place to hook in annotation cache checking,
418
index recreation etc.
421
# XXX: The index corruption that _fix_text_parents performs is needed for
422
# packs, but not yet implemented. The basic approach is to:
423
# - lock the names list
424
# - perform a customised pack() that regenerates data as needed
425
# - unlock the names list
426
# https://bugs.edge.launchpad.net/bzr/+bug/154173
428
def _reconcile_steps(self):
429
"""Perform the steps to reconcile this repository."""