dulwich.walk module

General implementation of walking commits and their contents.

class dulwich.walk.WalkEntry(walker, commit)

Bases: object

Object encapsulating a single result from a walk.

changes(path_prefix=None)

Get the tree changes for this entry.

Parameters

path_prefix – Portion of the path in the repository to use to filter changes. Must be a directory name. Must be a full, valid, path reference (no partial names or wildcards).

Returns: For commits with up to one parent, a list of TreeChange

objects; if the commit has no parents, these will be relative to the empty tree. For merge commits, a list of lists of TreeChange objects; see dulwich.diff.tree_changes_for_merge.

class dulwich.walk.Walker(store, include, exclude=None, order='date', reverse=False, max_entries=None, paths=None, rename_detector=None, follow=False, since=None, until=None, get_parents=<function Walker.<lambda>>, queue_cls=<class 'dulwich.walk._CommitTimeQueue'>)

Bases: object

Object for performing a walk of commits in a store.

Walker objects are initialized with a store and other options and can then be treated as iterators of Commit objects.

Constructor.

Parameters
  • store – ObjectStore instance for looking up objects.

  • include – Iterable of SHAs of commits to include along with their ancestors.

  • exclude – Iterable of SHAs of commits to exclude along with their ancestors, overriding includes.

  • order – ORDER_* constant specifying the order of results. Anything other than ORDER_DATE may result in O(n) memory usage.

  • reverse – If True, reverse the order of output, requiring O(n) memory.

  • max_entries – The maximum number of entries to yield, or None for no limit.

  • paths – Iterable of file or subtree paths to show entries for.

  • rename_detector – diff.RenameDetector object for detecting renames.

  • follow – If True, follow path across renames/copies. Forces a default rename_detector.

  • since – Timestamp to list commits after.

  • until – Timestamp to list commits before.

  • get_parents – Method to retrieve the parents of a commit

  • queue_cls – A class to use for a queue of commits, supporting the iterator protocol. The constructor takes a single argument, the Walker.