equal
deleted
inserted
replaced
28 from ..cext import parsers as cparsers # pytype: disable=import-error |
28 from ..cext import parsers as cparsers # pytype: disable=import-error |
29 except ImportError: |
29 except ImportError: |
30 cparsers = None |
30 cparsers = None |
31 |
31 |
32 try: |
32 try: |
33 from ..rustext.revlog import MixedIndex # pytype: disable=import-error |
33 from ..rustext.revlog import ( # pytype: disable=import-error |
|
34 Index as RustIndex, |
|
35 ) |
34 except ImportError: |
36 except ImportError: |
35 MixedIndex = None |
37 RustIndex = None |
36 |
38 |
37 |
39 |
38 @unittest.skipIf( |
40 @unittest.skipIf( |
39 cparsers is None, |
41 cparsers is None, |
40 'The C version of the "parsers" module is not available. It is needed for this test.', |
42 'The C version of the "parsers" module is not available. It is needed for this test.', |
45 data = data_non_inlined |
47 data = data_non_inlined |
46 return cparsers.parse_index2(data, False)[0] |
48 return cparsers.parse_index2(data, False)[0] |
47 |
49 |
48 |
50 |
49 @unittest.skipIf( |
51 @unittest.skipIf( |
50 MixedIndex is None, |
52 RustIndex is None, |
51 'The Rust index is not available. It is needed for this test.', |
53 'The Rust index is not available. It is needed for this test.', |
52 ) |
54 ) |
53 class RustRevlogBasedTestBase(unittest.TestCase): |
55 class RustRevlogBasedTestBase(unittest.TestCase): |
54 def parserustindex(self, data=None): |
56 def parserustindex(self, data=None): |
55 if data is None: |
57 if data is None: |
56 data = data_non_inlined |
58 data = data_non_inlined |
57 # not inheriting RevlogBasedTestCase to avoid having a |
59 # not inheriting RevlogBasedTestCase to avoid having a |
58 # `parseindex` method that would be shadowed by future subclasses |
60 # `parseindex` method that would be shadowed by future subclasses |
59 # this duplication will soon be removed |
61 # this duplication will soon be removed |
60 return MixedIndex(data, REVLOGV1) |
62 return RustIndex(data, REVLOGV1) |