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

Method run

atomic-cli/src/commands/revise.rs:746–790  ·  view source on GitHub ↗

Execute the revise command. # Process 1. Parse and resolve the change reference 2. If dry-run, show what would happen and exit 3. Unrecord changes from target to top 4. Get new message (from arg, editor, or original) 5. Record the revised change 6. Re-apply subsequent changes

(&self)

Source from the content-addressed store, hash-verified

744 /// 5. Record the revised change
745 /// 6. Re-apply subsequent changes
746 fn run(&self) -> CliResult<()> {
747 // Find and open repository
748 let repo_root = find_repository_root()?;
749 let repo = Repository::open(&repo_root).map_err(CliError::Repository)?;
750
751 // Resolve the reference
752 let (sequence, entry) = self.resolve_reference(&repo)?;
753
754 // Dry run mode
755 if self.dry_run {
756 return self.display_dry_run(&repo, sequence, &entry);
757 }
758
759 // Check for uncommitted changes if not in reword mode
760 if !self.reword {
761 let status = repo
762 .status(StatusOptions::default())
763 .map_err(CliError::Repository)?;
764
765 if status.is_clean() && self.message.is_none() {
766 print_warning("No changes to revise. Use --reword to only change the message.");
767 return Ok(());
768 }
769 }
770
771 // Execute the revise
772 let change_ref = self.parse_reference();
773 println!(
774 "Revising change {} (sequence #{})...",
775 change_ref.description(),
776 sequence
777 );
778
779 let new_hash = self.execute_revise(&repo, sequence, &entry)?;
780
781 // Success message
782 println!();
783 print_success(&format!(
784 "Revised {} → {}",
785 format_hash(&entry.hash, false),
786 format_hash(&new_hash, false)
787 ));
788
789 Ok(())
790 }
791}
792
793// Tests

Callers

nothing calls this directly

Calls 10

find_repository_rootFunction · 0.85
print_warningFunction · 0.85
print_successFunction · 0.85
resolve_referenceMethod · 0.80
is_noneMethod · 0.80
parse_referenceMethod · 0.80
execute_reviseMethod · 0.80
display_dry_runMethod · 0.45
statusMethod · 0.45
is_cleanMethod · 0.45

Tested by

no test coverage detected