##// END OF EJS Templates
rust-dirstatemap: use `&HgPath` instead of `HgPathBuf` in `copy_map_insert`...
Raphaël Gomès -
r50015:d9a66d62 default
parent child Browse files
Show More
@@ -1284,8 +1284,8 b' impl OwningDirstateMap {'
1284
1284
1285 pub fn copy_map_insert(
1285 pub fn copy_map_insert(
1286 &mut self,
1286 &mut self,
1287 key: HgPathBuf,
1287 key: &HgPath,
1288 value: HgPathBuf,
1288 value: &HgPath,
1289 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> {
1289 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> {
1290 self.with_dmap_mut(|map| {
1290 self.with_dmap_mut(|map| {
1291 let node = DirstateMap::get_or_insert_node(
1291 let node = DirstateMap::get_or_insert_node(
@@ -1299,7 +1299,10 b' impl OwningDirstateMap {'
1299 if node.copy_source.is_none() {
1299 if node.copy_source.is_none() {
1300 map.nodes_with_copy_source_count += 1
1300 map.nodes_with_copy_source_count += 1
1301 }
1301 }
1302 Ok(node.copy_source.replace(value.into()).map(Cow::into_owned))
1302 Ok(node
1303 .copy_source
1304 .replace(value.to_owned().into())
1305 .map(Cow::into_owned))
1303 })
1306 })
1304 }
1307 }
1305
1308
@@ -23,13 +23,10 b' use crate::{'
23 pybytes_deref::PyBytesDeref,
23 pybytes_deref::PyBytesDeref,
24 };
24 };
25 use hg::{
25 use hg::{
26 dirstate::StateMapIter,
26 dirstate::StateMapIter, dirstate_tree::on_disk::DirstateV2ParseError,
27 dirstate_tree::on_disk::DirstateV2ParseError,
27 dirstate_tree::owning::OwningDirstateMap, revlog::Node,
28 dirstate_tree::owning::OwningDirstateMap,
28 utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry,
29 revlog::Node,
29 DirstateError, DirstateParents, EntryState,
30 utils::files::normalize_case,
31 utils::hg_path::{HgPath, HgPathBuf},
32 DirstateEntry, DirstateError, DirstateParents, EntryState,
33 };
30 };
34
31
35 // TODO
32 // TODO
@@ -411,8 +408,8 b' py_class!(pub class DirstateMap |py| {'
411 self.inner(py)
408 self.inner(py)
412 .borrow_mut()
409 .borrow_mut()
413 .copy_map_insert(
410 .copy_map_insert(
414 HgPathBuf::from_bytes(key.data(py)),
411 HgPath::new(key.data(py)),
415 HgPathBuf::from_bytes(value.data(py)),
412 HgPath::new(value.data(py)),
416 )
413 )
417 .map_err(|e| v2_error(py, e))?;
414 .map_err(|e| v2_error(py, e))?;
418 Ok(py.None())
415 Ok(py.None())
General Comments 0
You need to be logged in to leave comments. Login now