comparison mercurial/localrepo.py @ 8072:ecf7795479d5

transaction: support multiple, separate transactions Solves that committed (closed) transactions may linger and be returned on subsequent transaction calls, even though a new transaction should be made, rather than a new nested transaction. This also fixes a race condition with the use of weakref.
author Henrik Stuart <henrik.stuart@edlund.dk>
date Wed, 15 Apr 2009 19:54:22 +0200
parents de377b1a9a84
children a26d33749bd8
comparison
equal deleted inserted replaced
8071:9f14b66830a8 8072:ecf7795479d5
591 591
592 def wwritedata(self, filename, data): 592 def wwritedata(self, filename, data):
593 return self._filter("decode", filename, data) 593 return self._filter("decode", filename, data)
594 594
595 def transaction(self): 595 def transaction(self):
596 if self._transref and self._transref(): 596 tr = self._transref and self._transref() or None
597 return self._transref().nest() 597 if tr and tr.running():
598 return tr.nest()
598 599
599 # abort here if the journal already exists 600 # abort here if the journal already exists
600 if os.path.exists(self.sjoin("journal")): 601 if os.path.exists(self.sjoin("journal")):
601 raise error.RepoError(_("journal already exists - run hg recover")) 602 raise error.RepoError(_("journal already exists - run hg recover"))
602 603