Patchwork D5528: progress: move cached debug flag from progress.progbar to scmutil.progress

login
register
mail settings
Submitter phabricator
Date Jan. 9, 2019, 7:40 p.m.
Message ID <87b6bd4e1293cac49f0ade9c07334cba@localhost.localdomain>
Download mbox | patch
Permalink /patch/37577/
State Not Applicable
Headers show

Comments

phabricator - Jan. 9, 2019, 7:40 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7b80406b8271: progress: move cached debug flag from progress.progbar to scmutil.progress (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5528?vs=13078&id=13097

REVISION DETAIL
  https://phab.mercurial-scm.org/D5528

AFFECTED FILES
  mercurial/progress.py
  mercurial/scmutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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:
diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -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):