Mercurial > public > mercurial-scm > hg
diff rust/hg-cpython/src/dirstate/non_normal_entries.rs @ 47094:e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Instead of exposing `HashSet`s directly, have slightly higher-level
methods for the operations that Python bindings need on them.
Differential Revision: https://phab.mercurial-scm.org/D10363
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 08 Apr 2021 14:58:44 +0200 |
parents | 26114bd6ec60 |
children | cd8ca38fccff |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/non_normal_entries.rs Tue Mar 30 14:15:23 2021 +0200 +++ b/rust/hg-cpython/src/dirstate/non_normal_entries.rs Thu Apr 08 14:58:44 2021 +0200 @@ -7,14 +7,13 @@ use cpython::{ exc::NotImplementedError, CompareOp, ObjectProtocol, PyBytes, PyClone, - PyErr, PyList, PyObject, PyResult, PyString, Python, PythonObject, - ToPyObject, UnsafePyLeaked, + PyErr, PyObject, PyResult, PyString, Python, PythonObject, ToPyObject, + UnsafePyLeaked, }; use crate::dirstate::DirstateMap; use hg::utils::hg_path::HgPathBuf; use std::cell::RefCell; -use std::collections::hash_set; py_class!(pub class NonNormalEntries |py| { data dmap: DirstateMap; @@ -25,9 +24,6 @@ def remove(&self, key: PyObject) -> PyResult<PyObject> { self.dmap(py).non_normal_entries_remove(py, key) } - def union(&self, other: PyObject) -> PyResult<PyList> { - self.dmap(py).non_normal_entries_union(py, other) - } def __richcmp__(&self, other: PyObject, op: CompareOp) -> PyResult<bool> { match op { CompareOp::Eq => self.is_equal_to(py, other), @@ -66,7 +62,8 @@ } } -type NonNormalEntriesIter<'a> = hash_set::Iter<'a, HgPathBuf>; +type NonNormalEntriesIter<'a> = + Box<dyn Iterator<Item = &'a HgPathBuf> + Send + 'a>; py_shared_iterator!( NonNormalEntriesIterator,