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)
| 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 |
nothing calls this directly
no test coverage detected