mononoke: return an error if a parent hasn't been remapped

Summary:
This didn't matter much in practice because we've never pushrebased a rewritten
commit where one of the parents rewrites to nothing. Nevertheless I think it's
cleaner to return an error in this case

Reviewed By: ikostia

Differential Revision: D24621105

fbshipit-source-id: 8cf62efd28e0c9aed945f727b1872db6922cfeb3
This commit is contained in:
Stanislau Hlebik 2020-10-30 10:25:02 -07:00 committed by Facebook GitHub Bot
parent cda77b42c4
commit 4b734eaa1d

View File

@ -995,7 +995,14 @@ where
.get_commit_sync_outcome(ctx, p) .get_commit_sync_outcome(ctx, p)
.await? .await?
.map(|sync_outcome| (sync_outcome, p)); .map(|sync_outcome| (sync_outcome, p));
remapped_parents_outcome.extend(maybe_commit_sync_outcome.into_iter()); let commit_sync_outcome = maybe_commit_sync_outcome.ok_or_else(|| {
format_err!(
"parent {} has not been remapped yet, therefore can't remap {}",
p,
source_cs.get_changeset_id()
)
})?;
remapped_parents_outcome.push(commit_sync_outcome);
} }
if remapped_parents_outcome.is_empty() { if remapped_parents_outcome.is_empty() {