Skip to content

Commit 95397ae

Browse files
YousefSalamameta-codesync[bot]
authored andcommitted
commit_graph/segments: panic with a more descriptive message on missing parent segment
Summary: Context: When ordering commit graph segments, there's an assumption that any segment will only have a location associated with a parent changeset ID if there's a parent segment with that location's head. We panic when this assumption doesn't hold. This diff: Make the panic message more descriptive to make debugging easier. Reviewed By: gustavoavena Differential Revision: D101337656 fbshipit-source-id: b5a21660976eb2ba745b56f6dde1dbbeb9b5249a
1 parent 31730b9 commit 95397ae

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • eden/mononoke/repo_attributes/commit_graph/commit_graph/src

eden/mononoke/repo_attributes/commit_graph/commit_graph/src/segments.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,14 @@ impl<E: EdgeType> CommitGraphOps<E> {
713713
}
714714
}
715715
}
716-
sorted_segments.push(segments.remove(&segment_head).unwrap());
716+
if let Some(segment) = segments.remove(&segment_head) {
717+
sorted_segments.push(segment);
718+
} else {
719+
panic!(
720+
"Segment head {} not found in segments {:?}",
721+
segment_head, segments
722+
);
723+
}
717724
}
718725
sorted_segments
719726
}

0 commit comments

Comments
 (0)