~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconcile.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-05 00:52:37 UTC
  • mfrom: (2819.2.5 find-inconsistent-parents)
  • mto: This revision was merged to the branch mainline in revision 2905.
  • Revision ID: andrew.bennetts@canonical.com-20071005005237-rlgbshfgenspobfd
MergeĀ find-inconsistent-parents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Reconcilers are able to fix some potential data errors in a branch."""
18
18
 
19
19
 
20
 
__all__ = [
21
 
    'KnitReconciler',
22
 
    'reconcile',
23
 
    'Reconciler',
24
 
    'RepoReconciler',
25
 
    ]
 
20
__all__ = ['reconcile', 'Reconciler', 'RepoReconciler', 'KnitReconciler']
26
21
 
27
22
 
28
23
from bzrlib import (
31
26
    ui,
32
27
    repository,
33
28
    )
34
 
from bzrlib.trace import mutter
 
29
from bzrlib import errors
 
30
from bzrlib import ui
 
31
from bzrlib.trace import mutter, note
35
32
from bzrlib.tsort import TopoSorter, topo_sort
36
33
 
37
34
 
81
78
        repo_reconciler = self.repo.reconcile(thorough=True)
82
79
        self.inconsistent_parents = repo_reconciler.inconsistent_parents
83
80
        self.garbage_inventories = repo_reconciler.garbage_inventories
84
 
        self.pb.note('Reconciliation complete.')
 
81
        if repo_reconciler.aborted:
 
82
            self.pb.note(
 
83
                'Reconcile aborted: revision index has inconsistent parents.')
 
84
            self.pb.note(
 
85
                'Run "bzr check" for more details.')
 
86
        else:
 
87
            self.pb.note('Reconciliation complete.')
85
88
 
86
89
 
87
90
class RepoReconciler(object):
104
107
        """
105
108
        self.garbage_inventories = 0
106
109
        self.inconsistent_parents = 0
 
110
        self.aborted = False
107
111
        self.repo = repo
108
112
        self.thorough = thorough
109
113
 
288
292
    def _reconcile_steps(self):
289
293
        """Perform the steps to reconcile this repository."""
290
294
        if self.thorough:
291
 
            self._load_indexes()
 
295
            try:
 
296
                self._load_indexes()
 
297
            except errors.BzrCheckError:
 
298
                self.aborted = True
 
299
                return
 
300
            # knits never suffer this
292
301
            self._gc_inventory()
293
302
            self._fix_text_parents()
294
303
 
298
307
        self.pb.update('Reading indexes.', 0, 2)
299
308
        self.inventory = self.repo.get_inventory_weave()
300
309
        self.pb.update('Reading indexes.', 1, 2)
 
310
        self.repo._check_for_inconsistent_revision_parents()
301
311
        self.revisions = self.repo._revision_store.get_revision_file(self.transaction)
302
312
        self.pb.update('Reading indexes.', 2, 2)
303
313