Skip to main content

HistoryIndex

Struct HistoryIndex 

Source
pub struct HistoryIndex { /* private fields */ }
Available on crate feature 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

Source

pub fn new( files: HashMap<PathBuf, Stats>, workdir: Option<PathBuf>, truncated_shallow_clone: bool, ) -> Self

Construct an index from its parts. Used by backends.

Source

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.

Source

pub fn bus_factor(&self) -> Option<&BusFactor>

The bus-factor aggregate, if it was computed for this walk.

Source

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.

Source

pub fn get(&self, repo_relative: &Path) -> Option<&Stats>

Look up stats by repository-relative path.

Source

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.

Source

pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &Stats)>

Iterate (repo-relative path, stats) pairs.

Source

pub fn len(&self) -> usize

Number of files in the index.

Source

pub fn is_empty(&self) -> bool

Whether the index is empty (empty repo, or no tracked text files at the target ref).

Source

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.

Source

pub fn workdir(&self) -> Option<&Path>

The repository working-tree root, if any (None for bare repos).

Source

pub fn into_files(self) -> HashMap<PathBuf, Stats>

Consume the index, yielding its per-file map.

Trait Implementations§

Source§

impl Clone for HistoryIndex

Source§

fn clone(&self) -> HistoryIndex

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HistoryIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HistoryIndex

Source§

fn default() -> HistoryIndex

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.