30
from bzrlib.symbol_versioning import deprecated_in
31
from bzrlib.tests.matchers import MatchesAncestry
30
32
from bzrlib.tests.per_repository_vf import (
31
33
TestCaseWithRepository,
32
34
all_repository_vf_format_scenarios,
384
386
def test_get_ancestry_missing_revision(self):
385
387
# get_ancestry(revision that is in some data but not fully installed
386
388
# -> NoSuchRevision
389
repo = self.bzrdir.open_repository()
387
390
self.assertRaises(errors.NoSuchRevision,
388
self.bzrdir.open_repository().get_ancestry, 'orphan')
391
self.applyDeprecated, deprecated_in((2, 4, 0)),
392
repo.get_ancestry, 'orphan')
390
394
def test_get_unordered_ancestry(self):
391
395
repo = self.bzrdir.open_repository()
392
self.assertEqual(set(repo.get_ancestry('rev3')),
393
set(repo.get_ancestry('rev3', topo_sorted=False)))
397
set(self.applyDeprecated(deprecated_in((2, 4, 0)),
398
repo.get_ancestry, 'rev3')),
399
set(self.applyDeprecated(deprecated_in((2, 4, 0)),
400
repo.get_ancestry, 'rev3', topo_sorted=False)))
395
402
def test_reserved_id(self):
396
403
repo = self.make_repository('repository')
457
464
def test_corrupt_revision_access_asserts_if_reported_wrong(self):
458
465
repo_url = self.get_url('inventory_with_unnecessary_ghost')
459
466
repo = _mod_repository.Repository.open(repo_url)
467
m = MatchesAncestry(repo, 'ghost')
460
468
reported_wrong = False
462
if repo.get_ancestry('ghost') != [None, 'the_ghost', 'ghost']:
470
if m.match(['the_ghost', 'ghost']) is not None:
463
471
reported_wrong = True
464
472
except errors.CorruptRepository:
465
473
# caught the bad data: