D6633: rust-dirstate: rust-cpython bridge for dirstatemap

Yuya Nishihara yuya at tcha.org
Sat Aug 17 06:47:44 UTC 2019


> +    def getdirs(&self) -> PyResult<Dirs> {
> +        // TODO don't copy, share the reference
> +        self.inner(py).borrow_mut().set_dirs();
> +        Dirs::from_inner(
> +            py,
> +            DirsMultiset::new(
> +                DirsIterable::Dirstate(&self.inner(py).borrow()),
> +                Some(EntryState::Removed),
> +            ),
> +        )
> +    }
> +    def getalldirs(&self) -> PyResult<Dirs> {
> +        // TODO don't copy, share the reference
> +        self.inner(py).borrow_mut().set_all_dirs();
> +        Dirs::from_inner(
> +            py,
> +            DirsMultiset::new(
> +                DirsIterable::Dirstate(&self.inner(py).borrow()),
> +                None,
> +            ),
> +        )
> +    }

How do these set_dirs/set_all_dirs work? IIUC, the return value is built
from state_map.



More information about the Mercurial-devel mailing list