Files
DIY_GIT_in_Python/how_to/Change_29.md

10 lines
493 B
Markdown

- log: Use `iter_commits_and_parents`
Refactoring ahead! Since we have `iter_commits_and_parents` from `k`, let's also
use this function in `log`. We'll need to adjust it a bit to use
`collections.deque` instead of a set so that the order of commits is deterministic.
This generalization might seem unneeded at this point, but it will be useful
later. (Note for the advanced folks: When we implement merge commits that have
multiple parents, this generic way to iterate will come in handy.)