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

Method plan

atomic-cli/src/commands/view/split.rs:151–176  ·  view source on GitHub ↗

Plan the split: resolve the source view and the change set.

(&self, repo: &Repository)

Source from the content-addressed store, hash-verified

149
150 /// Plan the split: resolve the source view and the change set.
151 fn plan(&self, repo: &Repository) -> CliResult<(WorkingCopyId, String, SplitOptions)> {
152 let working_copy = repo
153 .require_working_copy_id()
154 .map_err(CliError::Repository)?;
155 let desired_view = repo
156 .desired_view_name(working_copy)
157 .map_err(CliError::Repository)?;
158 let from_view = self.from.clone().unwrap_or(desired_view);
159
160 // Resolve which changes to split: either an explicit list or --last N.
161 let change_hashes = self.resolve_changes(repo, &from_view)?;
162
163 let options = SplitOptions {
164 target_view: self.name.clone(),
165 from_view: Some(from_view.clone()),
166 changes: change_hashes,
167 cascade: self.cascade,
168 dry_run: self.dry_run,
169 // When switching, the draft is materialized by the switch below, so
170 // there's no need to reconcile the source we're leaving. Otherwise,
171 // refresh the source's working copy in place.
172 materialize: !self.switch,
173 };
174
175 Ok((working_copy, from_view, options))
176 }
177
178 /// Preview the split and require an explicit acknowledgement before it
179 /// is dispatched to the service or executed locally.

Callers 2

confirm_gateMethod · 0.45

Calls 4

desired_view_nameMethod · 0.80
resolve_changesMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected