Implement generic git history processor
PkgHistoryProcessor.run() accepts a list of functions generating
coroutines which "visit" every commit, i.e. check if they need
information from results of earlier commits, and process these and
partial results from previously run visitor coroutines. These coroutines
are implemented as generators which yield whether or not to continue
first, get sent the partial result for the current commit and results
for all parents back in, process these and yield the processed current
result like this:
def commit_visitor(commit: pygit2.Commit, children_must_continue: bool):
# Decide if history needs to be explored further, this can depend on
# information in this or parent commits, as well as the combined
# outcome for child commits.
must_continue = ...
# This suspends execution, yields the decision to the caller who
# sends back (partial) results for this commit.
commit_result, parent_results = yield must_continue
# Process this commit, also using its (partial) results (e.g. by
# previously run visitors) and full results for the parent(s).
...
yield commit_result
Signed-off-by: Nils Philippsen <nils@redhat.com>