use std::collections::BTreeMap;
use crate::store::Store;
pub struct MergeResolutionChecker<'a> {
store: &'a Store,
dst_branch: String,
}
impl<'a> MergeResolutionChecker<'a> {
pub fn new(store: &'a Store, dst_branch: impl Into<String>) -> Self {
Self { store, dst_branch: dst_branch.into() }
}
}
impl lex_vcs::ResolutionChecker for MergeResolutionChecker<'_> {
fn typecheck_projection(&self, delta: &BTreeMap<String, Option<String>>) -> Vec<String> {
match self.store.typecheck_merge_projection(&self.dst_branch, delta) {
Ok(()) => Vec::new(),
Err(crate::StoreError::TypeError(errors)) => {
errors.iter().map(|e| e.to_string()).collect()
}
Err(other) => vec![format!("merge projection check failed: {other}")],
}
}
}