MutableRepo: in fast-path for adding head, simply remove parent heads

This commit is contained in:
Martin von Zweigbergk 2021-03-15 15:26:09 -07:00
parent 2c92fca75a
commit 3ecb4ec16b

View file

@ -635,7 +635,9 @@ impl<'r> MutableRepo<'r> {
{ {
self.index.add_commit(head); self.index.add_commit(head);
self.view.add_head(head.id()); self.view.add_head(head.id());
self.enforce_view_invariants(); for parent_id in head.parent_ids() {
self.view.remove_head(&parent_id);
}
if let Some(evolution) = self.evolution_mut() { if let Some(evolution) = self.evolution_mut() {
evolution.add_commit(head) evolution.add_commit(head)
} }