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

Function sole_working_copy_operation

atomic-cli/src/commands/git/binding.rs:502–534  ·  view source on GitHub ↗
(
    repo: &atomic_repository::Repository,
    working_copy: atomic_core::types::WorkingCopyId,
)

Source from the content-addressed store, hash-verified

500}
501
502fn sole_working_copy_operation(
503 repo: &atomic_repository::Repository,
504 working_copy: atomic_core::types::WorkingCopyId,
505) -> CliResult<OperationId> {
506 let log = repo
507 .operation_log(
508 atomic_core::operation::OperationScope::WorkingCopy(working_copy),
509 Some(1),
510 false,
511 )
512 .map_err(CliError::from)?;
513 match log.head_state {
514 atomic_repository::OperationHeadState::Single(head) => Ok(head),
515 OperationHeadState::Empty => Err(CliError::Repository(
516 atomic_repository::RepositoryError::InvalidOperation {
517 message: "no causal operation exists to bind; record or project state first"
518 .to_string(),
519 },
520 )),
521 OperationHeadState::Diverged(heads) => Err(CliError::Repository(
522 atomic_repository::RepositoryError::InvalidOperation {
523 message: format!(
524 "operation heads are diverged: {}",
525 heads
526 .iter()
527 .map(ToString::to_string)
528 .collect::<Vec<_>>()
529 .join(", ")
530 ),
531 },
532 )),
533 }
534}
535
536fn verify(id: &str) -> CliResult<()> {
537 let root = find_repository_root()?;

Callers 1

publishFunction · 0.85

Calls 3

WorkingCopyInterface · 0.85
RepositoryClass · 0.85
operation_logMethod · 0.80

Tested by

no test coverage detected