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

Method divergence_error

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

Report a divergence conflict and build the error to return.

(
        &self,
        local_view: &str,
        local: &ViewManifest,
        remote: Option<&ViewManifest>,
        conflict: &ViewSyncConflict,
    )

Source from the content-addressed store, hash-verified

362
363 /// Report a divergence conflict and build the error to return.
364 fn divergence_error(
365 &self,
366 local_view: &str,
367 local: &ViewManifest,
368 remote: Option<&ViewManifest>,
369 conflict: &ViewSyncConflict,
370 ) -> CliError {
371 match conflict {
372 ViewSyncConflict::Diverged { .. } => {
373 crate::output::print_error(&format!(
374 "View '{}' has diverged from the remote",
375 local_view
376 ));
377 print_blank();
378 if let Some(remote) = remote {
379 display_manifest_divergence(local_view, local, remote);
380 print_blank();
381 }
382 print_hint("The remote view's log is not a prefix of your local log.");
383 print_hint("Use 'atomic pull' to fetch remote changes, or");
384 print_hint("Use 'atomic push --force' to attempt the push anyway (server decides)");
385 CliError::Conflict {
386 description: format!("View '{}': {}", local_view, conflict),
387 }
388 }
389 ViewSyncConflict::IdentityMismatch { .. } => {
390 crate::output::print_error(&format!(
391 "View '{}' exists on the remote with a different identity",
392 local_view
393 ));
394 print_blank();
395 print_hint(&format!("{}", conflict));
396 print_hint("A view's scope and parent are fixed at creation and cannot be");
397 print_hint("changed by a push. Rename the local view or push to a different");
398 print_hint("remote view with '--to-view'.");
399 CliError::Conflict {
400 description: format!("View '{}': {}", local_view, conflict),
401 }
402 }
403 }
404 }
405
406 /// Async implementation of the push command.
407 async fn run_async(&self) -> CliResult<()> {

Callers 1

run_asyncMethod · 0.80

Calls 4

print_errorFunction · 0.85
print_blankFunction · 0.85
print_hintFunction · 0.85

Tested by

no test coverage detected