/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack_repository.py

  • Committer: Aaron Bentley
  • Date: 2008-12-03 04:23:21 UTC
  • mfrom: (3878 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3892.
  • Revision ID: aaron@aaronbentley.com-20081203042321-kr5k4mdhmdvl3553
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
420
420
        finally:
421
421
            tree.unlock()
422
422
 
 
423
    def test_concurrent_pack_during_get_record_reloads(self):
 
424
        tree = self.make_branch_and_tree('tree')
 
425
        tree.lock_write()
 
426
        try:
 
427
            rev1 = tree.commit('one')
 
428
            rev2 = tree.commit('two')
 
429
            keys = [(rev1,), (rev2,)]
 
430
            r2 = repository.Repository.open('tree')
 
431
            r2.lock_read()
 
432
            try:
 
433
                # At this point, we will start grabbing a record stream, and
 
434
                # trigger a repack mid-way
 
435
                packed = False
 
436
                result = {}
 
437
                record_stream = r2.revisions.get_record_stream(keys,
 
438
                                    'unordered', False)
 
439
                for record in record_stream:
 
440
                    result[record.key] = record
 
441
                    if not packed:
 
442
                        tree.branch.repository.pack()
 
443
                        packed = True
 
444
                # The first record will be found in the original location, but
 
445
                # after the pack, we have to reload to find the next record
 
446
                self.assertEqual(sorted(keys), sorted(result.keys()))
 
447
            finally:
 
448
                r2.unlock()
 
449
        finally:
 
450
            tree.unlock()
 
451
 
423
452
    def test_lock_write_does_not_physically_lock(self):
424
453
        repo = self.make_repository('.', format=self.get_format())
425
454
        repo.lock_write()