mercurial/sshpeer.py
changeset 27798 8953e963ce8c
parent 26781 1aee2ab0f902
child 28438 48fd02dac1d4
--- 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()