comparison tests/test-rust-ancestor.py @ 41694:0c7b353ce100

rust-cpython: binding for headrevs() This uses the core `dagops::retain_heads` to give a Rust implementation to `mercurial.dagop.headrevs`. Testing happens for now from `test-rust-ancestors.py` (for quick and minimal change), but it'd made more sense to put the binary index data elsewhere and to create a new test python module
author Georges Racinet <georges.racinet@octobus.net>
date Thu, 10 Jan 2019 18:25:18 +0100
parents ab0d762d89ef
children 2372284d9457
comparison
equal deleted inserted replaced
41693:060c030c9993 41694:0c7b353ce100
17 from mercurial.rustext.ancestor import ( 17 from mercurial.rustext.ancestor import (
18 AncestorsIterator, 18 AncestorsIterator,
19 LazyAncestors, 19 LazyAncestors,
20 MissingAncestors, 20 MissingAncestors,
21 ) 21 )
22 from mercurial.rustext import dagop
22 23
23 try: 24 try:
24 from mercurial.cext import parsers as cparsers 25 from mercurial.cext import parsers as cparsers
25 except ImportError: 26 except ImportError:
26 cparsers = None 27 cparsers = None
163 # WdirUnsupported directly 164 # WdirUnsupported directly
164 idx = self.parseindex() 165 idx = self.parseindex()
165 with self.assertRaises(error.WdirUnsupported): 166 with self.assertRaises(error.WdirUnsupported):
166 list(AncestorsIterator(idx, [node.wdirrev], -1, False)) 167 list(AncestorsIterator(idx, [node.wdirrev], -1, False))
167 168
169 def testheadrevs(self):
170 idx = self.parseindex()
171 self.assertEqual(dagop.headrevs(idx, [1, 2, 3]), {3})
172
168 if __name__ == '__main__': 173 if __name__ == '__main__':
169 import silenttestrunner 174 import silenttestrunner
170 silenttestrunner.main(__name__) 175 silenttestrunner.main(__name__)