diff options
Diffstat (limited to 'src/watch/upstream.rs')
| -rw-r--r-- | src/watch/upstream.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/watch/upstream.rs b/src/watch/upstream.rs index 002d72b..c3e4954 100644 --- a/src/watch/upstream.rs +++ b/src/watch/upstream.rs @@ -17,12 +17,40 @@ pub struct StageA { } impl StageA { + /// Detection consults it; the VCS test that asserts it needs a real mirror. + /// + /// Module-internal in a production build, `pub` only under `test-support`: + /// one body behind two visibility declarations, exactly one of which compiles. + #[cfg(feature = "test-support")] pub fn needs_stage_b(&self) -> bool { + Self::needs_stage_b_impl(self) + } + + #[cfg(not(feature = "test-support"))] + pub(crate) fn needs_stage_b(&self) -> bool { + Self::needs_stage_b_impl(self) + } + + fn needs_stage_b_impl(&self) -> bool { self.moved || !self.unprobed.is_empty() } } +/// Detection calls it on every expensive poll; the tests that pin it need a fixture. +/// +/// Module-internal in a production build, `pub` only under `test-support`: +/// one body behind two visibility declarations, exactly one of which compiles. +#[cfg(feature = "test-support")] pub fn probe(recipe: &Recipe, accepted: &[UpstreamPin]) -> Result<StageA> { + probe_impl(recipe, accepted) +} + +#[cfg(not(feature = "test-support"))] +pub(crate) fn probe(recipe: &Recipe, accepted: &[UpstreamPin]) -> Result<StageA> { + probe_impl(recipe, accepted) +} + +fn probe_impl(recipe: &Recipe, accepted: &[UpstreamPin]) -> Result<StageA> { let mut pins = Vec::new(); let mut unprobed = Vec::new(); for entry in recipe.source_entries.iter().filter(|e| e.is_vcs()) { |
