Walk deleted forward edges from `parent` to find a dead vertex that was deleted by both `left_change` and `right_change`. Returns the content bytes of the ancestor, or `None` if no shared dead vertex could be found.
(
&self,
parent: &GraphNode<NodeId>,
left_change: NodeId,
right_change: NodeId,
)
| 249 | /// Returns the content bytes of the ancestor, or `None` if no shared |
| 250 | /// dead vertex could be found. |
| 251 | fn find_ancestor_content( |
| 252 | &self, |
| 253 | parent: &GraphNode<NodeId>, |
| 254 | left_change: NodeId, |
| 255 | right_change: NodeId, |
| 256 | ) -> Result<Option<Vec<u8>>, PristineError> { |
| 257 | // Look at all forward edges from the parent, including deleted ones. |
| 258 | let forward_edges = self.txn.iter_forward(*parent, true)?; |
| 259 | |
| 260 | for edge in &forward_edges { |
| 261 | if !edge.kind.is_deleted() { |
| 262 | continue; |
| 263 | } |
| 264 | |
| 265 | let dead_vertex = self.txn.find_block(edge.dest)?; |
| 266 | |
| 267 | // Check whether this vertex was deleted by BOTH competing changes |
| 268 | // by examining its parent edges. |
| 269 | let parent_edges = self.txn.iter_parents(dead_vertex, true)?; |
| 270 | |
| 271 | let mut deleted_by_left = false; |
| 272 | let mut deleted_by_right = false; |
| 273 | |
| 274 | for parent_edge in &parent_edges { |
| 275 | if parent_edge.kind.is_deleted() { |
| 276 | if parent_edge.introduced_by == left_change { |
| 277 | deleted_by_left = true; |
| 278 | } |
| 279 | if parent_edge.introduced_by == right_change { |
| 280 | deleted_by_right = true; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | if deleted_by_left && deleted_by_right { |
| 286 | let content = self.get_vertex_content(&dead_vertex)?; |
| 287 | return Ok(Some(content)); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | Ok(None) |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | // =========================================================================== |
no test coverage detected