Example #1
0
 def test_ordered_fulltext_simple(self):
     self.make_simple_split()
     # This is a common case in asking to annotate a file that exists on a
     # stacked branch.
     # See https://bugs.launchpad.net/bzr/+bug/393366
     # Topological ordering allows B & C and D & E to be returned with
     # either one first, so the required ordering is:
     # [A (B C) D F]
     keys = [(b'f-id', int2byte(r)) for r in bytearray(b'ABCDF')]
     alt_1 = [(b'f-id', int2byte(r)) for r in bytearray(b'ACBDF')]
     self.stacked_repo.lock_read()
     self.addCleanup(self.stacked_repo.unlock)
     stream = self.stacked_repo.texts.get_record_stream(
         keys, 'topological', True)
     record_keys = []
     for record in stream:
         if record.storage_kind == 'absent':
             raise ValueError('absent record: %s' % (record.key, ))
         record_keys.append(record.key)
     self.assertIn(record_keys, (keys, alt_1))
Example #2
0
 def test_unordered_fetch_complex_split(self):
     self.make_complex_split()
     keys = [(b'f-id', int2byte(r)) for r in bytearray(b'ABCDEG')]
     self.stacked_repo.lock_read()
     self.addCleanup(self.stacked_repo.unlock)
     stream = self.stacked_repo.texts.get_record_stream(
         keys, 'unordered', False)
     record_keys = set()
     for record in stream:
         if record.storage_kind == 'absent':
             raise ValueError('absent record: %s' % (record.key, ))
         record_keys.add(record.key)
     # everything should be present, we don't care about the order
     self.assertEqual(keys, sorted(record_keys))
Example #3
0
 def test_ordered_no_closure(self):
     self.make_complex_split()
     # Topological ordering allows B & C and D & E to be returned with
     # either one first, so the required ordering is:
     # [A (B C) (D E) G]
     #
     # or, because E can be returned before B:
     #
     # A C E B D G
     keys = [(b'f-id', int2byte(r)) for r in bytearray(b'ABCDEG')]
     alt_1 = [(b'f-id', int2byte(r)) for r in bytearray(b'ACBDEG')]
     alt_2 = [(b'f-id', int2byte(r)) for r in bytearray(b'ABCEDG')]
     alt_3 = [(b'f-id', int2byte(r)) for r in bytearray(b'ACBEDG')]
     alt_4 = [(b'f-id', int2byte(r)) for r in bytearray(b'ACEBDG')]
     self.stacked_repo.lock_read()
     self.addCleanup(self.stacked_repo.unlock)
     stream = self.stacked_repo.texts.get_record_stream(
         keys, 'topological', False)
     record_keys = []
     for record in stream:
         if record.storage_kind == 'absent':
             raise ValueError('absent record: %s' % (record.key, ))
         record_keys.append(record.key)
     self.assertIn(record_keys, (keys, alt_1, alt_2, alt_3, alt_4))