~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconcile.py

  • Committer: abentley
  • Date: 2006-04-20 23:47:53 UTC
  • mfrom: (1681 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1683.
  • Revision ID: abentley@lappy-20060420234753-6a6874b76f09f86d
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        self.repo.control_weaves.copy(self.inventory, 'inventory.backup', self.repo.get_transaction())
135
135
        self.pb.note('Backup Inventory created.')
136
136
        # asking for '' should never return a non-empty weave
137
 
        new_inventory = self.repo.control_weaves.get_empty('inventory.new',
 
137
        new_inventory_vf = self.repo.control_weaves.get_empty('inventory.new',
138
138
            self.repo.get_transaction())
139
139
 
140
140
        # we have topological order of revisions and non ghost parents ready.
142
142
        for rev_id in TopoSorter(self._rev_graph.items()).iter_topo_order():
143
143
            parents = self._rev_graph[rev_id]
144
144
            # double check this really is in topological order.
145
 
            unavailable = [p for p in parents if p not in new_inventory]
 
145
            unavailable = [p for p in parents if p not in new_inventory_vf]
146
146
            assert len(unavailable) == 0
147
147
            # this entry has all the non ghost parents in the inventory
148
148
            # file already.
149
149
            self._reweave_step('adding inventories')
150
 
            # ugly but needed, weaves are just way tooooo slow else.
151
 
            if isinstance(new_inventory, WeaveFile):
152
 
                Weave.add_lines(new_inventory, rev_id, parents, self.inventory.get_lines(rev_id))
 
150
            if isinstance(new_inventory_vf, WeaveFile):
 
151
                # It's really a WeaveFile, but we call straight into the
 
152
                # Weave's add method to disable the auto-write-out behaviour.
 
153
                # This is done to avoid a revision_count * time-to-write additional overhead on 
 
154
                # reconcile.
 
155
                new_inventory_vf._check_write_ok()
 
156
                Weave._add_lines(new_inventory_vf, rev_id, parents, self.inventory.get_lines(rev_id),
 
157
                                 None)
153
158
            else:
154
 
                new_inventory.add_lines(rev_id, parents, self.inventory.get_lines(rev_id))
 
159
                new_inventory_vf.add_lines(rev_id, parents, self.inventory.get_lines(rev_id))
155
160
 
156
 
        if isinstance(new_inventory, WeaveFile):
157
 
            new_inventory._save()
158
 
        # if this worked, the set of new_inventory.names should equal
 
161
        if isinstance(new_inventory_vf, WeaveFile):
 
162
            new_inventory_vf._save()
 
163
        # if this worked, the set of new_inventory_vf.names should equal
159
164
        # self.pending
160
 
        assert set(new_inventory.versions()) == self.pending
 
165
        assert set(new_inventory_vf.versions()) == self.pending
161
166
        self.pb.update('Writing weave')
162
 
        self.repo.control_weaves.copy(new_inventory, 'inventory', self.repo.get_transaction())
 
167
        self.repo.control_weaves.copy(new_inventory_vf, 'inventory', self.repo.get_transaction())
163
168
        self.repo.control_weaves.delete('inventory.new', self.repo.get_transaction())
164
169
        self.inventory = None
165
170
        self.pb.note('Inventory regenerated.')
258
263
        self.repo.control_weaves.copy(self.inventory, 'inventory.backup', self.transaction)
259
264
        self.pb.note('Backup Inventory created.')
260
265
        # asking for '' should never return a non-empty weave
261
 
        new_inventory = self.repo.control_weaves.get_empty('inventory.new',
 
266
        new_inventory_vf = self.repo.control_weaves.get_empty('inventory.new',
262
267
            self.transaction)
263
268
 
264
269
        # we have topological order of revisions and non ghost parents ready.
266
271
        for rev_id in TopoSorter(self.revisions.get_graph().items()).iter_topo_order():
267
272
            parents = self.revisions.get_parents(rev_id)
268
273
            # double check this really is in topological order.
269
 
            unavailable = [p for p in parents if p not in new_inventory]
 
274
            unavailable = [p for p in parents if p not in new_inventory_vf]
270
275
            assert len(unavailable) == 0
271
276
            # this entry has all the non ghost parents in the inventory
272
277
            # file already.
273
278
            self._reweave_step('adding inventories')
274
279
            # ugly but needed, weaves are just way tooooo slow else.
275
 
            new_inventory.add_lines(rev_id, parents, self.inventory.get_lines(rev_id))
 
280
            new_inventory_vf.add_lines(rev_id, parents, self.inventory.get_lines(rev_id))
276
281
 
277
 
        # if this worked, the set of new_inventory.names should equal
 
282
        # if this worked, the set of new_inventory_vf.names should equal
278
283
        # self.pending
279
 
        assert set(new_inventory.versions()) == set(self.revisions.versions())
 
284
        assert set(new_inventory_vf.versions()) == set(self.revisions.versions())
280
285
        self.pb.update('Writing weave')
281
 
        self.repo.control_weaves.copy(new_inventory, 'inventory', self.transaction)
 
286
        self.repo.control_weaves.copy(new_inventory_vf, 'inventory', self.transaction)
282
287
        self.repo.control_weaves.delete('inventory.new', self.transaction)
283
288
        self.inventory = None
284
289
        self.pb.note('Inventory regenerated.')