Mercurial > hg-stable
changeset 42752:5154701a5413
rust-discovery: accept the new 'respectsize' init arg
At this stage, we don't do anything about it: it will be meaningful
in sampling methods that aren't implemented yet.
Differential Revision: https://phab.mercurial-scm.org/D6516
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Wed, 12 Jun 2019 14:18:12 +0100 |
parents | 7013c7ce987f |
children | b6f3f704a561 |
files | rust/hg-cpython/src/discovery.rs tests/test-rust-discovery.py |
diffstat | 2 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-cpython/src/discovery.rs Wed Aug 14 09:22:54 2019 +0900 +++ b/rust/hg-cpython/src/discovery.rs Wed Jun 12 14:18:12 2019 +0100 @@ -29,10 +29,14 @@ py_class!(pub class PartialDiscovery |py| { data inner: RefCell<Box<CorePartialDiscovery<Index>>>; + // `_respectsize` is currently only here to replicate the Python API and + // will be used in future patches inside methods that are yet to be + // implemented. def __new__( _cls, index: PyObject, - targetheads: PyObject + targetheads: PyObject, + _respectsize: bool ) -> PyResult<PartialDiscovery> { Self::create_instance( py,
--- a/tests/test-rust-discovery.py Wed Aug 14 09:22:54 2019 +0900 +++ b/tests/test-rust-discovery.py Wed Jun 12 14:18:12 2019 +0100 @@ -61,7 +61,7 @@ def testaddcommonsmissings(self): idx = self.parseindex() - disco = PartialDiscovery(idx, [3]) + disco = PartialDiscovery(idx, [3], True) self.assertFalse(disco.hasinfo()) self.assertFalse(disco.iscomplete()) @@ -77,7 +77,7 @@ def testaddmissingsstats(self): idx = self.parseindex() - disco = PartialDiscovery(idx, [3]) + disco = PartialDiscovery(idx, [3], True) self.assertIsNone(disco.stats()['undecided'], None) disco.addmissings([2]) @@ -85,7 +85,7 @@ def testaddinfocommonfirst(self): idx = self.parseindex() - disco = PartialDiscovery(idx, [3]) + disco = PartialDiscovery(idx, [3], True) disco.addinfo([(1, True), (2, False)]) self.assertTrue(disco.hasinfo()) self.assertTrue(disco.iscomplete()) @@ -93,7 +93,7 @@ def testaddinfomissingfirst(self): idx = self.parseindex() - disco = PartialDiscovery(idx, [3]) + disco = PartialDiscovery(idx, [3], True) disco.addinfo([(2, False), (1, True)]) self.assertTrue(disco.hasinfo()) self.assertTrue(disco.iscomplete())