use crate::error::Error;
use crate::tree::Path;
use pyo3::prelude::*;
pub trait MutableInventoryTree: crate::tree::PyMutableTree {
fn add(&self, paths: &[&Path], file_ids: &[crate::bazaar::FileId]) -> Result<(), Error> {
Python::attach(|py| {
self.to_object(py).call_method1(
py,
"add",
(
paths
.iter()
.map(|p| p.to_string_lossy().to_string())
.collect::<Vec<_>>(),
file_ids.to_vec(),
),
)
})
.map_err(|e| e.into())
.map(|_| ())
}
}
impl MutableInventoryTree for crate::workingtree::GenericWorkingTree {}