`atomic record` over Record — every form. The message composes client-side with the SAME editor/prompt flow the local body uses (`get_message` — editors are interactive, client-side by design), `--author` parses into the wire author exactly like the local body, `--identity` names an identity the handler resolves host-side, and `--dry-run` is the Status read's preview — the same "Would record" line
(args: &super::record::Record)
| 623 | /// `--dry-run` is the Status read's preview — the same "Would record" |
| 624 | /// lines the local body prints, rendered from the wire's file entries. |
| 625 | pub fn record(args: &super::record::Record) -> CliResult<bool> { |
| 626 | // These #207 operations have no RecordRequest representation yet. Keep |
| 627 | // their existing native boundary rather than silently discard the flags. |
| 628 | if args.allow_conflict_markers || !args.resolve_name_conflicts.is_empty() { |
| 629 | return Ok(false); |
| 630 | } |
| 631 | let Some(session) = Service::open()? else { |
| 632 | return Ok(false); |
| 633 | }; |
| 634 | if args.dry_run { |
| 635 | let response = session.status(pb::StatusRequest { |
| 636 | repository: Some(session.reference.clone()), |
| 637 | options: None, |
| 638 | })?; |
| 639 | let entries = response |
| 640 | .files |
| 641 | .iter() |
| 642 | .map(|file| { |
| 643 | let status = match pb::FileStatus::try_from(file.status) { |
| 644 | Ok(pb::FileStatus::Modified) => atomic_repository::status::FileStatus::Modified, |
| 645 | Ok(pb::FileStatus::Deleted) => atomic_repository::status::FileStatus::Deleted, |
| 646 | Ok(pb::FileStatus::Untracked) => { |
| 647 | atomic_repository::status::FileStatus::Untracked |
| 648 | } |
| 649 | Ok(pb::FileStatus::Added) => atomic_repository::status::FileStatus::Added, |
| 650 | Ok(pb::FileStatus::Conflicted) => { |
| 651 | atomic_repository::status::FileStatus::Conflicted |
| 652 | } |
| 653 | Ok(pb::FileStatus::PendingUntrack) => { |
| 654 | atomic_repository::status::FileStatus::PendingUntrack |
| 655 | } |
| 656 | _ => atomic_repository::status::FileStatus::Clean, |
| 657 | }; |
| 658 | (status, file.path.clone()) |
| 659 | }) |
| 660 | .collect::<Vec<_>>(); |
| 661 | crate::commands::record::render_dry_run(&entries, args.all, &args.files); |
| 662 | return Ok(true); |
| 663 | } |
| 664 | // The message composes BEFORE any staging so a cancelled editor leaves |
| 665 | // the working copy untouched (the same ordering the local body uses). |
| 666 | let message = args.get_message()?; |
| 667 | // Authorship mirrors the local precedence: --identity wins over |
| 668 | // --author; the handler turns the named identity into an author and |
| 669 | // signing credentials host-side. |
| 670 | let (author, identity_name) = if let Some(name) = args.identity.clone() { |
| 671 | (None, Some(name)) |
| 672 | } else { |
| 673 | // The local parse: "Name <email>" or a bare name. |
| 674 | let author = args.parse_author().map(|parsed| pb::Author { |
| 675 | name: parsed.name, |
| 676 | email: parsed.email, |
| 677 | }); |
| 678 | (author, None) |
| 679 | }; |
| 680 | let root = crate::commands::find_repository_root()?; |
| 681 | if args.skip_binary || args.max_size.is_some() { |
| 682 | session.ensure_record_file_options()?; |
no test coverage detected