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

Method run_async

atomic-cli/src/commands/push/command.rs:509–1115  ·  view source on GitHub ↗

Async implementation of the push command.

(&self)

Source from the content-addressed store, hash-verified

507
508 /// Async implementation of the push command.
509 async fn run_async(&self) -> CliResult<()> {
510 // For an active Git shim, run CB-4B through a read-only Atomic handle
511 // before writable open can recover/create an operation and before the
512 // first HTTP `/code` negotiation POST. Plain Atomic repositories retain
513 // their original writable-open/recovery behavior.
514 let repo_root = find_repository_root()?;
515 let preflight = if crate::commands::git::shadow::shim_publication_required(&repo_root) {
516 let readonly_repo =
517 Repository::open_readonly(&repo_root).map_err(CliError::Repository)?;
518 let local_view = self.get_local_view(&readonly_repo)?;
519 let publication = crate::commands::git::shadow::verify_shim_publication(
520 &readonly_repo,
521 &repo_root,
522 &local_view,
523 )?
524 .ok_or_else(|| CliError::GitError {
525 message: "Git shim publication marker disappeared during preflight".to_string(),
526 })?;
527 Some((local_view, publication))
528 } else {
529 None
530 };
531
532 // Enter the shared workspace transaction before any network or graph
533 // work. Dry runs observe without mutation — the boundary opens
534 // read-only so Observe is mutation-free by construction; ordinary
535 // pushes reconcile safe drift and refuse unsafe baselines.
536 // WorkspaceTxn authority (working copy + view) is retained for the
537 // entire command body.
538 let mut repo = if self.dry_run {
539 Repository::open_readonly(&repo_root)
540 } else {
541 Repository::open_for_workspace_transaction(&repo_root)
542 }
543 .map_err(CliError::Repository)?;
544 let workspace = enter_workspace(&mut repo, boundary_mode(self.dry_run))?;
545 let (local_view, publication) = match preflight {
546 Some((local_view, publication)) => {
547 publication.reobserve(&repo, &repo_root)?;
548 (local_view, Some(publication))
549 }
550 None => (self.get_local_view_from_txn(&workspace)?, None),
551 };
552
553 // Resolve remote name, URL, and identity hint
554 let (remote_name, remote_url, identity_hint) = self.resolve_remote_url(&repo)?;
555
556 // Determine views: the leaf we push, and its name on the remote.
557 let remote_view = self.get_remote_view(&local_view);
558
559 // Print header
560 println!(
561 "Pushing to {} ({})",
562 style_view(&remote_name),
563 hint(&remote_url)
564 );
565
566 // Fail fast if we have no usable credentials for this remote. A push is

Callers 1

runMethod · 0.45

Calls 15

find_repository_rootFunction · 0.85
verify_shim_publicationFunction · 0.85
boundary_modeFunction · 0.85
check_push_credentialsFunction · 0.85
RepositoryClass · 0.85
create_spinnerFunction · 0.85
finish_errorFunction · 0.85
finish_successFunction · 0.85
print_warningFunction · 0.85
print_successFunction · 0.85

Tested by

no test coverage detected