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.
--- 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