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

Method run

atomic-cli/src/commands/record/command.rs:17–148  ·  view source on GitHub ↗

Execute the record command. # Process 1. Find and open the repository 2. Get the commit message (from argument, editor, or prompt) 3. Detect changes in the working copy 4. If --all, add untracked files 5. If --dry-run, display preview and exit 6. Create the change from modifications 7. Save the change to the store 8. Apply the change to the current view 9. Display the result

(&self)

Source from the content-addressed store, hash-verified

15 /// 8. Apply the change to the current view
16 /// 9. Display the result
17 fn run(&self) -> CliResult<()> {
18 // Find repository
19 let repo_root = find_repository_root()?;
20 let repo = Repository::open(&repo_root).map_err(CliError::Repository)?;
21
22 // Handle dry run
23 if self.dry_run {
24 return self.display_dry_run(&repo);
25 }
26
27 // Get commit message
28 let message = self.get_message()?;
29
30 // Resolve author from identity or command-line
31 let author = self.resolve_author()?;
32
33 // Build change header
34 let mut header_builder = ChangeHeader::builder().message(&message);
35
36 if let Some(author) = author {
37 header_builder = header_builder.author(author);
38 }
39
40 let header = header_builder.build();
41
42 // Build record options
43 let mut options = self.build_options()?;
44
45 // Resolve the signing identity and attach signing credentials.
46 // The signing identity is the same one that supplied the author.
47 // When no identity is available the change records unsigned.
48 match self.resolve_signing_identity()? {
49 Some(signing) => {
50 options = options.with_signing_identity(signing);
51 }
52 None => {
53 print_warning(
54 "No signing identity available — recording change UNSIGNED. \
55 Others cannot verify authorship. Run `atomic identity new` \
56 and `atomic identity default <name>` to enable signing.",
57 );
58 }
59 }
60
61 // If --all, first add all untracked files
62 if self.all {
63 let status = repo
64 .status(StatusOptions::default())
65 .map_err(CliError::Repository)?;
66
67 for entry in status.untracked() {
68 let path = entry.path();
69 if let Err(e) = repo.add(path, Default::default()) {
70 print_warning(&format!("Failed to add '{}': {}", path.display(), e));
71 }
72 }
73 }
74

Calls 15

find_repository_rootFunction · 0.85
print_warningFunction · 0.85
RepositoryClass · 0.85
print_hintFunction · 0.85
resolve_authorMethod · 0.80
authorMethod · 0.80
build_optionsMethod · 0.80
with_signing_identityMethod · 0.80
untrackedMethod · 0.80
format_outcomeMethod · 0.80
skipped_filesMethod · 0.80