Show More
@@ -1422,6 +1422,24 b' class progress(object):' | |||||
1422 | self.unit = unit |
|
1422 | self.unit = unit | |
1423 | self.total = total |
|
1423 | self.total = total | |
1424 | self.debug = ui.configbool('progress', 'debug') |
|
1424 | self.debug = ui.configbool('progress', 'debug') | |
|
1425 | if getattr(ui._fmsgerr, 'structured', False): | |||
|
1426 | # channel for machine-readable output with metadata, just send | |||
|
1427 | # raw information | |||
|
1428 | # TODO: consider porting some useful information (e.g. estimated | |||
|
1429 | # time) from progbar. we might want to support update delay to | |||
|
1430 | # reduce the cost of transferring progress messages. | |||
|
1431 | def updatebar(item): | |||
|
1432 | ui._fmsgerr.write(None, type=b'progress', topic=self.topic, | |||
|
1433 | pos=self.pos, item=item, unit=self.unit, | |||
|
1434 | total=self.total) | |||
|
1435 | elif ui._progbar is not None: | |||
|
1436 | def updatebar(item): | |||
|
1437 | ui._progbar.progress(self.topic, self.pos, item=item, | |||
|
1438 | unit=self.unit, total=self.total) | |||
|
1439 | else: | |||
|
1440 | def updatebar(item): | |||
|
1441 | pass | |||
|
1442 | self._updatebar = updatebar | |||
1425 |
|
1443 | |||
1426 | def __enter__(self): |
|
1444 | def __enter__(self): | |
1427 | return self |
|
1445 | return self | |
@@ -1447,20 +1465,6 b' class progress(object):' | |||||
1447 | self.total = None |
|
1465 | self.total = None | |
1448 | self._updatebar("") |
|
1466 | self._updatebar("") | |
1449 |
|
1467 | |||
1450 | def _updatebar(self, item): |
|
|||
1451 | if getattr(self.ui._fmsgerr, 'structured', False): |
|
|||
1452 | # channel for machine-readable output with metadata, just send |
|
|||
1453 | # raw information |
|
|||
1454 | # TODO: consider porting some useful information (e.g. estimated |
|
|||
1455 | # time) from progbar. we might want to support update delay to |
|
|||
1456 | # reduce the cost of transferring progress messages. |
|
|||
1457 | self.ui._fmsgerr.write(None, type=b'progress', topic=self.topic, |
|
|||
1458 | pos=self.pos, item=item, unit=self.unit, |
|
|||
1459 | total=self.total) |
|
|||
1460 | elif self.ui._progbar is not None: |
|
|||
1461 | self.ui._progbar.progress(self.topic, self.pos, item=item, |
|
|||
1462 | unit=self.unit, total=self.total) |
|
|||
1463 |
|
||||
1464 | def _printdebug(self, item): |
|
1468 | def _printdebug(self, item): | |
1465 | if self.unit: |
|
1469 | if self.unit: | |
1466 | unit = ' ' + self.unit |
|
1470 | unit = ' ' + self.unit |
General Comments 0
You need to be logged in to leave comments.
Login now