mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
develwarn: refactor the developer warning logic
The logic is currently duplicated and we plan to make it a bit smarter. So we move it into a function first to make the update more robust and simple.
This commit is contained in:
parent
517621994f
commit
d3e735bffe
@ -926,11 +926,7 @@ class localrepository(object):
|
||||
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)
|
||||
scmutil.develwarn(self.ui, 'transaction with no lock\n')
|
||||
tr = self.currenttransaction()
|
||||
if tr is not None:
|
||||
return tr.nest()
|
||||
@ -1220,11 +1216,7 @@ class localrepository(object):
|
||||
or self.ui.configbool('devel', 'check-locks')):
|
||||
l = self._lockref and self._lockref()
|
||||
if l is not None and l.held:
|
||||
msg = '"wlock" acquired after "lock"\n'
|
||||
if self.ui.tracebackflag:
|
||||
util.debugstacktrace(msg, 1)
|
||||
else:
|
||||
self.ui.write_err(msg)
|
||||
scmutil.develwarn(self.ui, '"wlock" acquired after "lock"\n')
|
||||
|
||||
def unlock():
|
||||
if self.dirstate.pendingparentchange():
|
||||
|
@ -172,6 +172,13 @@ class casecollisionauditor(object):
|
||||
self._loweredfiles.add(fl)
|
||||
self._newfiles.add(f)
|
||||
|
||||
def develwarn(tui, msg):
|
||||
"""issue a developer warning message"""
|
||||
if tui.tracebackflag:
|
||||
util.debugstacktrace(msg, 2)
|
||||
else:
|
||||
tui.write_err(msg)
|
||||
|
||||
def filteredhash(repo, maxrev):
|
||||
"""build hash of filtered revisions in the current repoview.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user