549
def test_concurrent_pack_during_autopack(self):
550
tree = self.make_branch_and_tree('tree')
554
tree.commit('rev %d' % (i,))
555
r2 = repository.Repository.open('tree')
558
# Monkey patch so that pack occurs while the other repo is
559
# autopacking. This is slightly bad, but all current pack
560
# repository implementations have a _pack_collection, and we
561
# test that it gets triggered. So if a future format changes
562
# things, the test will fail rather than succeed accidentally.
564
r1 = tree.branch.repository
565
orig = r1._pack_collection.pack_distribution
566
def trigger_during_auto(*args, **kwargs):
567
ret = orig(*args, **kwargs)
568
if not autopack_count[0]:
570
autopack_count[0] += 1
572
r1._pack_collection.pack_distribution = trigger_during_auto
573
tree.commit('autopack-rev')
574
# This triggers 2 autopacks. The first one causes r2.pack() to
575
# fire, but r2 doesn't see the new pack file yet. The
576
# autopack restarts and sees there are 2 files and there
577
# should be only 1 for 10 commits. So it goes ahead and
578
# finishes autopacking.
579
self.assertEqual([2], autopack_count)
549
585
def test_lock_write_does_not_physically_lock(self):
550
586
repo = self.make_repository('.', format=self.get_format())
551
587
repo.lock_write()