D5530: progress: check what type of progress bar to use only once per topic
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Jan 9 14:40:10 EST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG963462786f6e: progress: check what type of progress bar to use only once per topic (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5530?vs=13080&id=13098
REVISION DETAIL
https://phab.mercurial-scm.org/D5530
AFFECTED FILES
mercurial/scmutil.py
CHANGE DETAILS
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1422,6 +1422,24 @@
self.unit = unit
self.total = total
self.debug = ui.configbool('progress', 'debug')
+ if getattr(ui._fmsgerr, 'structured', False):
+ # channel for machine-readable output with metadata, just send
+ # raw information
+ # TODO: consider porting some useful information (e.g. estimated
+ # time) from progbar. we might want to support update delay to
+ # reduce the cost of transferring progress messages.
+ def updatebar(item):
+ ui._fmsgerr.write(None, type=b'progress', topic=self.topic,
+ pos=self.pos, item=item, unit=self.unit,
+ total=self.total)
+ elif ui._progbar is not None:
+ def updatebar(item):
+ ui._progbar.progress(self.topic, self.pos, item=item,
+ unit=self.unit, total=self.total)
+ else:
+ def updatebar(item):
+ pass
+ self._updatebar = updatebar
def __enter__(self):
return self
@@ -1447,20 +1465,6 @@
self.total = None
self._updatebar("")
- def _updatebar(self, item):
- if getattr(self.ui._fmsgerr, 'structured', False):
- # channel for machine-readable output with metadata, just send
- # raw information
- # TODO: consider porting some useful information (e.g. estimated
- # time) from progbar. we might want to support update delay to
- # reduce the cost of transferring progress messages.
- self.ui._fmsgerr.write(None, type=b'progress', topic=self.topic,
- pos=self.pos, item=item, unit=self.unit,
- total=self.total)
- elif self.ui._progbar is not None:
- self.ui._progbar.progress(self.topic, self.pos, item=item,
- unit=self.unit, total=self.total)
-
def _printdebug(self, item):
if self.unit:
unit = ' ' + self.unit
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list