| 21 | } |
| 22 | |
| 23 | pub(super) fn resolve(repo: &Repository, args: &IncrementalArgs) -> CliResult<IncrementalReport> { |
| 24 | let name = args |
| 25 | .view |
| 26 | .as_deref() |
| 27 | .ok_or_else(|| invalid("Missing --view name"))?; |
| 28 | if name.is_empty() || name.trim() != name { |
| 29 | return Err(invalid("--view requires an exact nonempty view name")); |
| 30 | } |
| 31 | if args.change.is_some() |
| 32 | || args.turn.is_some() |
| 33 | || args.intent.is_some() |
| 34 | || args.findings.is_some() |
| 35 | || args.risk_profile.is_some() |
| 36 | || args.from.is_some() |
| 37 | || args.to.is_some() |
| 38 | { |
| 39 | return Err(invalid("--view is a snapshot selector; it cannot be combined with change/turn/intent selectors, supplied change findings or a change-risk profile")); |
| 40 | } |
| 41 | let mut report = collect(repo, name)?; |
| 42 | let snapshot = report.view_snapshot.as_mut().expect("resolved snapshot"); |
| 43 | snapshot.conformance = Some(super::view_comparison::collect_view(repo, snapshot)?); |
| 44 | report.graph = Some(super::graph::build(repo, &report, None, None)?); |
| 45 | verify(repo, &report)?; |
| 46 | Ok(report) |
| 47 | } |
| 48 | |
| 49 | pub(super) fn collect(repo: &Repository, name: &str) -> CliResult<IncrementalReport> { |
| 50 | let info = repo.get_view_info(name).map_err(CliError::Repository)?; |