iter t
iterates in topological order over the closure graph of t
. If rev
is set (by default it is) the traversal is done in reverse order.
skip_branch
, skip_commit
, skip_node
and skip_contents
allow the traversal to be stopped when the corresponding objects are traversed. By default no objects are skipped.
The branch
, commit
, node
and contents
functions are called whenever the corresponding objects are traversed. By default these functions do nothing. These functions are not called on skipped objects.
pred_branch
, pred_commit
, pred_node
and pred_contents
implicitly define the graph underlying the traversal. By default they exactly match the underlying Merkle graph of the repository t
. These functions can be used to traverse a slightly modified version of that graph, for instance by modifying pred_contents
to implicitly link structured contents with other objects in the graph.
The traversed objects are all included between min
(included) and max
(included), following the Merkle graph order. Moreover, the min
boundary is extended as follows:
- contents and node objects in
min
stop the traversal; their predecessors are not traversed. - commit objects in
min
stop the traversal for their commit predecessors, but their sub-node are still traversed. This allows users to define an inclusive range of commit to iterate over. - branch objects in
min
implicitly add to min
the commit they are pointing to; this allow users to define the iteration between two branches.
cache_size
is the size of the LRU used to store traversed objects. If an entry is evicted from the LRU, it can be traversed multiple times by Repo.iter
. When cache_size
is None
(the default), no entries is ever evicted from the cache; hence every object is only traversed once, at the cost of having to store all the traversed objects in memory.