Mercurial > hg > truffle
comparison mxtool/mx.py @ 14522:7c36ec150036
Make the DuplicateSuppressingStream periodically print while it is filtering output
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 13 Mar 2014 15:48:36 +0100 |
parents | 7668297a2e67 |
children | 47b775458982 |
comparison
equal
deleted
inserted
replaced
14521:29ccc4cbabca | 14522:7c36ec150036 |
---|---|
1274 """ | 1274 """ |
1275 def __init__(self, restrictTo=None, out=sys.stdout): | 1275 def __init__(self, restrictTo=None, out=sys.stdout): |
1276 self.restrictTo = restrictTo | 1276 self.restrictTo = restrictTo |
1277 self.seen = set() | 1277 self.seen = set() |
1278 self.out = out | 1278 self.out = out |
1279 self.currentFilteredLineCount = 0 | |
1280 self.currentFilteredTime = None | |
1279 | 1281 |
1280 def isSuppressionCandidate(self, line): | 1282 def isSuppressionCandidate(self, line): |
1281 if self.restrictTo: | 1283 if self.restrictTo: |
1282 for p in self.restrictTo: | 1284 for p in self.restrictTo: |
1283 if p in line: | 1285 if p in line: |
1287 return True | 1289 return True |
1288 | 1290 |
1289 def write(self, line): | 1291 def write(self, line): |
1290 if self.isSuppressionCandidate(line): | 1292 if self.isSuppressionCandidate(line): |
1291 if line in self.seen: | 1293 if line in self.seen: |
1294 self.currentFilteredLineCount += 1 | |
1295 if self.currentFilteredTime: | |
1296 if time.time() - self.currentFilteredTime > 1 * 60: | |
1297 self.out.write(" Filtered " + str(self.currentFilteredLineCount) + " repeated lines...\n") | |
1298 self.currentFilteredTime = time.time() | |
1299 else: | |
1300 self.currentFilteredTime = time.time() | |
1292 return | 1301 return |
1293 self.seen.add(line) | 1302 self.seen.add(line) |
1303 self.currentFilteredLineCount = 0 | |
1294 self.out.write(line) | 1304 self.out.write(line) |
1305 self.currentFilteredTime = None | |
1295 | 1306 |
1296 """ | 1307 """ |
1297 A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string. | 1308 A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string. |
1298 """ | 1309 """ |
1299 class JavaCompliance: | 1310 class JavaCompliance: |