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