##// END OF EJS Templates
progress: split up _print() method in bar-updating and debug-printing...
Martin von Zweigbergk -
r41180:3025fd3c default
parent child Browse files
Show More
@@ -1434,7 +1434,9 b' class progress(object):'
1434 if total:
1434 if total:
1435 self.total = total
1435 self.total = total
1436 self.pos = pos
1436 self.pos = pos
1437 self._print(item)
1437 self._updatebar(item)
1438 if self.debug:
1439 self._printdebug(item)
1438
1440
1439 def increment(self, step=1, item="", total=None):
1441 def increment(self, step=1, item="", total=None):
1440 self.update(self.pos + step, item, total)
1442 self.update(self.pos + step, item, total)
@@ -1443,9 +1445,9 b' class progress(object):'
1443 self.pos = None
1445 self.pos = None
1444 self.unit = ""
1446 self.unit = ""
1445 self.total = None
1447 self.total = None
1446 self._print("")
1448 self._updatebar("")
1447
1449
1448 def _print(self, item):
1450 def _updatebar(self, item):
1449 if getattr(self.ui._fmsgerr, 'structured', False):
1451 if getattr(self.ui._fmsgerr, 'structured', False):
1450 # channel for machine-readable output with metadata, just send
1452 # channel for machine-readable output with metadata, just send
1451 # raw information
1453 # raw information
@@ -1459,9 +1461,7 b' class progress(object):'
1459 self.ui._progbar.progress(self.topic, self.pos, item=item,
1461 self.ui._progbar.progress(self.topic, self.pos, item=item,
1460 unit=self.unit, total=self.total)
1462 unit=self.unit, total=self.total)
1461
1463
1462 if self.pos is None or not self.debug:
1464 def _printdebug(self, item):
1463 return
1464
1465 if self.unit:
1465 if self.unit:
1466 unit = ' ' + self.unit
1466 unit = ' ' + self.unit
1467 if item:
1467 if item:
General Comments 0
You need to be logged in to leave comments. Login now