diff -r 3bf6979a1785 -r 006c9ce486fa tests/test-rust-ancestor.py --- a/tests/test-rust-ancestor.py Wed Jan 09 17:31:36 2019 +0100 +++ b/tests/test-rust-ancestor.py Fri Nov 30 20:05:34 2018 +0100 @@ -11,7 +11,8 @@ # this would fail already without appropriate ancestor.__package__ from mercurial.rustext.ancestor import ( AncestorsIterator, - LazyAncestors + LazyAncestors, + MissingAncestors, ) try: @@ -105,6 +106,22 @@ # let's check bool for an empty one self.assertFalse(LazyAncestors(idx, [0], 0, False)) + def testmissingancestors(self): + idx = self.parseindex() + missanc = MissingAncestors(idx, [1]) + self.assertTrue(missanc.hasbases()) + self.assertEqual(missanc.missingancestors([3]), [2, 3]) + missanc.addbases({2}) + self.assertEqual(set(missanc.bases()), {1, 2}) + self.assertEqual(missanc.missingancestors([3]), [3]) + + def testmissingancestorsremove(self): + idx = self.parseindex() + missanc = MissingAncestors(idx, [1]) + revs = {0, 1, 2, 3} + missanc.removeancestorsfrom(revs) + self.assertEqual(revs, {2, 3}) + def testrefcount(self): idx = self.parseindex() start_count = sys.getrefcount(idx)