(
&self,
repo: &mut Repository,
pre_confirmed: bool,
confirm: F,
)
| 231 | } |
| 232 | |
| 233 | fn execute_with_repo_gated<F>( |
| 234 | &self, |
| 235 | repo: &mut Repository, |
| 236 | pre_confirmed: bool, |
| 237 | confirm: F, |
| 238 | ) -> CliResult<()> |
| 239 | where |
| 240 | F: FnOnce(&str) -> CliResult<bool>, |
| 241 | { |
| 242 | let (working_copy, from_view, options) = self.plan(repo)?; |
| 243 | |
| 244 | if !self.dry_run && !self.confirm && !pre_confirmed { |
| 245 | self.preview_and_prompt(repo, working_copy, &from_view, &options, confirm)?; |
| 246 | } |
| 247 | |
| 248 | let outcome = repo |
| 249 | .split_view(working_copy, options) |
| 250 | .map_err(CliError::Repository)?; |
| 251 | |
| 252 | // ── Dry run: report the analysis. ── |
| 253 | if outcome.was_dry_run { |
| 254 | print_info(&format!( |
| 255 | "Dry run: splitting {} change(s) out of {}", |
| 256 | outcome.requested.len(), |
| 257 | style_view(&outcome.from_view), |
| 258 | )); |
| 259 | for c in &outcome.requested { |
| 260 | println!(" requested {}", style_hash(c.hash.to_base32())); |
| 261 | } |
| 262 | if outcome.blocked { |
| 263 | print_warning(&format!( |
| 264 | "Blocked: {} change(s) remaining in '{}' depend on the split-out set:", |
| 265 | outcome.dependents.len(), |
| 266 | outcome.from_view, |
| 267 | )); |
| 268 | for c in &outcome.dependents { |
| 269 | println!(" dependent {}", style_hash(c.hash.to_base32())); |
| 270 | } |
| 271 | print_hint("Re-run with --cascade to move the dependents too."); |
| 272 | } else { |
| 273 | if !outcome.dependents.is_empty() { |
| 274 | print_info(&format!( |
| 275 | "{} dependent change(s) would be moved along (--cascade):", |
| 276 | outcome.dependents.len(), |
| 277 | )); |
| 278 | for c in &outcome.dependents { |
| 279 | println!(" dependent {}", style_hash(c.hash.to_base32())); |
| 280 | } |
| 281 | } |
| 282 | print_info(&format!( |
| 283 | "Would create draft '{}' with {} change(s); '{}' would keep {} change(s).", |
| 284 | self.name, |
| 285 | outcome.moved.len(), |
| 286 | outcome.from_view, |
| 287 | outcome.source_change_count, |
| 288 | )); |
| 289 | } |
| 290 | return Ok(()); |
no test coverage detected