557
class TestRepositoryGetGraph(TestRemoteRepository):
559
def test_get_graph(self):
560
# get_graph returns a graph with the repository as the
563
transport_path = 'quack'
564
repo, client = self.setup_fake_client_and_repository(
565
responses, transport_path)
566
graph = repo.get_graph()
567
self.assertEqual(graph._parents_provider, repo)
570
class TestRepositoryGetParentMap(TestRemoteRepository):
572
def test_get_parent_map_caching(self):
573
# get_parent_map returns from cache until unlock()
574
# setup a reponse with two revisions
575
r1 = u'\u0e33'.encode('utf8')
576
r2 = u'\u0dab'.encode('utf8')
577
lines = [' '.join([r2, r1]), r1]
578
encoded_body = '\n'.join(lines)
579
responses = [(('ok', ), encoded_body), (('ok', ), encoded_body)]
581
transport_path = 'quack'
582
repo, client = self.setup_fake_client_and_repository(
583
responses, transport_path)
585
graph = repo.get_graph()
586
parents = graph.get_parent_map([r2])
587
self.assertEqual({r2: (r1,)}, parents)
588
# locking and unlocking deeper should not reset
591
parents = graph.get_parent_map([r1])
592
self.assertEqual({r1: (NULL_REVISION,)}, parents)
594
[('call_expecting_body', 'Repository.get_parent_map',
598
# now we call again, and it should use the second response.
600
graph = repo.get_graph()
601
parents = graph.get_parent_map([r1])
602
self.assertEqual({r1: (NULL_REVISION,)}, parents)
604
[('call_expecting_body', 'Repository.get_parent_map',
606
('call_expecting_body', 'Repository.get_parent_map',
557
613
class TestRepositoryGetRevisionGraph(TestRemoteRepository):
559
615
def test_null_revision(self):