Close all opened dulwich repo objects #139
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Otherwise, especially on Windows, we might end up with locked files.
Fix #138.
dulwich's pull can operate either on paths or on dulwich repo objects. Since it's using
open_repo_closing
internally, if it (and henceopen_repo_closing
) are passed a path, the associated repo object will be automatically closed after use, so we don't have to worry about anything. (If they're passed an already existing "repo object", as we had been doing previously, then, internally, they use_noop_context_manager()
, instead ofclosing()
and the repo object isn't closed.)(The above is true for current dulwich master (
80bffaca1dfe59a5ba57a045f3ce7122227a7647
) — seedulwich/porcelain.py
.)For the record, I built thedist/
folder (for testing purposes) with:due to issues caused by the recent upgrade of pyyaml.EDIT: the issues were due to how I had installed python3.7, and are not universal!