@@ -4,54 +4,6 @@ use gix_hashtable::HashSet;
44use smallvec:: SmallVec ;
55use std:: collections:: VecDeque ;
66
7- /// Specify how to sort commits during traversal.
8- ///
9- /// ### Sample History
10- ///
11- /// The following history will be referred to for explaining how the sort order works, with the number denoting the commit timestamp
12- /// (*their X-alignment doesn't matter*).
13- ///
14- /// ```text
15- /// ---1----2----4----7 <- second parent of 8
16- /// \ \
17- /// 3----5----6----8---
18- /// ```
19-
20- #[ derive( Default , Debug , Copy , Clone ) ]
21- pub enum Sorting {
22- /// Commits are sorted as they are mentioned in the commit graph.
23- ///
24- /// In the *sample history* the order would be `8, 6, 7, 5, 4, 3, 2, 1`
25- ///
26- /// ### Note
27- ///
28- /// This is not to be confused with `git log/rev-list --topo-order`, which is notably different from
29- /// as it avoids overlapping branches.
30- #[ default]
31- BreadthFirst ,
32- /// Commits are sorted by their commit time in descending order, that is newest first.
33- ///
34- /// The sorting applies to all currently queued commit ids and thus is full.
35- ///
36- /// In the *sample history* the order would be `8, 7, 6, 5, 4, 3, 2, 1`
37- ///
38- /// # Performance
39- ///
40- /// This mode benefits greatly from having an object_cache in `find()`
41- /// to avoid having to lookup each commit twice.
42- ByCommitTimeNewestFirst ,
43- /// This sorting is similar to `ByCommitTimeNewestFirst`, but adds a cutoff to not return commits older than
44- /// a given time, stopping the iteration once no younger commits is queued to be traversed.
45- ///
46- /// As the query is usually repeated with different cutoff dates, this search mode benefits greatly from an object cache.
47- ///
48- /// In the *sample history* and a cut-off date of 4, the returned list of commits would be `8, 7, 6, 4`
49- ByCommitTimeNewestFirstCutoffOlderThan {
50- /// The amount of seconds since unix epoch, the same value obtained by any `gix_date::Time` structure and the way git counts time.
51- seconds : gix_date:: SecondsSinceUnixEpoch ,
52- } ,
53- }
54-
557/// The error is part of the item returned by the [Ancestors](super::Ancestors) iterator.
568#[ derive( Debug , thiserror:: Error ) ]
579#[ allow( missing_docs) ]
@@ -81,8 +33,8 @@ mod init {
8133 use gix_object:: { CommitRefIter , FindExt } ;
8234
8335 use super :: {
84- super :: { Ancestors , Either , Info , ParentIds , Parents } ,
85- collect_parents, Error , Sorting , State ,
36+ super :: { Ancestors , Either , Info , ParentIds , Parents , Sorting } ,
37+ collect_parents, Error , State ,
8638 } ;
8739
8840 impl Default for State {
0 commit comments