comparison mercurial/localrepo.py @ 30574:f8c9a7d2bbbf

localrepo: use ProgrammingError This is an example usage of ProgrammingError. Let's start migrating RuntimeError to ProgrammingError. The code only runs when devel.all-warnings or devel.check-locks is set, so it does not affect the end-user experience.
author Jun Wu <quark@fb.com>
date Tue, 06 Dec 2016 17:06:39 +0000
parents 91db2aa0edfe
children ad15646dc61c
comparison
equal deleted inserted replaced
30573:b0ebab239f90 30574:f8c9a7d2bbbf
1014 1014
1015 def transaction(self, desc, report=None): 1015 def transaction(self, desc, report=None):
1016 if (self.ui.configbool('devel', 'all-warnings') 1016 if (self.ui.configbool('devel', 'all-warnings')
1017 or self.ui.configbool('devel', 'check-locks')): 1017 or self.ui.configbool('devel', 'check-locks')):
1018 if self._currentlock(self._lockref) is None: 1018 if self._currentlock(self._lockref) is None:
1019 raise RuntimeError('programming error: transaction requires ' 1019 raise error.ProgrammingError('transaction requires locking')
1020 'locking')
1021 tr = self.currenttransaction() 1020 tr = self.currenttransaction()
1022 if tr is not None: 1021 if tr is not None:
1023 return tr.nest() 1022 return tr.nest()
1024 1023
1025 # abort here if the journal already exists 1024 # abort here if the journal already exists