402
def test_concurrent_pack_triggers_reload(self):
403
# create 2 packs, which we will then collapse
404
tree = self.make_branch_and_tree('tree')
407
rev1 = tree.commit('one')
408
rev2 = tree.commit('two')
409
r2 = repository.Repository.open('tree')
412
# Now r2 has read the pack-names file, but will need to reload
413
# it after r1 has repacked
414
tree.branch.repository.pack()
415
self.assertEqual({rev2:(rev1,)}, r2.get_parent_map([rev2]))
398
421
def test_lock_write_does_not_physically_lock(self):
399
422
repo = self.make_repository('.', format=self.get_format())
400
423
repo.lock_write()
608
631
self.assertTrue(large_pack_name in pack_names)
634
class TestSmartServerAutopack(TestCaseWithTransport):
637
super(TestSmartServerAutopack, self).setUp()
638
# Create a smart server that publishes whatever the backing VFS server
640
self.smart_server = server.SmartTCPServer_for_testing()
641
self.smart_server.setUp(self.get_server())
642
self.addCleanup(self.smart_server.tearDown)
643
# Log all HPSS calls into self.hpss_calls.
644
client._SmartClient.hooks.install_named_hook(
645
'call', self.capture_hpss_call, None)
648
def capture_hpss_call(self, params):
649
self.hpss_calls.append(params.method)
651
def get_format(self):
652
return bzrdir.format_registry.make_bzrdir(self.format_name)
654
def test_autopack_rpc_is_used_when_using_hpss(self):
655
# Make local and remote repos
656
tree = self.make_branch_and_tree('local', format=self.get_format())
657
self.make_branch_and_tree('remote', format=self.get_format())
658
remote_branch_url = self.smart_server.get_url() + 'remote'
659
remote_branch = bzrdir.BzrDir.open(remote_branch_url).open_branch()
660
# Make 9 local revisions, and push them one at a time to the remote
661
# repo to produce 9 pack files.
663
tree.commit('commit %s' % x)
664
tree.branch.push(remote_branch)
665
# Make one more push to trigger an autopack
667
tree.commit('commit triggering pack')
668
tree.branch.push(remote_branch)
669
self.assertTrue('PackRepository.autopack' in self.hpss_calls)
611
672
def load_tests(basic_tests, module, test_loader):
612
673
# these give the bzrdir canned format name, and the repository on-disk
631
692
format_supports_external_lookups=True,
632
693
index_class=GraphIndex),
694
dict(format_name='1.9',
695
format_string="Bazaar RepositoryFormatKnitPack6 (bzr 1.9)\n",
696
format_supports_external_lookups=True,
697
index_class=BTreeGraphIndex),
698
dict(format_name='1.9-rich-root',
699
format_string="Bazaar RepositoryFormatKnitPack6RichRoot "
701
format_supports_external_lookups=True,
702
index_class=BTreeGraphIndex),
633
703
dict(format_name='development2',
634
704
format_string="Bazaar development format 2 "
635
705
"(needs bzr.dev from before 1.8)\n",