Download:
child 30:ac681cc74573
parent 28:f834362f7f83
29:58bcac03bba9
Anton Shestakov <engored@ya.ru>, Thu, 28 May 2015 15:36:56 +0800
viewer: specify marks explicitly

1 файлов изменено, 12 вставок(+), 11 удалений(-) [+]
viewer.py file | annotate | diff | comparison | revisions
--- a/viewer.py Thu May 28 15:11:01 2015 +0800
+++ b/viewer.py Thu May 28 15:36:56 2015 +0800
@@ -5,6 +5,7 @@
import re
import sqlite3
import subprocess
+from collections import OrderedDict
from urllib import quote_plus
from tornado.ioloop import IOLoop
@@ -55,7 +56,7 @@
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 = ?'
extra = []
if changesets:
@@ -66,21 +67,20 @@
self.conn.execute(query, [mark, False] + extra).fetchone()
+
self.conn.execute(query, [mark, True] + extra).fetchone()
- for mark in MARKS
+ for mark in marks
}
- def getresults(self, changesets, local=False):
+ def getresults(self, changesets, marks, local=False):
results = {}
- 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:
- if mark not in MARKS:
- continue
results.setdefault(node, {}).setdefault(mark, [None, None, None, None])
if not cache:
color = green_to_red(limits[mark][0:2], time) if time is not None else None
@@ -94,7 +94,7 @@
def results_tsv(self):
self.set_header('Content-Type', 'text/plain; charset=UTF-8')
changesets = self.getchangesets()
- results = self.getresults(changesets)
+ results = self.getresults(changesets, MARKS)
self.write('rev\tnode')
for mark in MARKS:
self.write('\t{0} (without cache)\t{0} (with cache)'.format(mark))
@@ -157,11 +157,12 @@
def results_html(self):
changesets = self.getchangesets()
+ marks = MARKS
local = self.get_argument('local', False)
- results = self.getresults(changesets, local)
+ results = self.getresults(changesets, marks=marks, local=local)
context = {
'changesets': changesets,
- 'marks': MARKS,
+ 'marks': marks,
'results': results,
'local': local,
'setlocal': self.setlocal,