`atomic push` over PushChanges — every form. The handler performs the network sync end to end and returns the structured report; the CLI renders the local push body's exact lines (the client-side pieces are the remote-name resolution read, the credential check, and the auth header resolution — all config/identity reads, never redb).
(args: &super::push::Push)
| 5404 | /// the remote-name resolution read, the credential check, and the auth |
| 5405 | /// header resolution — all config/identity reads, never redb). |
| 5406 | pub fn push(args: &super::push::Push) -> CliResult<bool> { |
| 5407 | use crate::output::{error as print_error_fn, hint, view as style_view}; |
| 5408 | use crate::output::{hash as style_hash, success as style_success}; |
| 5409 | let Some(session) = Service::open()? else { |
| 5410 | return Ok(false); |
| 5411 | }; |
| 5412 | let (remote_name, remote_url) = sync_resolve_remote(&session, &args.remote)?; |
| 5413 | |
| 5414 | // Print header, fail fast on credentials — the local body's order. |
| 5415 | println!( |
| 5416 | "Pushing to {} ({})", |
| 5417 | style_view(&remote_name), |
| 5418 | hint(&remote_url) |
| 5419 | ); |
| 5420 | atomic_remote::auth::check_push_credentials(&remote_url, args.identity.as_deref())?; |
| 5421 | let auth_headers = sync_auth_headers(&remote_url, args.identity.as_deref()); |
| 5422 | stage_line("Connected"); |
| 5423 | |
| 5424 | let request = pb::PushChangesRequest { |
| 5425 | repository: Some(session.reference.clone()), |
| 5426 | meta: request_meta(), |
| 5427 | remote: remote_name.clone(), |
| 5428 | views: Vec::new(), |
| 5429 | expected: None, |
| 5430 | to_view: args.to_view.clone(), |
| 5431 | from_view: args.from_view.clone(), |
| 5432 | dry_run: args.dry_run, |
| 5433 | force: args.force, |
| 5434 | all: args.all, |
| 5435 | insecure: args.insecure, |
| 5436 | timeout_secs: args.timeout, |
| 5437 | auth_headers: auth_headers.clone(), |
| 5438 | remote_url: Some(remote_url.clone()), |
| 5439 | identity: args.identity.clone(), |
| 5440 | }; |
| 5441 | let response = match session.push_changes(request) { |
| 5442 | Ok(response) => response, |
| 5443 | Err(error) => return Err(sync_error_map(error)), |
| 5444 | }; |
| 5445 | |
| 5446 | // The plan-phase conflict: the local divergence/identity block plus |
| 5447 | // the local CliError. |
| 5448 | if let Some(conflict) = &response.conflict { |
| 5449 | print_error_fn(&format!( |
| 5450 | "View '{}' has diverged from the remote", |
| 5451 | conflict.view |
| 5452 | )); |
| 5453 | println!(); |
| 5454 | if !conflict.identity_mismatch { |
| 5455 | if let (Some(local), Some(remote)) = (&conflict.local, &conflict.remote) { |
| 5456 | println!( |
| 5457 | " Local: {} at {}", |
| 5458 | style_view(&local.view), |
| 5459 | crate::output::info(&manifest_state_text(&Some(local.clone()))) |
| 5460 | ); |
| 5461 | println!( |
| 5462 | " Remote: {} at {}", |
| 5463 | style_view(&remote.view), |
no test coverage detected