rust/hg-core/src/dirstate_tree/dirstate_map.rs
changeset 49124 d9a66d62c604
parent 49123 afe60def963d
child 49125 28a6178a07a2
equal deleted inserted replaced
49123:afe60def963d 49124:d9a66d62c604
  1282         })
  1282         })
  1283     }
  1283     }
  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(
  1292                 map.on_disk,
  1292                 map.on_disk,
  1293                 &mut map.unreachable_bytes,
  1293                 &mut map.unreachable_bytes,
  1297                 |_ancestor| {},
  1297                 |_ancestor| {},
  1298             )?;
  1298             )?;
  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 
  1306     pub fn len(&self) -> usize {
  1309     pub fn len(&self) -> usize {
  1307         let map = self.get_map();
  1310         let map = self.get_map();