(&self, git: &GitRepository, workdir: &Path)
| 941 | impl Import { |
| 942 | #[cfg(feature = "experimental-span-import")] |
| 943 | fn run_span_incremental(&self, git: &GitRepository, workdir: &Path) -> CliResult<()> { |
| 944 | if self.dry_run { |
| 945 | return Err(CliError::GitError { |
| 946 | message: "span incremental dry-run is not supported; no import was started".into(), |
| 947 | }); |
| 948 | } |
| 949 | if self.all_branches |
| 950 | || self.with_crdt |
| 951 | || self.no_stream |
| 952 | || self.detached_tip.is_some() |
| 953 | || self.reactive_budget.is_some() |
| 954 | { |
| 955 | return Err(CliError::GitError { |
| 956 | message: "span incremental import requires a checked-out first-parent branch" |
| 957 | .into(), |
| 958 | }); |
| 959 | } |
| 960 | let _preflight = Repository::try_lock_git_import_for_span(workdir, false) |
| 961 | .map_err(|error| CliError::GitError { |
| 962 | message: format!("span import preflight refused: {error}"), |
| 963 | })? |
| 964 | .ok_or_else(|| CliError::GitError { |
| 965 | message: "span incremental import requires an existing span repository".into(), |
| 966 | })?; |
| 967 | let pinned = SpanIncrementalGitObservation::capture(git)?; |
| 968 | if self |
| 969 | .branch |
| 970 | .as_ref() |
| 971 | .is_some_and(|branch| branch != &pinned.branch) |
| 972 | { |
| 973 | return Err(CliError::GitError { |
| 974 | message: "span incremental import only supports the checked-out Git branch".into(), |
| 975 | }); |
| 976 | } |
| 977 | let mut repo = Repository::open(workdir).map_err(CliError::from)?; |
| 978 | let limits = self.stream_limits()?; |
| 979 | let importer = ParallelImporter::new( |
| 980 | git, |
| 981 | ParallelImportOptions { |
| 982 | graph_only: true, |
| 983 | span_stream: true, |
| 984 | mainline_only: true, |
| 985 | // The pinned Git branch names the target. The view is never |
| 986 | // taken from the handle's ambient selection; the importer |
| 987 | // refuses unless the two already agree. |
| 988 | target_view: pinned.branch.clone(), |
| 989 | ..Default::default() |
| 990 | }, |
| 991 | ); |
| 992 | importer.require_target_is_current_view(&repo)?; |
| 993 | let plan = |
| 994 | importer.validate_graph_stream_prospectively(&pinned.branch, pinned.tip, limits)?; |
| 995 | let expected_tree = plan.expected_git_tree().ok_or_else(|| CliError::GitError { |
| 996 | message: "span incremental preflight did not produce a Git tree proof".into(), |
| 997 | })?; |
| 998 | let raw_tree = plan.raw_git_tree().ok_or_else(|| CliError::GitError { |
| 999 | message: "span incremental preflight did not record the raw Git tree".into(), |
| 1000 | })?; |
no test coverage detected