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

Method run_async

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

Async implementation of the push command.

(&self)

Source from the content-addressed store, hash-verified

304
305 /// Async implementation of the push command.
306 async fn run_async(&self) -> CliResult<()> {
307 // Find and open repository
308 let repo_root = find_repository_root()?;
309 let repo = Repository::open(&repo_root).map_err(CliError::Repository)?;
310
311 // Resolve remote URL and identity hint
312 let (remote_url, identity_hint) = self.resolve_remote_url(&repo)?;
313
314 // Determine views
315 let local_view = self.get_local_view(&repo);
316 let remote_view = self.get_remote_view(&local_view);
317 let default_remote_view = "dev".to_string();
318
319 // Print header
320 println!(
321 "Pushing to {} ({})",
322 style_view(&self.remote),
323 hint(&remote_url)
324 );
325
326 // Fail fast if we have no usable credentials for this remote. A push is
327 // a write that always requires auth; without a credential the server's
328 // negotiation endpoints return an ambiguous 404 (private projects are
329 // deliberately masked), which surfaces as a misleading "view not found".
330 // Catching the missing credential here gives the user an accurate,
331 // actionable error instead.
332 crate::commands::auth::check_push_credentials(&remote_url, identity_hint.as_deref())?;
333
334 // Connect to remote
335 let spinner = create_spinner("Connecting to remote...");
336 let config = self
337 .build_remote_config(&remote_url, identity_hint.as_deref())
338 .await;
339 let remote = HttpRemote::with_config(&remote_url, config).map_err(|e| {
340 finish_error(&spinner, "Failed to connect");
341 convert_remote_error(e, &remote_url)
342 })?;
343 finish_success(&spinner, "Connected");
344
345 // Query remote state
346 let spinner = create_spinner("Querying remote state...");
347 let remote_state = remote.get_state(&remote_view).await.map_err(|e| {
348 finish_error(&spinner, "Failed to query state");
349 convert_remote_error(e, &remote_url)
350 })?;
351 finish_success(&spinner, "Got remote state");
352
353 // Get local history
354 let spinner = create_spinner("Loading local history...");
355 let local_entries = repo
356 .log(HistoryOptions::default())
357 .map_err(CliError::Repository)?;
358 finish_success(
359 &spinner,
360 &format!("Loaded {} local changes", local_entries.len()),
361 );
362
363 // Get remote changelist for the target view

Callers 1

runMethod · 0.45

Calls 15

find_repository_rootFunction · 0.85
check_push_credentialsFunction · 0.85
create_spinnerFunction · 0.85
finish_errorFunction · 0.85
finish_successFunction · 0.85
print_blankFunction · 0.85
calculate_push_deltaFunction · 0.85
print_successFunction · 0.85
print_errorFunction · 0.85
print_hintFunction · 0.85
create_progress_barFunction · 0.85
upload_change_smartFunction · 0.85

Tested by

no test coverage detected