1724
1725
request.execute('stacked', 1, (3, r3)))
1728
class TestSmartServerRepositoryIterRevisions(
1729
tests.TestCaseWithMemoryTransport):
1731
def test_basic(self):
1732
backing = self.get_transport()
1733
request = smart_repo.SmartServerRepositoryIterRevisions(backing)
1734
tree = self.make_branch_and_memory_tree('.', format='2a')
1737
tree.commit('1st commit', rev_id="rev1")
1738
tree.commit('2nd commit', rev_id="rev2")
1741
self.assertIs(None, request.execute(''))
1742
response = request.do_body("rev1\nrev2")
1743
self.assertTrue(response.is_successful())
1744
# Format 2a uses serializer format 10
1745
self.assertEquals(response.args, ("ok", "10"))
1747
self.addCleanup(tree.branch.lock_read().unlock)
1748
entries = [zlib.compress(record.get_bytes_as("fulltext")) for record in
1749
tree.branch.repository.revisions.get_record_stream(
1750
[("rev1", ), ("rev2", )], "unordered", True)]
1752
contents = "".join(response.body_stream)
1753
self.assertTrue(contents in (
1754
"".join([entries[0], entries[1]]),
1755
"".join([entries[1], entries[0]])))
1757
def test_missing(self):
1758
backing = self.get_transport()
1759
request = smart_repo.SmartServerRepositoryIterRevisions(backing)
1760
tree = self.make_branch_and_memory_tree('.', format='2a')
1762
self.assertIs(None, request.execute(''))
1763
response = request.do_body("rev1\nrev2")
1764
self.assertTrue(response.is_successful())
1765
# Format 2a uses serializer format 10
1766
self.assertEquals(response.args, ("ok", "10"))
1768
contents = "".join(response.body_stream)
1769
self.assertEquals(contents, "")
1727
1772
class GetStreamTestBase(tests.TestCaseWithMemoryTransport):
1729
1774
def make_two_commit_repo(self):
2390
2435
smart_repo.SmartServerRepositoryGetStream)
2391
2436
self.assertHandlerEqual('Repository.get_stream_1.19',
2392
2437
smart_repo.SmartServerRepositoryGetStream_1_19)
2438
self.assertHandlerEqual('Repository.iter_revisions',
2439
smart_repo.SmartServerRepositoryIterRevisions)
2393
2440
self.assertHandlerEqual('Repository.has_revision',
2394
2441
smart_repo.SmartServerRequestHasRevision)
2395
2442
self.assertHandlerEqual('Repository.insert_stream',