Show More
@@ -546,12 +546,17 b" impl<'on_disk> DirstateMap<'on_disk> {" | |||
|
546 | 546 | /// Returns a mutable reference to the node at `path` if it exists |
|
547 | 547 | /// |
|
548 | 548 | /// This takes `root` instead of `&mut self` so that callers can mutate |
|
549 | /// other fields while the returned borrow is still valid | |
|
549 | /// other fields while the returned borrow is still valid. | |
|
550 | /// | |
|
551 | /// `each_ancestor` is a callback that is called for each ancestor node | |
|
552 | /// when descending the tree. It is used to keep the different counters | |
|
553 | /// of the `DirstateMap` up-to-date. | |
|
550 | 554 | fn get_node_mut<'tree>( |
|
551 | 555 | on_disk: &'on_disk [u8], |
|
552 | 556 | unreachable_bytes: &mut u32, |
|
553 | 557 | root: &'tree mut ChildNodes<'on_disk>, |
|
554 | 558 | path: &HgPath, |
|
559 | mut each_ancestor: impl FnMut(&mut Node), | |
|
555 | 560 | ) -> Result<Option<&'tree mut Node<'on_disk>>, DirstateV2ParseError> { |
|
556 | 561 | let mut children = root; |
|
557 | 562 | let mut components = path.components(); |
@@ -563,6 +568,7 b" impl<'on_disk> DirstateMap<'on_disk> {" | |||
|
563 | 568 | .get_mut(component) |
|
564 | 569 | { |
|
565 | 570 | if let Some(next_component) = components.next() { |
|
571 | each_ancestor(child); | |
|
566 | 572 | component = next_component; |
|
567 | 573 | children = &mut child.children; |
|
568 | 574 | } else { |
@@ -786,6 +792,7 b" impl<'on_disk> DirstateMap<'on_disk> {" | |||
|
786 | 792 | &mut self.unreachable_bytes, |
|
787 | 793 | &mut self.root, |
|
788 | 794 | path, |
|
795 | |_ancestor| {}, | |
|
789 | 796 | )? { |
|
790 | 797 | Some(node) => node, |
|
791 | 798 | None => return Ok(()), |
@@ -807,6 +814,7 b" impl<'on_disk> DirstateMap<'on_disk> {" | |||
|
807 | 814 | &mut self.unreachable_bytes, |
|
808 | 815 | &mut self.root, |
|
809 | 816 | path, |
|
817 | |_ancestor| {}, | |
|
810 | 818 | )? { |
|
811 | 819 | Some(node) => node, |
|
812 | 820 | None => return Ok(()), |
@@ -1294,6 +1302,7 b' impl OwningDirstateMap {' | |||
|
1294 | 1302 | unreachable_bytes, |
|
1295 | 1303 | &mut map.root, |
|
1296 | 1304 | key, |
|
1305 | |_ancestor| {}, | |
|
1297 | 1306 | )? |
|
1298 | 1307 | .and_then(|node| { |
|
1299 | 1308 | if let Some(source) = &node.copy_source { |
General Comments 0
You need to be logged in to leave comments.
Login now