Optionally switch to the new view and print hint. The switch coordinates the Git shadow exactly like `atomic view switch` does (CB-8A): the materialized view projects onto its mapped ref with the scope-correct HEAD policy and a verified checkpoint, so the next workspace entry stays anchored.
(
&self,
name: &str,
repo: &mut Repository,
working_copy: atomic_core::WorkingCopyId,
repo_root: &std::path::Path,
)
| 312 | /// ref with the scope-correct HEAD policy and a verified checkpoint, so |
| 313 | /// the next workspace entry stays anchored. |
| 314 | fn maybe_switch( |
| 315 | &self, |
| 316 | name: &str, |
| 317 | repo: &mut Repository, |
| 318 | working_copy: atomic_core::WorkingCopyId, |
| 319 | repo_root: &std::path::Path, |
| 320 | ) -> CliResult<()> { |
| 321 | if self.switch { |
| 322 | let result = repo |
| 323 | .switch_view(working_copy, name) |
| 324 | .map_err(CliError::Repository)?; |
| 325 | print_success(&format!( |
| 326 | "Switched to view: {} ({} files updated)", |
| 327 | style_view(name), |
| 328 | result.files_written, |
| 329 | )); |
| 330 | } else { |
| 331 | print_hint(&format!( |
| 332 | "Use 'atomic view switch {}' to switch to the new view", |
| 333 | name |
| 334 | )); |
| 335 | } |
| 336 | Ok(()) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | impl Command for New { |
no test coverage detected