Skip to main content

build_trend

Function build_trend 

Source
pub fn build_trend(
    root: &Path,
    options: &Options,
    points: usize,
    span_secs: i64,
) -> Result<Trend, Error>
Available on crate feature vcs-git only.
Expand description

Sample the change-history metrics at points evenly-spaced moments across span_secs, ending at options.as_of (or wall-clock now), building a trend::Trend time series (issue #333).

Each point re-anchors at the mainline tip that existed at or before that moment, so the result is a faithful historical snapshot rather than today’s tree windowed differently — see trend for the schema and the cross-snapshot rename limitation. options supplies the windows / bot / merge / rename / formula knobs shared by every point; its reference selects which mainline to follow.

§Errors

Returns Error::InvalidTrend when points is outside [MIN_TREND_POINTS, MAX_TREND_POINTS] (trend::MIN_TREND_POINTS / trend::MAX_TREND_POINTS), Error::NotARepository when root is not a working tree, Error::ResolveRef when the base reference does not resolve, or a walk/diff variant when a sampled snapshot fails.