13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
"""Reconcilers are able to fix some potential data errors in a branch."""
213
213
# local because needing to know about WeaveFile is a wart we want to hide
214
214
from bzrlib.weave import WeaveFile, Weave
215
215
transaction = self.repo.get_transaction()
216
self.pb.update('Reading inventory data')
216
self.pb.update('Reading inventory data.')
217
217
self.inventory = self.repo.inventories
218
218
self.revisions = self.repo.revisions
219
219
# the total set of revisions to process
235
235
(not self.garbage_inventories or not self.thorough)):
236
236
self.pb.note('Inventory ok.')
238
self.pb.update('Backing up inventory', 0, 0)
238
self.pb.update('Backing up inventory...', 0, 0)
239
239
self.repo._backup_inventory()
240
self.pb.note('Backup inventory created.')
240
self.pb.note('Backup Inventory created.')
241
241
new_inventories = self.repo._temp_inventories()
243
243
# we have topological order of revisions and non ghost parents ready.
351
351
def _load_indexes(self):
352
352
"""Load indexes for the reconciliation."""
353
353
self.transaction = self.repo.get_transaction()
354
self.pb.update('Reading indexes', 0, 2)
354
self.pb.update('Reading indexes.', 0, 2)
355
355
self.inventory = self.repo.inventories
356
self.pb.update('Reading indexes', 1, 2)
356
self.pb.update('Reading indexes.', 1, 2)
357
357
self.repo._check_for_inconsistent_revision_parents()
358
358
self.revisions = self.repo.revisions
359
self.pb.update('Reading indexes', 2, 2)
359
self.pb.update('Reading indexes.', 2, 2)
361
361
def _gc_inventory(self):
362
362
"""Remove inventories that are not referenced from the revision store."""
363
self.pb.update('Checking unused inventories', 0, 1)
363
self.pb.update('Checking unused inventories.', 0, 1)
364
364
self._check_garbage_inventories()
365
self.pb.update('Checking unused inventories', 1, 3)
365
self.pb.update('Checking unused inventories.', 1, 3)
366
366
if not self.garbage_inventories:
367
367
self.pb.note('Inventory ok.')
369
self.pb.update('Backing up inventory', 0, 0)
369
self.pb.update('Backing up inventory...', 0, 0)
370
370
self.repo._backup_inventory()
371
self.pb.note('Backup Inventory created')
371
self.pb.note('Backup Inventory created.')
372
372
# asking for '' should never return a non-empty weave
373
373
new_inventories = self.repo._temp_inventories()
374
374
# we have topological order of revisions and non ghost parents ready.
505
505
total_inventories = len(list(
506
506
collection.inventory_index.combined_index.iter_all_entries()))
507
507
if len(all_revisions):
508
new_pack = self.repo._reconcile_pack(collection, packs,
509
".reconcile", all_revisions, self.pb)
508
self._packer = repofmt.pack_repo.ReconcilePacker(
509
collection, packs, ".reconcile", all_revisions)
510
new_pack = self._packer.pack(pb=self.pb)
510
511
if new_pack is not None:
511
512
self._discard_and_save(packs)