[PATCH hglib] client: connect to repo if necessary when using "with" statement
Paul Tonelli
paul.tonelli at logilab.fr
Tue Jun 17 08:17:03 CDT 2014
# HG changeset patch
# User Paul Tonelli <paul.tonelli at logilab.fr>
# Date 1402936146 -7200
# Mon Jun 16 18:29:06 2014 +0200
# Node ID 5c1dd855444a8210f56431cd0eed4c1d6c2ddb1f
# Parent 861583ceca0bea2a4f692b1e247af7a21c176dcc
client: connect to repo if necessary when using "with" statement
While the '__exit__' closes the connection to the server, the __enter__ method
does not open it. Without this patch, a disconnected repo cannot be used with a
context managed unless you explicitely call the "open" method.
diff -r 861583ceca0b -r 5c1dd855444a hglib/client.py
--- a/hglib/client.py Wed May 21 15:19:19 2014 +0200
+++ b/hglib/client.py Mon Jun 16 18:29:06 2014 +0200
@@ -61,6 +61,8 @@
self.open()
def __enter__(self):
+ if self.server is None:
+ self.open()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
More information about the Mercurial-devel
mailing list