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

Method run_async

atomic-cli/src/commands/pull/command.rs:371–722  ·  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

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

Tested by

no test coverage detected