/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 breezy/git/tests/test_transportgit.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-10-13 15:20:48 UTC
  • mfrom: (7131.2.2 packs-file)
  • Revision ID: breezy.the.bot@gmail.com-20181013152048-46569ct6orlhhkhn
Only read the .git/objects/info/packs file if the packs file isn't listable.

Merged from https://code.launchpad.net/~jelmer/brz/packs-file/+merge/356198

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        PackBasedObjectStoreTests.tearDown(self)
38
38
        TestCaseWithTransport.tearDown(self)
39
39
 
 
40
    def test_prefers_pack_listdir(self):
 
41
        self.store.add_object(make_object(Blob, data=b"data"))
 
42
        self.assertEqual(0, len(self.store.packs))
 
43
        self.store.pack_loose_objects()
 
44
        self.assertEqual(1, len(self.store.packs))
 
45
        packname = list(self.store.packs)[0].name()
 
46
        self.assertEqual({'pack-%s.pack' % packname.decode('ascii'), 'pack-%s.idx' % packname.decode('ascii')},
 
47
                         set(self.store._pack_names()))
 
48
        self.store.transport.put_bytes_non_atomic('info/packs',
 
49
                b'P foo-pack.pack\n')
 
50
        self.assertEqual({'pack-%s.pack' % packname.decode('ascii'), 'pack-%s.idx' % packname.decode('ascii')},
 
51
                         set(self.store._pack_names()))
 
52
 
40
53
    def test_remembers_packs(self):
41
54
        self.store.add_object(make_object(Blob, data=b"data"))
42
55
        self.assertEqual(0, len(self.store.packs))