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

Method run

atomic-cli/src/commands/status.rs:516–575  ·  view source on GitHub ↗

Execute the status command. This method: 1. Finds and opens the repository 2. Computes the working copy status 3. Displays the status in the requested format # Errors Returns an error if: - No repository is found - The repository cannot be opened - Status computation fails

(&self)

Source from the content-addressed store, hash-verified

514 /// - The repository cannot be opened
515 /// - Status computation fails
516 fn run(&self) -> CliResult<()> {
517 // Find the repository root
518 let repo_root = find_repository_root()?;
519
520 // Reindex first if requested (needs read-write access)
521 if self.reindex {
522 let rw_repo =
523 Repository::open(&repo_root).map_err(|e| CliError::InvalidRepository {
524 reason: e.to_string(),
525 })?;
526 let start = std::time::Instant::now();
527 match rw_repo.reindex_working_copy() {
528 Ok(count) => {
529 if !self.json {
530 print_info(&format!(
531 "Reindexed {} files in {:.1}s",
532 count,
533 start.elapsed().as_secs_f64()
534 ));
535 }
536 }
537 Err(e) => {
538 if self.json {
539 return Err(CliError::Internal(e.into()));
540 }
541 print_warning(&format!("Reindex failed: {}", e));
542 }
543 }
544 drop(rw_repo);
545 }
546
547 // Open the repository
548 let repo = crate::commands::open_readonly_repository(&repo_root).map_err(|e| {
549 CliError::InvalidRepository {
550 reason: e.to_string(),
551 }
552 })?;
553
554 // Debug ignore patterns if requested
555 if self.debug_ignore {
556 self.print_ignore_debug(&repo)?;
557 }
558
559 // Get status options
560 let options = self.get_status_options();
561
562 // Compute status
563 let status = repo
564 .status(options)
565 .map_err(|e| CliError::Internal(e.into()))?;
566
567 // Print in appropriate format
568 if self.json {
569 self.print_json_format(&status, &repo_root)
570 } else if self.short {
571 self.print_short_format(&status)
572 } else {
573 self.print_long_format(&status)

Calls 11

find_repository_rootFunction · 0.85
print_infoFunction · 0.85
print_warningFunction · 0.85
open_readonly_repositoryFunction · 0.85
reindex_working_copyMethod · 0.80
print_ignore_debugMethod · 0.80
get_status_optionsMethod · 0.80
print_json_formatMethod · 0.80
print_short_formatMethod · 0.80
print_long_formatMethod · 0.80
statusMethod · 0.45