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

Method run

atomic-cli/src/commands/revise.rs:741–785  ·  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

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