equal
deleted
inserted
replaced
1373 }) |
1373 }) |
1374 }, |
1374 }, |
1375 ))) |
1375 ))) |
1376 } |
1376 } |
1377 |
1377 |
|
1378 /// Only public because it needs to be exposed to the Python layer. |
|
1379 /// It is not the full `setparents` logic, only the parts that mutate the |
|
1380 /// entries. |
|
1381 pub fn setparents_fixup( |
|
1382 &mut self, |
|
1383 ) -> Result<Vec<(HgPathBuf, HgPathBuf)>, DirstateV2ParseError> { |
|
1384 // XXX |
|
1385 // All the copying and re-querying is quite inefficient, but this is |
|
1386 // still a lot better than doing it from Python. |
|
1387 // |
|
1388 // The better solution is to develop a mechanism for `iter_mut`, |
|
1389 // which will be a lot more involved: we're dealing with a lazy, |
|
1390 // append-mostly, tree-like data structure. This will do for now. |
|
1391 let mut copies = vec![]; |
|
1392 let mut files_with_p2_info = vec![]; |
|
1393 for res in self.iter() { |
|
1394 let (path, entry) = res?; |
|
1395 if entry.p2_info() { |
|
1396 files_with_p2_info.push(path.to_owned()) |
|
1397 } |
|
1398 } |
|
1399 self.with_dmap_mut(|map| { |
|
1400 for path in files_with_p2_info.iter() { |
|
1401 let node = map.get_or_insert(path)?; |
|
1402 let entry = |
|
1403 node.data.as_entry_mut().expect("entry should exist"); |
|
1404 entry.drop_merge_data(); |
|
1405 if let Some(source) = node.copy_source.take().as_deref() { |
|
1406 copies.push((path.to_owned(), source.to_owned())); |
|
1407 } |
|
1408 } |
|
1409 Ok(copies) |
|
1410 }) |
|
1411 } |
|
1412 |
1378 pub fn debug_iter( |
1413 pub fn debug_iter( |
1379 &self, |
1414 &self, |
1380 all: bool, |
1415 all: bool, |
1381 ) -> Box< |
1416 ) -> Box< |
1382 dyn Iterator< |
1417 dyn Iterator< |