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

Method run

atomic-cli/src/commands/record/command.rs:20–208  ·  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 --dry-run, display preview and exit 5. Create the change from modifications (including untracked files for --all) 6. Save the change to the store 7. Apply the change to the current view 8. Display the result

(&self)

Source from the content-addressed store, hash-verified

18 /// 7. Apply the change to the current view
19 /// 8. Display the result
20 fn run(&self) -> CliResult<()> {
21 if crate::commands::rpc::record(self)? {
22 return Ok(());
23 }
24
25 // Find repository
26 let repo_root = find_repository_root()?;
27
28 let mode = if self.dry_run {
29 WorkspaceTxnMode::Observe
30 } else {
31 WorkspaceTxnMode::Reconcile
32 };
33 let mut repo = if self.dry_run {
34 Repository::open_readonly(&repo_root)
35 } else {
36 Repository::open_for_workspace_transaction(&repo_root)
37 }
38 .map_err(CliError::Repository)?;
39
40 // Narrow metadata-only route: an explicit, scoped
41 // `record --allow-conflict-markers <paths>` whose preflight proves every
42 // named path is already recorded (working bytes equal the canonical
43 // render, no graph conflict) and only stale CONFLICTS metadata needs to
44 // change. That administrative cleanup needs no anchored Git baseline and
45 // must not execute the workspace boundary's recovery/import effects, so
46 // it runs through the leased reconcile API directly. Anything not proven
47 // metadata-only falls through to the ordinary boundary and record path,
48 // which clears nothing when it refuses.
49 if !self.dry_run && self.allow_conflict_markers && !self.all && !self.files.is_empty() {
50 let working_copy = repo
51 .require_working_copy_id()
52 .map_err(CliError::Repository)?;
53 if let Some(cleanup) = repo
54 .record_metadata_only_conflict_cleanup(working_copy, &self.files)
55 .map_err(CliError::Repository)?
56 {
57 print!(
58 "{}",
59 super::format::format_conflict_cleanup(
60 &cleanup.view,
61 &cleanup.cleared_paths,
62 cleanup.cleared_rows,
63 cleanup.operation,
64 )
65 );
66 return Ok(());
67 }
68 }
69
70 let workspace = enter_workspace(&mut repo, mode)?;
71 let working_copy = workspace.working_copy();
72 let view_name = workspace.view().name.clone();
73
74 // Handle dry run
75 if self.dry_run {
76 return self.display_dry_run(&repo, working_copy);
77 }

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