gix_traverse::commit::simple

Enum Sorting

Source
pub enum Sorting {
    BreadthFirst,
    ByCommitTime(CommitTimeOrder),
    ByCommitTimeCutoff {
        order: CommitTimeOrder,
        seconds: SecondsSinceUnixEpoch,
    },
}
Expand description

Specify how to sort commits during a simple traversal.

§Sample History

The following history will be referred to for explaining how the sort order works, with the number denoting the commit timestamp (their X-alignment doesn’t matter).

---1----2----4----7 <- second parent of 8
    \              \
     3----5----6----8---

Variants§

§

BreadthFirst

Commits are sorted as they are mentioned in the commit graph.

In the sample history the order would be 8, 6, 7, 5, 4, 3, 2, 1.

§Note

This is not to be confused with git log/rev-list --topo-order, which is notably different from as it avoids overlapping branches.

§

ByCommitTime(CommitTimeOrder)

Commits are sorted by their commit time in the order specified, either newest or oldest first.

The sorting applies to all currently queued commit ids and thus is full.

In the sample history the order would be 8, 7, 6, 5, 4, 3, 2, 1 for NewestFirst, or 1, 2, 3, 4, 5, 6, 7, 8 for OldestFirst.

§Performance

This mode benefits greatly from having an object_cache in find() to avoid having to lookup each commit twice.

§

ByCommitTimeCutoff

This sorting is similar to ByCommitTime, but adds a cutoff to not return commits older than a given time, stopping the iteration once no younger commits is queued to be traversed.

As the query is usually repeated with different cutoff dates, this search mode benefits greatly from an object cache.

In the sample history and a cut-off date of 4, the returned list of commits would be 8, 7, 6, 4.

Fields

§order: CommitTimeOrder

The order in which to prioritize lookups.

§seconds: SecondsSinceUnixEpoch

The amount of seconds since unix epoch, the same value obtained by any gix_date::Time structure and the way git counts time.

Trait Implementations§

Source§

impl Clone for Sorting

Source§

fn clone(&self) -> Sorting

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Sorting

Source§

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

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

impl Default for Sorting

Source§

fn default() -> Sorting

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

impl Copy for Sorting

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.