diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-01-02 15:36:19 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-01-02 16:01:18 +0100 |
commit | bbee246b1e2c62fa869c7918c1dfcda52354283f (patch) | |
tree | 53e1eb2d5c2280ef5e5c4a4ac6ae50850a74a33b /gbp/git | |
parent | 351d45c5e49363c9b5d0f4eb4a3867a7f111a42a (diff) |
GitVfs: make objects usable as context managers
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/vfs.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gbp/git/vfs.py b/gbp/git/vfs.py index 191cf621..4ca29625 100644 --- a/gbp/git/vfs.py +++ b/gbp/git/vfs.py @@ -44,6 +44,12 @@ class GitVfs(object): def close(self): return self._data.close() + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + def __init__(self, repo, committish=None): """ @param repo: the git repository to act on |