[PATCH 2 of 7] blackbox: store the blackbox ui object instead of the log file
timeless
timeless at gmail.com
Wed Feb 3 16:58:38 EST 2016
Durham Goode wrote:
>> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
>> --- a/hgext/blackbox.py
>> +++ b/hgext/blackbox.py
>> @@ -95,7 +95,7 @@
>> return
>> if util.safehasattr(self, '_blackbox'):
>> - blackbox = self._blackbox
>> + blackbox = self
>> elif util.safehasattr(self, '_bbopener'):
>> try:
>> self._blackbox = self._openlogfile()
>> @@ -104,28 +104,29 @@
>> err.strerror)
>> del self._bbopener
>> self._blackbox = None
>> - blackbox = self._blackbox
>> + blackbox = self
>> else:
>> # certain ui instances exist outside the context of
>> # a repo, so just default to the last blackbox that
>> # was seen.
>> blackbox = lastblackbox
>> - if blackbox:
>> + if (util.safehasattr(blackbox, '_blackbox') and
>> + blackbox._blackbox is not None):
>
> The old check verified that blackbox wasn't None, but you no longer do. Is
> that safe? Seems like if lastblackbox was None, blackbox here could be None
> as well.
safehasattr allows the first arg to be None :), but this is an interim thing.
>> + blackbox._blackbox.write('%s %s @%s%s (%s)> %s' %
>> (date, user, rev, changed, pid,
>> formattedmsg))
>
> The "blackbox._blackbox" naming is a bit confusing. Is one the ui class and
> one is the file? Can we stick 'ui' and 'file' on the name to distinguish
> them? Or rename them entirely?
Yes. I can rename them, I've started slowly renaming things elsewhere
in this series.
The full series is at
https://bitbucket.org/timeless/mercurial-crew/commits/27bfe0a9c492
More information about the Mercurial-devel
mailing list