--- a/viewer.py Thu May 28 15:11:01 2015 +0800
+++ b/viewer.py Thu May 28 15:36:56 2015 +0800
+from collections import OrderedDict
from urllib import quote_plus
from tornado.ioloop import IOLoop
return getinfo('first({}:0, {})'.format(rev, revcount))
- def getlimits(self, changesets=None):
+ def getlimits(self, marks, changesets=None):
query = 'SELECT MIN(time), MAX(time) FROM results WHERE mark = ? AND cache = ?'
self.conn.execute(query, [mark, False] + extra).fetchone()
self.conn.execute(query, [mark, True] + extra).fetchone()
- def getresults(self, changesets, local=False):
+ def getresults(self, changesets, marks, local=False):
- limits = self.getlimits(changesets if local else None)
+ limits = self.getlimits(marks, changesets if local else None)
resultsq = self.conn.execute(
'SELECT node, mark, time, cache FROM results'
- ' WHERE node IN (' + ','.join('?' * len(changesets)) + ')',
- [cset['node'] for cset in changesets])
+ ' WHERE node IN (' + ','.join('?' * len(changesets)) + ')'
+ ' AND mark IN (' + ','.join('?' * len(marks)) + ')',
+ [cset['node'] for cset in changesets] + marks.keys())
for node, mark, time, cache in resultsq:
results.setdefault(node, {}).setdefault(mark, [None, None, None, None])
color = green_to_red(limits[mark][0:2], time) if time is not None else None
self.set_header('Content-Type', 'text/plain; charset=UTF-8')
changesets = self.getchangesets()
- results = self.getresults(changesets)
+ results = self.getresults(changesets, MARKS)
self.write('\t{0} (without cache)\t{0} (with cache)'.format(mark))
changesets = self.getchangesets()
local = self.get_argument('local', False)
- results = self.getresults(changesets, local)
+ results = self.getresults(changesets, marks=marks, local=local)
'changesets': changesets,
'setlocal': self.setlocal,