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

Method divergence_error

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

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