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

Method begin_span

atomic-repository/src/repository/git_stream.rs:534–557  ·  view source on GitHub ↗

Begin span-backed streaming into a fresh, untracked repository.

(
        repo: &'a mut Repository,
        limits: GitStreamLimits,
    )

Source from the content-addressed store, hash-verified

532
533 /// Begin span-backed streaming into a fresh, untracked repository.
534 pub fn begin_span(
535 repo: &'a mut Repository,
536 limits: GitStreamLimits,
537 ) -> Result<Self, RepositoryError> {
538 use atomic_core::pristine::TreeTxnT;
539 let working_copy = repo.require_working_copy_id()?;
540 let _lock = repo.try_lock_operation(working_copy)?;
541 {
542 let txn = repo.pristine.read_txn()?;
543 let first = txn.iter_tree()?.next().transpose()?;
544 if let Some((path, _)) = first {
545 return Err(invalid(format!(
546 "span stream requires a fresh repository without tracked or staged paths; found '{path}'"
547 )));
548 }
549 }
550 let mut session = Self::begin(repo, limits)?;
551 session
552 .repo
553 .pristine
554 .require_repository_capability(atomic_core::pristine::SPAN_RANGE_CAPABILITY)?;
555 session.span_mode = true;
556 Ok(session)
557 }
558
559 /// Continue a direct span stream over an unchanged imported prefix,
560 /// optionally retaining its native `.atomicignore` bootstrap change.

Callers

nothing calls this directly

Calls 7

try_lock_operationMethod · 0.80
read_txnMethod · 0.80
invalidFunction · 0.70
nextMethod · 0.45
iter_treeMethod · 0.45

Tested by

no test coverage detected