-
-
Notifications
You must be signed in to change notification settings - Fork 962
Closed
Labels
Milestone
Description
This is just a suggestion for what I think would be a bit more pythonic implementation of the config writer objects that exist throughout gitpython. The basic pattern is:
- get a config writer
- set some values
- call
release()on the config writer object
cw = origin.config_writer
cw.set("pushurl", "other_url")
cw.release()
This pattern could be replaced with a context manager by providing the special methods __enter__() and __exit__() on the object returned by the config_writer property. The release() call would then occur automatically when the context is left.
The following example would be equivalent to the above:
with origin.config_writer as cw:
cw.pushurl = "other_url"
This change could probably be done in a backwards-compatible manner, so everyone would be happy and this great library would become a tiny bit more pythonic :)