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

Method run

atomic-cli/src/commands/change/command.rs:744–772  ·  view source on GitHub ↗

Execute the change command. This method: 1. Finds the repository root 2. Resolves the change identifier to a hash 3. Loads the change from the store 4. Formats and displays the change # Errors Returns a `CliError` if: - No repository is found - The change identifier is invalid - The change is not found - The hash prefix is ambiguous

(&self)

Source from the content-addressed store, hash-verified

742 /// - The change is not found
743 /// - The hash prefix is ambiguous
744 fn run(&self) -> CliResult<()> {
745 // Find and open repository
746 let repo_root = find_repository_root()?;
747 let repo = Repository::open_readonly(&repo_root).map_err(|e| match e {
748 atomic_repository::RepositoryError::NotFound { path } => CliError::RepositoryNotFound {
749 searched_path: path.into(),
750 },
751 atomic_repository::RepositoryError::ViewNotFound { name } => {
752 CliError::ViewNotFound { name }
753 }
754 other => CliError::Internal(anyhow::anyhow!("{}", other)),
755 })?;
756
757 // Resolve identifier
758 let (hash, sequence) = self.resolve_identifier(&repo)?;
759
760 // Load the change
761 let change = repo.load_change(&hash).map_err(|e| match e {
762 atomic_repository::RepositoryError::ChangeNotFound { hash } => {
763 CliError::ChangeNotFound { hash }
764 }
765 other => CliError::Internal(anyhow::anyhow!("{}", other)),
766 })?;
767
768 // Print the change
769 self.print_change(&change, &hash, sequence, &repo);
770
771 Ok(())
772 }
773}
774
775// Helper Functions

Calls 4

find_repository_rootFunction · 0.85
resolve_identifierMethod · 0.80
print_changeMethod · 0.80
load_changeMethod · 0.45