repoapi.py
changeset 9105 55738c9dc26f
parent 9101 e6d1df619949
child 9111 9c867d852067
equal deleted inserted replaced
9104:9dde49a393a4 9105:55738c9dc26f
   164         self._cnx = self._session.get_cnx(self._cnxid)
   164         self._cnx = self._session.get_cnx(self._cnxid)
   165         self._cnx.ctx_count += 1
   165         self._cnx.ctx_count += 1
   166 
   166 
   167     def __exit__(self, exc_type, exc_val, exc_tb):
   167     def __exit__(self, exc_type, exc_val, exc_tb):
   168         self._open = False
   168         self._open = False
   169         cnxid = self._cnxid
       
   170         self._cnxid = None
   169         self._cnxid = None
   171         self._cnx.ctx_count -= 1
   170         self._cnx.ctx_count -= 1
   172         self._session.close_cnx(cnxid)
   171         self._session.close_cnx(self._cnx)
   173         self._cnx = None
   172         self._cnx = None
   174         if self._autoclose_session:
   173         if self._autoclose_session:
   175             # we have to call repo.close to unsure the repo properly forget the
   174             # we have to call repo.close to unsure the repo properly forget the
   176             # session calling session.close() is not enought :-(
   175             # session calling session.close() is not enought :-(
   177             self._session.repo.close(self._session.id)
   176             self._session.repo.close(self._session.id)