def test_convenience_reconcile_inventory_without_revision_reconcile(self): # smoke test for the all in one ui tool bzrdir_url = self.get_url('inventory_without_revision') bzrdir = bzrlib.bzrdir.BzrDir.open(bzrdir_url) repo = bzrdir.open_repository() if not repo._reconcile_does_inventory_gc: raise TestSkipped('Irrelevant test') reconcile(bzrdir) # now the backup should have it but not the current inventory repo = bzrdir.open_repository() self.check_missing_was_removed(repo)
def check_thorough_reweave_missing_revision(self, aBzrDir, reconcile, **kwargs): # actual low level test. repo = aBzrDir.open_repository() if ([None, 'missing', 'references_missing'] != repo.get_ancestry('references_missing')): # the repo handles ghosts without corruption, so reconcile has # nothing to do here. Specifically, this test has the inventory # 'missing' present and the revision 'missing' missing, so clearly # 'missing' cannot be reported in the present ancestry -> missing # is something that can be filled as a ghost. expected_inconsistent_parents = 0 else: expected_inconsistent_parents = 1 reconciler = reconcile(**kwargs) # some number of inconsistent parents should have been found self.assertEqual(expected_inconsistent_parents, reconciler.inconsistent_parents) # and one garbage inventories self.assertEqual(1, reconciler.garbage_inventories) # now the backup should have it but not the current inventory repo = aBzrDir.open_repository() self.check_missing_was_removed(repo) # and the parent list for 'references_missing' should have that # revision a ghost now. self.assertEqual([None, 'references_missing'], repo.get_ancestry('references_missing'))
def test_reweave_empty(self): # we want a repo capable format parent = bzrdir.BzrDirMetaFormat1().initialize('.') parent.create_repository(shared=True) parent.root_transport.mkdir('child') child = bzrdir.BzrDirMetaFormat1().initialize('child') self.assertRaises(errors.NoRepositoryPresent, child.open_repository) reconciler = Reconciler(child) reconciler.reconcile() # smoke test for reconcile appears to work too. reconcile(child) # no inconsistent parents should have been found # but the values should have been set. self.assertEqual(0, reconciler.inconsistent_parents) # and no garbage inventories self.assertEqual(0, reconciler.garbage_inventories)