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

Method run_async

atomic-cli/src/commands/pull/command.rs:380–813  ·  view source on GitHub ↗

Async implementation of the pull command. This is the main entry point for the pull operation. It coordinates all the steps required to download and apply remote changes.

(&self)

Source from the content-addressed store, hash-verified

378 /// This is the main entry point for the pull operation. It coordinates
379 /// all the steps required to download and apply remote changes.
380 async fn run_async(&self) -> CliResult<()> {
381 // Find and open repository
382 let repo_root = find_repository_root()?;
383 let repo = Repository::open(&repo_root).map_err(CliError::Repository)?;
384
385 // Resolve remote name, URL, and identity hint
386 let (remote_name, remote_url, identity_hint) = self.resolve_remote_url(&repo)?;
387
388 // Determine views
389 let local_view = self.get_local_view(&repo);
390 let remote_view = self.get_remote_view(&local_view);
391
392 // Print header
393 println!(
394 "Pulling from {} ({})",
395 style_view(&remote_name),
396 hint(&remote_url)
397 );
398
399 // Connect to remote
400 let spinner = create_spinner("Connecting to remote...");
401 let config = self
402 .build_remote_config(&remote_url, identity_hint.as_deref())
403 .await;
404 let remote = HttpRemote::with_config(&remote_url, config).map_err(|e| {
405 finish_error(&spinner, "Failed to connect");
406 convert_remote_error(e, &remote_url)
407 })?;
408 finish_success(&spinner, "Connected");
409
410 // Query remote state
411 let spinner = create_spinner("Querying remote state...");
412 let remote_state = remote.get_state(&remote_view).await.map_err(|e| {
413 finish_error(&spinner, "Failed to query state");
414 convert_remote_error(e, &remote_url)
415 })?;
416 finish_success(&spinner, "Got remote state");
417
418 // Get remote changelist
419 let spinner = create_spinner("Fetching remote changelist...");
420 let remote_from = 0; // Always get full changelist for comparison
421 let remote_entries = remote
422 .get_changelist(&remote_view, remote_from)
423 .await
424 .map_err(|e| {
425 finish_error(&spinner, "Failed to fetch changelist");
426 convert_remote_error(e, &remote_url)
427 })?;
428 finish_success(
429 &spinner,
430 &format!("Got {} remote changes", remote_entries.len()),
431 );
432
433 // Get local history
434 let spinner = create_spinner("Loading local history...");
435 let local_entries = repo
436 .log(HistoryOptions::default())
437 .map_err(CliError::Repository)?;

Callers 1

runMethod · 0.45

Calls 15

find_repository_rootFunction · 0.85
create_spinnerFunction · 0.85
finish_errorFunction · 0.85
finish_successFunction · 0.85
print_blankFunction · 0.85
has_local_only_changesFunction · 0.85
find_local_only_changesFunction · 0.85
calculate_pull_deltaFunction · 0.85
print_successFunction · 0.85
create_progress_barFunction · 0.85
print_warningFunction · 0.85
print_hintFunction · 0.85

Tested by

no test coverage detected