# HG changeset patch # User Pierre-Yves David # Date 1372338827 -7200 # Node ID 57387c6482e55c20b4ee5afa730c13f63b68f800 # Parent fcc732a9d9ac65c1f747586da101cc61182887ff [repoapi] make ClientConnection.__enter__ return self This allow the standard idiom:: with repoapi.connect(repo, login='babar', passwork='elephant') as cnx: cnx.execute(…) diff -r fcc732a9d9ac -r 57387c6482e5 repoapi.py --- a/repoapi.py Thu Jun 27 18:16:06 2013 +0200 +++ b/repoapi.py Thu Jun 27 15:13:47 2013 +0200 @@ -162,6 +162,7 @@ self._cnx = self._session.new_cnx() self._cnx.__enter__() self._cnx.ctx_count += 1 + return self def __exit__(self, exc_type, exc_val, exc_tb): self._open = False