##// END OF EJS Templates
issue6528: add a config option to control the fixing on the fly...
issue6528: add a config option to control the fixing on the fly This will allow people who know to be safe to avoid any performance overhead (and other potential issue). Differential Revision: https://phab.mercurial-scm.org/D11271

File last commit:

r46554:89a2afe3 default
r48630:2813d406 5.9rc1 stable
Show More
test-rust-revlog.py
61 lines | 1.9 KiB | text/x-python | PythonLexer
/ tests / test-rust-revlog.py
Georges Racinet
rust-index: add a struct wrapping the C index...
r44413 from __future__ import absolute_import
import unittest
try:
from mercurial import rustext
rustext.__name__ # trigger immediate actual import
except ImportError:
rustext = None
else:
from mercurial.rustext import revlog
rust-index: handle `MixedIndex` in `pyindex_to_graph`...
r44463 # this would fail already without appropriate ancestor.__package__
from mercurial.rustext.ancestor import LazyAncestors
Georges Racinet
rust-index: add a struct wrapping the C index...
r44413 from mercurial.testing import revlog as revlogtesting
@unittest.skipIf(
Augie Fackler
formating: upgrade to black 20.8b1...
r46554 rustext is None,
"rustext module revlog relies on is not available",
Georges Racinet
rust-index: add a struct wrapping the C index...
r44413 )
class RustRevlogIndexTest(revlogtesting.RevlogBasedTestBase):
def test_heads(self):
idx = self.parseindex()
rustidx = revlog.MixedIndex(idx)
self.assertEqual(rustidx.headrevs(), idx.headrevs())
Georges Racinet
rust-index: expose a method to retrieve the C index...
r44464 def test_get_cindex(self):
# drop me once we no longer need the method for shortest node
idx = self.parseindex()
rustidx = revlog.MixedIndex(idx)
cidx = rustidx.get_cindex()
self.assertTrue(idx is cidx)
Georges Racinet
rust-index: add a struct wrapping the C index...
r44413 def test_len(self):
idx = self.parseindex()
rustidx = revlog.MixedIndex(idx)
self.assertEqual(len(rustidx), len(idx))
rust-index: handle `MixedIndex` in `pyindex_to_graph`...
r44463 def test_ancestors(self):
idx = self.parseindex()
rustidx = revlog.MixedIndex(idx)
lazy = LazyAncestors(rustidx, [3], 0, True)
# we have two more references to the index:
# - in its inner iterator for __contains__ and __bool__
# - in the LazyAncestors instance itself (to spawn new iterators)
self.assertTrue(2 in lazy)
self.assertTrue(bool(lazy))
self.assertEqual(list(lazy), [3, 2, 1, 0])
# a second time to validate that we spawn new iterators
self.assertEqual(list(lazy), [3, 2, 1, 0])
# let's check bool for an empty one
self.assertFalse(LazyAncestors(idx, [0], 0, False))
Georges Racinet
rust-index: add a struct wrapping the C index...
r44413
if __name__ == '__main__':
import silenttestrunner
silenttestrunner.main(__name__)