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

Method import_span_incremental

atomic-cli/src/commands/git/stream.rs:531–700  ·  view source on GitHub ↗

Rebuild the compiler from the exact persisted prefix, then append only the unimported suffix through the journaled private span stage. This internal path does not inspect Git HEAD/index or the worktree; the command boundary must hold the common lock and prove those separately.

(
        &self,
        repo: &mut Repository,
        tip: Oid,
        limits: GitStreamLimits,
        expected_order: &[Oid],
        mut validate_git: F,
    )

Source from the content-addressed store, hash-verified

529 /// This internal path does not inspect Git HEAD/index or the worktree; the
530 /// command boundary must hold the common lock and prove those separately.
531 pub(crate) fn import_span_incremental<F>(
532 &self,
533 repo: &mut Repository,
534 tip: Oid,
535 limits: GitStreamLimits,
536 expected_order: &[Oid],
537 mut validate_git: F,
538 ) -> CliResult<GitStreamOutcome>
539 where
540 F: FnMut() -> CliResult<()>,
541 {
542 use atomic_core::pristine::{GraphTxnT, ViewTxnT};
543
544 if !self.options.graph_only
545 || !self.options.mainline_only
546 || !self.options.span_stream
547 || !self.options.imported_shas.is_empty()
548 || self.options.target_view != repo.current_view()
549 {
550 return Err(git_error("incremental span stream requires an unfiltered first-parent replay into the current view"));
551 }
552 let (git, policy, ordered) = self.graph_stream_inputs(tip)?;
553 if ordered != expected_order {
554 return Err(git_error(
555 "pinned Git stream history changed after preflight",
556 ));
557 }
558 let (stage_hashes, target_members, target_state) = {
559 let txn = repo
560 .pristine()
561 .read_txn()
562 .map_err(|error| git_error(error.to_string()))?;
563 let target = txn
564 .get_view(repo.current_view())
565 .map_err(|error| git_error(error.to_string()))?
566 .ok_or_else(|| git_error("incremental span target view missing"))?;
567 let stage = txn
568 .get_view("git-stream-private")
569 .map_err(|error| git_error(error.to_string()))?
570 .ok_or_else(|| git_error("incremental span private stage missing"))?;
571 let hashes = |view: &atomic_core::pristine::ViewState| -> CliResult<Vec<ContentHash>> {
572 txn.iter_changes(view, 0)
573 .map_err(|error| git_error(error.to_string()))?
574 .map(|row| {
575 let (_, id, _) = row.map_err(|error| git_error(error.to_string()))?;
576 txn.get_external(id)
577 .map_err(|error| git_error(error.to_string()))?
578 .ok_or_else(|| git_error("stream member has no change hash"))
579 })
580 .collect()
581 };
582 (
583 hashes(&stage)?,
584 hashes(&target)?.into_iter().collect::<HashSet<_>>(),
585 target.state,
586 )
587 };
588 if stage_hashes.is_empty() || stage_hashes.len() > ordered.len() {

Calls 15

input_budgetFunction · 0.85
parse_commit_with_scopeFunction · 0.85
import_expected_tree_oidFunction · 0.85
graph_stream_inputsMethod · 0.80
read_txnMethod · 0.80
pristineMethod · 0.80
build_git_metadataMethod · 0.80
compileMethod · 0.80
skipMethod · 0.80
payload_bytesMethod · 0.80
commitsMethod · 0.80