pub struct HistoryIndex { /* private fields */ }vcs-git only.Expand description
The result of one history walk: per-file Stats keyed by
repository-relative path, plus walk-level metadata.
Implementations§
Source§impl HistoryIndex
impl HistoryIndex
Sourcepub fn new(
files: HashMap<PathBuf, Stats>,
workdir: Option<PathBuf>,
truncated_shallow_clone: bool,
) -> Self
pub fn new( files: HashMap<PathBuf, Stats>, workdir: Option<PathBuf>, truncated_shallow_clone: bool, ) -> Self
Construct an index from its parts. Used by backends.
Sourcepub fn with_bus_factor(self, bus_factor: Option<BusFactor>) -> Self
pub fn with_bus_factor(self, bus_factor: Option<BusFactor>) -> Self
Attach the directory- / repo-level bus-factor aggregate (issue
#332). A builder rather than a new parameter so the established
constructor signature stays source-compatible for downstream
backends; the aggregate is computed only when a front end opts in
via Options::compute_bus_factor.
Sourcepub fn bus_factor(&self) -> Option<&BusFactor>
pub fn bus_factor(&self) -> Option<&BusFactor>
The bus-factor aggregate, if it was computed for this walk.
Sourcepub fn vcs_aggregate(&self) -> Option<VcsAggregate>
pub fn vcs_aggregate(&self) -> Option<VcsAggregate>
The walk’s whole-repo aggregates wrapped in the top-level
bus_factor::VcsAggregate object the front ends
emit, or None when no aggregate was computed. The single
projection shared by the CLI / web / Python surfaces so the
vcs_aggregate shape cannot drift between them.
Sourcepub fn get(&self, repo_relative: &Path) -> Option<&Stats>
pub fn get(&self, repo_relative: &Path) -> Option<&Stats>
Look up stats by repository-relative path.
Sourcepub fn get_for_path(&self, absolute: &Path) -> Option<&Stats>
pub fn get_for_path(&self, absolute: &Path) -> Option<&Stats>
Look up stats for an absolute filesystem path by stripping the
working-tree prefix. Returns None for paths outside the work
tree or when the repository is bare (no work tree).
absolute must be in the same canonical form as the workdir
the index was built with (the gix-backed builder stores an
already-canonical workdir, and the CLI canonicalizes its inputs to
match). A non-canonical caller — a symlinked or ..-laden path that
does not share the stored prefix — silently yields None rather
than an error, so a future backend or external caller passing raw
paths must canonicalize first.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &Stats)>
pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &Stats)>
Iterate (repo-relative path, stats) pairs.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the index is empty (empty repo, or no tracked text files at the target ref).
Sourcepub fn truncated_shallow_clone(&self) -> bool
pub fn truncated_shallow_clone(&self) -> bool
true when the repository is a shallow clone and history was
therefore truncated; the front end surfaces this as a warning.
Sourcepub fn workdir(&self) -> Option<&Path>
pub fn workdir(&self) -> Option<&Path>
The repository working-tree root, if any (None for bare repos).
Sourcepub fn into_files(self) -> HashMap<PathBuf, Stats>
pub fn into_files(self) -> HashMap<PathBuf, Stats>
Consume the index, yielding its per-file map.
Trait Implementations§
Source§impl Clone for HistoryIndex
impl Clone for HistoryIndex
Source§fn clone(&self) -> HistoryIndex
fn clone(&self) -> HistoryIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more