/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/reconcile.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    ]
28
28
 
29
29
 
30
 
from . import (
 
30
from bzrlib import (
31
31
    cleanup,
32
32
    errors,
33
33
    revision as _mod_revision,
34
34
    ui,
35
35
    )
36
 
from .trace import mutter
37
 
from .tsort import topo_sort
38
 
from .bzr.versionedfile import AdapterFactory, FulltextContentFactory
39
 
from .i18n import gettext
 
36
from bzrlib.trace import mutter
 
37
from bzrlib.tsort import topo_sort
 
38
from bzrlib.versionedfile import AdapterFactory, FulltextContentFactory
 
39
from bzrlib.i18n import gettext
40
40
 
41
41
 
42
42
def reconcile(dir, canonicalize_chks=False):
60
60
 
61
61
    def __init__(self, dir, other=None, canonicalize_chks=False):
62
62
        """Create a Reconciler."""
63
 
        self.controldir = dir
 
63
        self.bzrdir = dir
64
64
        self.canonicalize_chks = canonicalize_chks
65
65
 
66
66
    def reconcile(self):
76
76
          branch history was correct, True if the branch history needed to be
77
77
          re-normalized.
78
78
        """
79
 
        operation = cleanup.OperationWithCleanups(self._reconcile)
80
 
        self.add_cleanup = operation.add_cleanup
81
 
        operation.run_simple()
 
79
        self.pb = ui.ui_factory.nested_progress_bar()
 
80
        try:
 
81
            self._reconcile()
 
82
        finally:
 
83
            self.pb.finished()
82
84
 
83
85
    def _reconcile(self):
84
86
        """Helper function for performing reconciliation."""
85
 
        self.pb = ui.ui_factory.nested_progress_bar()
86
 
        self.add_cleanup(self.pb.finished)
87
87
        self._reconcile_branch()
88
88
        self._reconcile_repository()
89
89
 
90
90
    def _reconcile_branch(self):
91
91
        try:
92
 
            self.branch = self.controldir.open_branch()
 
92
            self.branch = self.bzrdir.open_branch()
93
93
        except errors.NotBranchError:
94
94
            # Nothing to check here
95
95
            self.fixed_branch_history = None
99
99
        self.fixed_branch_history = branch_reconciler.fixed_history
100
100
 
101
101
    def _reconcile_repository(self):
102
 
        self.repo = self.controldir.find_repository()
 
102
        self.repo = self.bzrdir.find_repository()
103
103
        ui.ui_factory.note(gettext('Reconciling repository %s') %
104
104
            self.repo.user_url)
105
105
        self.pb.update(gettext("Reconciling repository"), 0, 1)
118
118
            ui.ui_factory.note(gettext(
119
119
                'Reconcile aborted: revision index has inconsistent parents.'))
120
120
            ui.ui_factory.note(gettext(
121
 
                'Run "brz check" for more details.'))
 
121
                'Run "bzr check" for more details.'))
122
122
        else:
123
123
            ui.ui_factory.note(gettext('Reconciliation complete.'))
124
124
 
235
235
        self.inventory = self.repo.inventories
236
236
        self.revisions = self.repo.revisions
237
237
        # the total set of revisions to process
238
 
        self.pending = {key[-1] for key in self.revisions.keys()}
 
238
        self.pending = set([key[-1] for key in self.revisions.keys()])
239
239
 
240
240
        # mapping from revision_id to parents
241
241
        self._rev_graph = {}
269
269
        # if this worked, the set of new_inventories.keys should equal
270
270
        # self.pending
271
271
        if not (set(new_inventories.keys()) ==
272
 
            {(revid,) for revid in self.pending}):
 
272
            set([(revid,) for revid in self.pending])):
273
273
            raise AssertionError()
274
274
        self.pb.update(gettext('Writing weave'))
275
275
        self.repo._activate_new_inventory()
430
430
            # NB: This is really not needed, reconcile != pack.
431
431
            per_id_bad_parents[key[0]] = {}
432
432
        # Generate per-knit/weave data.
433
 
        for key, details in bad_parents.items():
 
433
        for key, details in bad_parents.iteritems():
434
434
            file_id = key[0]
435
435
            rev_id = key[1]
436
436
            knit_parents = tuple([parent[-1] for parent in details[0]])