(&self, git: &GitRepository, workdir: &Path)
| 1000 | impl Import { |
| 1001 | #[cfg(feature = "experimental-span-import")] |
| 1002 | fn run_span_incremental(&self, git: &GitRepository, workdir: &Path) -> CliResult<()> { |
| 1003 | if self.dry_run { |
| 1004 | return Err(CliError::GitError { |
| 1005 | message: "span incremental dry-run is not supported; no import was started".into(), |
| 1006 | }); |
| 1007 | } |
| 1008 | if self.all_branches |
| 1009 | || self.with_crdt |
| 1010 | || self.no_stream |
| 1011 | || self.detached_tip.is_some() |
| 1012 | || self.reactive_budget.is_some() |
| 1013 | { |
| 1014 | return Err(CliError::GitError { |
| 1015 | message: "span incremental import requires a checked-out first-parent branch" |
| 1016 | .into(), |
| 1017 | }); |
| 1018 | } |
| 1019 | let _preflight = Repository::try_lock_git_import_for_span(workdir, false) |
| 1020 | .map_err(|error| CliError::GitError { |
| 1021 | message: format!("span import preflight refused: {error}"), |
| 1022 | })? |
| 1023 | .ok_or_else(|| CliError::GitError { |
| 1024 | message: "span incremental import requires an existing span repository".into(), |
| 1025 | })?; |
| 1026 | let pinned = SpanIncrementalGitObservation::capture(git)?; |
| 1027 | if self |
| 1028 | .branch |
| 1029 | .as_ref() |
| 1030 | .is_some_and(|branch| branch != &pinned.branch) |
| 1031 | { |
| 1032 | return Err(CliError::GitError { |
| 1033 | message: "span incremental import only supports the checked-out Git branch".into(), |
| 1034 | }); |
| 1035 | } |
| 1036 | let mut repo = Repository::open(workdir).map_err(CliError::from)?; |
| 1037 | let limits = self.stream_limits()?; |
| 1038 | let importer = ParallelImporter::new( |
| 1039 | git, |
| 1040 | ParallelImportOptions { |
| 1041 | graph_only: true, |
| 1042 | span_stream: true, |
| 1043 | mainline_only: true, |
| 1044 | // The pinned Git branch names the target. The view is never |
| 1045 | // taken from the handle's ambient selection; the importer |
| 1046 | // refuses unless the two already agree. |
| 1047 | target_view: pinned.branch.clone(), |
| 1048 | ..Default::default() |
| 1049 | }, |
| 1050 | ); |
| 1051 | importer.require_target_is_current_view(&repo)?; |
| 1052 | let plan = |
| 1053 | importer.validate_graph_stream_prospectively(&pinned.branch, pinned.tip, limits)?; |
| 1054 | let expected_tree = plan.expected_git_tree().ok_or_else(|| CliError::GitError { |
| 1055 | message: "span incremental preflight did not produce a Git tree proof".into(), |
| 1056 | })?; |
| 1057 | let raw_tree = plan.raw_git_tree().ok_or_else(|| CliError::GitError { |
| 1058 | message: "span incremental preflight did not record the raw Git tree".into(), |
| 1059 | })?; |
no test coverage detected