(
repo: &'a mut Repository,
limits: GitStreamLimits,
)
| 490 | } |
| 491 | impl<'a> GitGraphImportSession<'a> { |
| 492 | pub fn begin( |
| 493 | repo: &'a mut Repository, |
| 494 | limits: GitStreamLimits, |
| 495 | ) -> Result<Self, RepositoryError> { |
| 496 | let target = repo.current_view().to_string(); |
| 497 | if !repo.registered_change_hashes()?.is_empty() { |
| 498 | return Err(invalid("direct stream requires a fresh repository; existing/native history is not supported")); |
| 499 | } |
| 500 | let view = repo |
| 501 | .pristine |
| 502 | .read_txn()? |
| 503 | .get_view(&target)? |
| 504 | .ok_or_else(|| invalid("missing target view"))?; |
| 505 | if view.change_count != 0 || view.state != Merkle::ZERO { |
| 506 | return Err(invalid("stream target must be empty")); |
| 507 | } |
| 508 | let stage = "git-stream-private".to_string(); |
| 509 | repo.pristine |
| 510 | .require_repository_capability(super::CHANGE_FORMAT_VNEXT_CAPABILITY)?; |
| 511 | repo.create_draft_view(&stage, &target)?; |
| 512 | Ok(Self { |
| 513 | repo, |
| 514 | stage, |
| 515 | target, |
| 516 | limits, |
| 517 | target_id: view.id, |
| 518 | target_state: view.state, |
| 519 | target_count: view.change_count, |
| 520 | baseline_git_tree: None, |
| 521 | retained_private: BTreeMap::new(), |
| 522 | base_prefix: Vec::new(), |
| 523 | base_hashes: Vec::new(), |
| 524 | hashes: Vec::new(), |
| 525 | last_sha: None, |
| 526 | last_hash: None, |
| 527 | batches: 0, |
| 528 | publish_seconds: 0.0, |
| 529 | span_mode: false, |
| 530 | }) |
| 531 | } |
| 532 | |
| 533 | /// Begin span-backed streaming into a fresh, untracked repository. |
| 534 | pub fn begin_span( |
nothing calls this directly
no test coverage detected