Commit log
Repository.
walk
(oid[, sort_mode]) → iteratorGenerator that traverses the history starting from the given commit.The following types of sorting could be used to control traversingdirection:
- GIT_SORT_NONE. This is the default sorting for new walkers.Sort the repository contents in no particular ordering
- GIT_SORT_TOPOLOGICAL. Sort the repository contents in topological order(parents before children); this sorting mode can be combined withtime sorting.
- GIT_SORT_TIME. Sort the repository contents by commit time
- GIT_SORT_REVERSE. Iterate through the repository contents in reverseorder; this sorting mode can be combined with any of the above.
Example:
- >>> 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)
- >>>