- Repository.walk(oid: Oid | None, sort_mode: int = GIT_SORT_NONE) Walker
Start traversing the history from the given commit. The following types of sorting could be used to control traversing direction:
GIT_SORT_NONE. Sort the output with the same default method from git: reverse chronological order. This is the default sorting for new walkers.
GIT_SORT_TOPOLOGICAL. Sort the repository contents in topological order (no parents before all of its children are shown); this sorting mode can be combined with time sorting to produce git’s –date-order`.
GIT_SORT_TIME. Sort the repository contents by commit time; this sorting mode can be combined with topological sorting.
GIT_SORT_REVERSE. Iterate through the repository contents in reverse order; this sorting mode can be combined with any of the above.
>>> from pygit2 import Repository >>> from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE >>> repo = Repository('.git') >>> for commit in repo.walk(repo.head.target, GIT_SORT_TOPOLOGICAL): ... print(commit.message) >>> for commit in repo.walk(repo.head.target, GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE): ... print(commit.message) >>>
- Walker.hide(oid: Oid)
Mark a commit (and its ancestors) uninteresting for the output.
- Walker.push(oid: Oid)
Mark a commit to start traversal from.
Reset the walking machinery for reuse.
- Walker.sort(mode: int)
Change the sorting mode (this resets the walker).
Simplify the history by first-parent.