MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_merge_resolution

Method write_merge_resolution

atomic-cli/src/commands/git/parallel.rs:7169–7609  ·  view source on GitHub ↗
(
        &self,
        repo: &mut Repository,
        git: &GitRepository,
        ledger: &mut ClosureLedger,
        parsed: &ParsedCommit,
        verified: &VerifiedProspectiveEquivalence,
     

Source from the content-addressed store, hash-verified

7167 /// blocker 2); both fail closed.
7168 #[allow(clippy::too_many_arguments)]
7169 fn write_merge_resolution(
7170 &self,
7171 repo: &mut Repository,
7172 git: &GitRepository,
7173 ledger: &mut ClosureLedger,
7174 parsed: &ParsedCommit,
7175 verified: &VerifiedProspectiveEquivalence,
7176 prospective: &atomic_repository::ProjectTree,
7177 boundaries: &[&'static str],
7178 ) -> CliResult<ImportedCommitInfo> {
7179 use atomic_core::output::memory::Memory;
7180 use atomic_core::record::workflow::{record_added_file, DetectedFile, RecordingOptions};
7181
7182 let working_copy = repo
7183 .require_working_copy_id()
7184 .map_err(|e| CliError::Internal(e.into()))?;
7185 let commit_start = std::time::Instant::now();
7186 let target = self.options.target_view.clone();
7187
7188 // The resolution assembles against the exact parent union (review
7189 // R1): view members outside the reconstructed parent interpretation
7190 // closures — full ancestor chains included, across runs and views —
7191 // stay invisible, so the union is the parents' closures only.
7192 let excluded = ledger.exclusions_for(repo, git, &parsed.git_sha, &target, true)?;
7193
7194 let mut header_builder = ChangeHeader::builder()
7195 .message(&parsed.metadata.message)
7196 .author(Author::new(
7197 &parsed.metadata.author_name,
7198 parsed.metadata.author_email.as_deref(),
7199 ))
7200 .timestamp(parsed.metadata.timestamp);
7201 if let Some(ref desc) = parsed.metadata.description {
7202 header_builder = header_builder.description(desc);
7203 }
7204 let header = header_builder.build();
7205
7206 // The verified causal frontier of the exact parent union: the union
7207 // of every parent's complete interpreted closure (persisted rows +
7208 // reconstruction), not the whole view. Every parent closure member is
7209 // referenced into the target view first so the union state holds all
7210 // of them; a parent whose change is missing locally fails closed.
7211 let mut parent_closure_set: std::collections::BTreeSet<atomic_core::types::Hash> =
7212 std::collections::BTreeSet::new();
7213 let mut parent_tip_hashes: Vec<atomic_core::types::Hash> = Vec::new();
7214 for oid in &parsed.parent_oids {
7215 let sha = oid.to_string();
7216 let hash = repo
7217 .checked_git_sha(&sha)
7218 .map_err(|e| CliError::Internal(e.into()))?
7219 .ok_or_else(|| {
7220 git_error(format!(
7221 "merge {} parent {} has no locally verified imported change; \
7222 every parent closure must be imported before the resolution",
7223 parsed.git_sha, sha
7224 ))
7225 })?;
7226 parent_tip_hashes.push(hash);

Callers 1

write_commitMethod · 0.80

Calls 15

git_algorithm_for_shaFunction · 0.85
git_object_id_for_shaFunction · 0.85
git_mode_atFunction · 0.85
sits_under_deleted_pathFunction · 0.85
repository_pathFunction · 0.85
addedFunction · 0.85
record_added_fileFunction · 0.85
expected_materializationFunction · 0.85
ModeEnum · 0.85
KindEnum · 0.85
git_resolution_metadataFunction · 0.85
staged_expectation_forFunction · 0.85

Tested by

no test coverage detected