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

Method divergence_error

atomic-cli/src/commands/push/command.rs:445–485  ·  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

443
444 /// Report a divergence conflict and build the error to return.
445 fn divergence_error(
446 &self,
447 local_view: &str,
448 local: &ViewManifest,
449 remote: Option<&ViewManifest>,
450 conflict: &ViewSyncConflict,
451 ) -> CliError {
452 match conflict {
453 ViewSyncConflict::Diverged { .. } => {
454 crate::output::print_error(&format!(
455 "View '{}' has diverged from the remote",
456 local_view
457 ));
458 print_blank();
459 if let Some(remote) = remote {
460 display_manifest_divergence(local_view, local, remote);
461 print_blank();
462 }
463 print_hint("The remote view's log is not a prefix of your local log.");
464 print_hint("Use 'atomic pull' to fetch remote changes, or");
465 print_hint("Use 'atomic push --force' to attempt the push anyway (server decides)");
466 CliError::Conflict {
467 description: format!("View '{}': {}", local_view, conflict),
468 }
469 }
470 ViewSyncConflict::IdentityMismatch { .. } => {
471 crate::output::print_error(&format!(
472 "View '{}' exists on the remote with a different identity",
473 local_view
474 ));
475 print_blank();
476 print_hint(&format!("{}", conflict));
477 print_hint("A view's scope and parent are fixed at creation and cannot be");
478 print_hint("changed by a push. Rename the local view or push to a different");
479 print_hint("remote view with '--to-view'.");
480 CliError::Conflict {
481 description: format!("View '{}': {}", local_view, conflict),
482 }
483 }
484 }
485 }
486
487 /// Async implementation of the push command.
488 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