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

Method divergence_error

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

464
465 /// Report a divergence conflict and build the error to return.
466 fn divergence_error(
467 &self,
468 local_view: &str,
469 local: &ViewManifest,
470 remote: Option<&ViewManifest>,
471 conflict: &ViewSyncConflict,
472 ) -> CliError {
473 match conflict {
474 ViewSyncConflict::Diverged { .. } => {
475 crate::output::print_error(&format!(
476 "View '{}' has diverged from the remote",
477 local_view
478 ));
479 print_blank();
480 if let Some(remote) = remote {
481 display_manifest_divergence(local_view, local, remote);
482 print_blank();
483 }
484 print_hint("The remote view's log is not a prefix of your local log.");
485 print_hint("Use 'atomic pull' to fetch remote changes, or");
486 print_hint("Use 'atomic push --force' to attempt the push anyway (server decides)");
487 CliError::Conflict {
488 description: format!("View '{}': {}", local_view, conflict),
489 }
490 }
491 ViewSyncConflict::IdentityMismatch { .. } => {
492 crate::output::print_error(&format!(
493 "View '{}' exists on the remote with a different identity",
494 local_view
495 ));
496 print_blank();
497 print_hint(&format!("{}", conflict));
498 print_hint("A view's scope and parent are fixed at creation and cannot be");
499 print_hint("changed by a push. Rename the local view or push to a different");
500 print_hint("remote view with '--to-view'.");
501 CliError::Conflict {
502 description: format!("View '{}': {}", local_view, conflict),
503 }
504 }
505 }
506 }
507
508 /// Async implementation of the push command.
509 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