Commit log¶
-
Repository.
walk
(oid[, sort_mode]) → iterator¶ Generator that traverses the history starting from the given commit. The following types of sorting could be used to control traversing direction:
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 with time sorting.
GIT_SORT_TIME. Sort the repository contents by commit time
GIT_SORT_REVERSE. Iterate through the repository contents in reverse order; 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) >>>
-
Walker.
hide
(oid)¶ Mark a commit (and its ancestors) uninteresting for the output.
-
Walker.
push
(oid)¶ Mark a commit to start traversal from.
-
Walker.
reset
()¶ Reset the walking machinery for reuse.
-
Walker.
sort
(mode)¶ Change the sorting mode (this resets the walker).
-
Walker.
simplify_first_parent
()¶ Simplify the history by first-parent.