Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 24388:026f8af88e49
devel: also warn about transaction started without a lock
Nobody should start a transaction on an unlocked repository. If
developer warnings are enabled this will be reported. This use the
same config as bad locking order since this is closely related.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 10 Mar 2015 21:03:45 -0700 |
parents | d6ac30f4edef |
children | 03163826b4e6 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Mar 10 21:25:11 2015 -0700 +++ b/mercurial/localrepo.py Tue Mar 10 21:03:45 2015 -0700 @@ -919,6 +919,15 @@ return None def transaction(self, desc, report=None): + if (self.ui.configbool('devel', 'all') + or self.ui.configbool('devel', 'check-locks')): + l = self._lockref and self._lockref() + if l is None or not l.held: + msg = 'transaction with no lock\n' + if self.ui.tracebackflag: + util.debugstacktrace(msg, 1) + else: + self.ui.write_err(msg) tr = self.currenttransaction() if tr is not None: return tr.nest()