~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconcile.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib import (
30
30
    cleanup,
31
31
    errors,
32
 
    revision as _mod_revision,
33
32
    ui,
34
33
    )
35
34
from bzrlib.trace import mutter
65
64
        """Perform reconciliation.
66
65
 
67
66
        After reconciliation the following attributes document found issues:
68
 
 
69
 
        * `inconsistent_parents`: The number of revisions in the repository
70
 
          whose ancestry was being reported incorrectly.
71
 
        * `garbage_inventories`: The number of inventory objects without
72
 
          revisions that were garbage collected.
73
 
        * `fixed_branch_history`: None if there was no branch, False if the
74
 
          branch history was correct, True if the branch history needed to be
75
 
          re-normalized.
 
67
        inconsistent_parents: The number of revisions in the repository whose
 
68
                              ancestry was being reported incorrectly.
 
69
        garbage_inventories: The number of inventory objects without revisions
 
70
                             that were garbage collected.
 
71
        fixed_branch_history: None if there was no branch, False if the branch
 
72
                              history was correct, True if the branch history
 
73
                              needed to be re-normalized.
76
74
        """
77
75
        self.pb = ui.ui_factory.nested_progress_bar()
78
76
        try:
145
143
        self._reconcile_revision_history()
146
144
 
147
145
    def _reconcile_revision_history(self):
 
146
        repo = self.branch.repository
148
147
        last_revno, last_revision_id = self.branch.last_revision_info()
149
148
        real_history = []
150
 
        graph = self.branch.repository.get_graph()
151
149
        try:
152
 
            for revid in graph.iter_lefthand_ancestry(
153
 
                    last_revision_id, (_mod_revision.NULL_REVISION,)):
 
150
            for revid in repo.iter_reverse_revision_history(
 
151
                    last_revision_id):
154
152
                real_history.append(revid)
155
153
        except errors.RevisionNotPresent:
156
154
            pass # Hit a ghost left hand parent
198
196
        """Perform reconciliation.
199
197
 
200
198
        After reconciliation the following attributes document found issues:
201
 
 
202
 
        * `inconsistent_parents`: The number of revisions in the repository
203
 
          whose ancestry was being reported incorrectly.
204
 
        * `garbage_inventories`: The number of inventory objects without
205
 
          revisions that were garbage collected.
 
199
        inconsistent_parents: The number of revisions in the repository whose
 
200
                              ancestry was being reported incorrectly.
 
201
        garbage_inventories: The number of inventory objects without revisions
 
202
                             that were garbage collected.
206
203
        """
207
204
        operation = cleanup.OperationWithCleanups(self._reconcile)
208
205
        self.add_cleanup = operation.add_cleanup
227
224
        only data-loss causing issues (!self.thorough) or all issues
228
225
        (self.thorough) are treated as requiring the reweave.
229
226
        """
 
227
        # local because needing to know about WeaveFile is a wart we want to hide
 
228
        from bzrlib.weave import WeaveFile, Weave
230
229
        transaction = self.repo.get_transaction()
231
230
        self.pb.update('Reading inventory data')
232
231
        self.inventory = self.repo.inventories