Plan the split: resolve the source view and the change set.
(&self, repo: &Repository)
| 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. |
no test coverage detected