30
30
TestCaseWithRepository,
31
31
all_repository_vf_format_scenarios,
33
from bzrlib.tests.matchers import MatchesAncestry
33
34
from bzrlib.tests.scenarios import load_tests_apply_scenarios
34
35
from bzrlib.uncommit import uncommit
195
196
# actual low level test.
196
197
repo = aBzrDir.open_repository()
197
if ([None, 'missing', 'references_missing']
198
!= repo.get_ancestry('references_missing')):
198
if not repo.has_revision('missing'):
199
199
# the repo handles ghosts without corruption, so reconcile has
200
200
# nothing to do here. Specifically, this test has the inventory
201
201
# 'missing' present and the revision 'missing' missing, so clearly
215
215
self.check_missing_was_removed(repo)
216
216
# and the parent list for 'references_missing' should have that
217
217
# revision a ghost now.
218
self.assertEqual([None, 'references_missing'],
219
repo.get_ancestry('references_missing'))
218
self.assertFalse(repo.has_revision('missing'))
221
220
def check_missing_was_removed(self, repo):
222
221
if repo._reconcile_backsup_inventory:
265
264
# now the current inventory should still have 'ghost'
266
265
repo = d.open_repository()
267
266
repo.get_inventory('ghost')
268
self.assertEqual([None, 'ghost'], repo.get_ancestry('ghost'))
267
self.assertThat(['ghost', 'the_ghost'], MatchesAncestry(repo, 'ghost'))
270
269
def test_reweave_inventory_fixes_ancestryfor_a_present_ghost(self):
271
270
d = bzrlib.bzrdir.BzrDir.open(self.get_url('inventory_ghost_present'))
272
271
repo = d.open_repository()
273
ghost_ancestry = repo.get_ancestry('ghost')
274
if ghost_ancestry == [None, 'the_ghost', 'ghost']:
272
m = MatchesAncestry(repo, 'ghost')
273
if m.match(['the_ghost', 'ghost']) is None:
275
274
# the repo handles ghosts without corruption, so reconcile has
278
self.assertEqual([None, 'ghost'], ghost_ancestry)
277
self.assertThat(['ghost'], m)
279
278
reconciler = repo.reconcile()
280
279
# this is a data corrupting error, so a normal reconcile should fix it.
281
280
# one inconsistent parents should have been found : the
287
286
repo = d.open_repository()
288
287
repo.get_inventory('ghost')
289
288
repo.get_inventory('the_ghost')
290
self.assertEqual([None, 'the_ghost', 'ghost'], repo.get_ancestry('ghost'))
291
self.assertEqual([None, 'the_ghost'], repo.get_ancestry('the_ghost'))
289
self.assertThat(['the_ghost', 'ghost'],
290
MatchesAncestry(repo, 'ghost'))
291
self.assertThat(['the_ghost'],
292
MatchesAncestry(repo, 'the_ghost'))
293
294
def test_text_from_ghost_revision(self):
294
295
repo = self.make_repository('text-from-ghost')