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

Method run

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

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