# HG changeset patch # User Martin von Zweigbergk # Date 1546935128 28800 # Node ID 7b80406b82710e3469625b42b43cb0c1a08b7d51 # Parent 8cf92ca92bfe55dee5f7bea895b98a77a8485dda progress: move cached debug flag from progress.progbar to scmutil.progress It's simpler this way. One possible drawback (and a possisble advantage) is that we now check the debug flag once per topic, so processes that generate new topics all the time will still check the flag frequently. Differential Revision: https://phab.mercurial-scm.org/D5528 diff -r 8cf92ca92bfe -r 7b80406b8271 mercurial/progress.py --- a/mercurial/progress.py Mon Jan 07 23:55:26 2019 -0800 +++ b/mercurial/progress.py Tue Jan 08 00:12:08 2019 -0800 @@ -104,8 +104,6 @@ self.order = self.ui.configlist('progress', 'format') self.estimateinterval = self.ui.configwith( float, 'progress', 'estimateinterval') - # developer config: progress.debug - self.debug = self.ui.configbool('progress', 'debug') def show(self, now, topic, pos, item, unit, total): if not shouldprint(self.ui): diff -r 8cf92ca92bfe -r 7b80406b8271 mercurial/scmutil.py --- a/mercurial/scmutil.py Mon Jan 07 23:55:26 2019 -0800 +++ b/mercurial/scmutil.py Tue Jan 08 00:12:08 2019 -0800 @@ -1421,6 +1421,7 @@ self.topic = topic self.unit = unit self.total = total + self.debug = ui.configbool('progress', 'debug') def __enter__(self): return self @@ -1458,14 +1459,7 @@ self.ui._progbar.progress(self.topic, self.pos, item=item, unit=self.unit, total=self.total) - # Looking up progress.debug in tight loops is expensive. The value - # is cached on the progbar object and we can avoid the lookup in - # the common case where a progbar is active. - if self.pos is None or not self.ui._progbar.debug: - return - - # Keep this logic in sync with above. - if self.pos is None or not self.ui.configbool('progress', 'debug'): + if self.pos is None or not self.debug: return if self.unit: