# HG changeset patch # User Pierre-Yves David # Date 1415877167 0 # Node ID 86c6f06feb04b74a08d74221de301f6c8924c271 # Parent 47091002ae622a9450cebe586b9d8efc28f04a61 localrepo: add a currenttransaction method This method returnx the current transaction or None: it will allow a cache writer to hook in an existing transaction. diff -r 47091002ae62 -r 86c6f06feb04 mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Nov 13 11:11:17 2014 +0000 +++ b/mercurial/localrepo.py Thu Nov 13 11:12:47 2014 +0000 @@ -865,9 +865,16 @@ def wwritedata(self, filename, data): return self._filter(self._decodefilterpats, filename, data) - def transaction(self, desc, report=None): + def currenttransaction(self): + """return the current transaction or None if non exists""" tr = self._transref and self._transref() or None if tr and tr.running(): + return tr + return None + + def transaction(self, desc, report=None): + tr = self.currenttransaction() + if tr is not None: return tr.nest() # abort here if the journal already exists