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 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:
  1. >>> from pygit2 import Repository
  2. >>> from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE
  3. >>> repo = Repository('.git')
  4. >>> for commit in repo.walk(repo.head.target, GIT_SORT_TOPOLOGICAL):
  5. ... print(commit.message)
  6. >>> for commit in repo.walk(repo.head.target, GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE):
  7. ... print(commit.message)
  8. >>>
  • 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.