As previously done with the ancestors submodule, testing for
the bindings is provided from Python on a trivial case.
Details
- Reviewers
kevincox - Group Reviewers
hg-reviewers - Commits
- rHG13b64247f48f: rust-discovery: cpython bindings for the core logic
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
tests/test-rust-discovery.py | ||
---|---|---|
40 | This is also exactly the same binary data I'm using in test-rust-ancestors.py. I'd prefer to mutualize them, but I'm not sure what the preferred pattern would be:
with open(os.path.join(os.path.dirname(__file__), 'index_data.bin', 'rb')) as indexf): ...
from .index_data import non_inlined
what would be the more inline with common practices within the Mercurial project ? |
+ def addinfo(&self, sample: PyObject) -> PyResult<PyObject> {
+ let mut missing: Vec<Revision> = Vec::new();
+ let mut common: Vec<Revision> = Vec::new();
+ for info in sample.iter(py)? { // info is a pair (Revision, bool)
+ let mut revknown = info?.iter(py)?;
+ let rev: Revision = revknown.next().unwrap()?.extract(py)?;
+ let known: bool = revknown.next().unwrap()?.extract(py)?;
Just to confirm. Can we be sure that this unwrap() never fails? I mean if
we passed in an empty tuple for example, what would happen?
This is also exactly the same binary data I'm using in test-rust-ancestors.py. I'd prefer to mutualize them, but I'm not sure what the preferred pattern would be:
` from .index_data import parseindex `
what would be the more inline with common practices within the Mercurial project ?