Optionally switch to the new draft view.
(&self, repo: &mut Repository, working_copy: WorkingCopyId)
| 380 | |
| 381 | /// Optionally switch to the new draft view. |
| 382 | fn maybe_switch(&self, repo: &mut Repository, working_copy: WorkingCopyId) -> CliResult<()> { |
| 383 | if self.switch { |
| 384 | let result = repo |
| 385 | .switch_view(working_copy, &self.name) |
| 386 | .map_err(CliError::Repository)?; |
| 387 | print_success(&format!( |
| 388 | "Switched to view: {} ({} files updated)", |
| 389 | style_view(&self.name), |
| 390 | result.files_written, |
| 391 | )); |
| 392 | } else { |
| 393 | print_hint(&format!( |
| 394 | "Use 'atomic view switch {}' to switch to the new draft", |
| 395 | self.name |
| 396 | )); |
| 397 | } |
| 398 | Ok(()) |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | #[cfg(test)] |
no test coverage detected