author | Bryan O'Sullivan <bryano@fb.com> |
Fri, 15 Jan 2016 13:14:50 -0800 | |
changeset 27798 | 8953e963ce8c |
parent 27797 | 054abf2377e8 |
child 27799 | 24b4dbb16c60 |
--- a/mercurial/sshpeer.py Fri Jan 15 13:14:45 2016 -0800 +++ b/mercurial/sshpeer.py Fri Jan 15 13:14:50 2016 -0800 @@ -22,6 +22,11 @@ def release(self): self.repo.unlock() self.repo = None + def __enter__(self): + return self + def __exit__(self, exc_type, exc_val, exc_tb): + if self.repo: + self.release() def __del__(self): if self.repo: self.release()