From patchwork Tue Jul 23 09:14:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6516: rust-discovery: accept the new 'respectsize' init arg From: phabricator X-Patchwork-Id: 41015 Message-Id: <6b9c482fce83141710768e8328fdb769@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 23 Jul 2019 09:14:49 +0000 Alphare updated this revision to Diff 16010. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6516?vs=15931&id=16010 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6516/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6516 AFFECTED FILES rust/hg-cpython/src/discovery.rs tests/test-rust-discovery.py CHANGE DETAILS To: gracinet, #hg-reviewers, kevincox Cc: Alphare, durin42, kevincox, mercurial-devel diff --git a/tests/test-rust-discovery.py b/tests/test-rust-discovery.py --- a/tests/test-rust-discovery.py +++ b/tests/test-rust-discovery.py @@ -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()) diff --git a/rust/hg-cpython/src/discovery.rs b/rust/hg-cpython/src/discovery.rs --- a/rust/hg-cpython/src/discovery.rs +++ b/rust/hg-cpython/src/discovery.rs @@ -29,10 +29,14 @@ py_class!(pub class PartialDiscovery |py| { data inner: RefCell>>; + // `_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 { Self::create_instance( py,