pub enum Sorting {
    BreadthFirst,
    ByCommitTimeNewestFirst,
    ByCommitTimeNewestFirstCutoffOlderThan {
        seconds: SecondsSinceUnixEpoch,
    },
}
Expand description

Specify how to sort commits during 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.

§

ByCommitTimeNewestFirst

Commits are sorted by their commit time in descending order, that is newest 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

Performance

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

§

ByCommitTimeNewestFirstCutoffOlderThan

Fields

§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.

This sorting is similar to ByCommitTimeNewestFirst, 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

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.