Anton Shestakov <av6@dwimlabs.net>, Mon, 28 Sep 2015 00:03:36 +0800
viewer: compute a weak entity tag from db and repo mtime
This saves running a subprocess with hg -Tjson and rendering pages when there
weren't any updates to the testhg repo or to the database.
Maybe ETag is not the perfect place for this (Last-Modified?), but it works.
templates/results.html
Permissions: -rw-r--r--
<title>hgperfcheck
{% if changesets %} (rev
{{ changesets[0]['rev'] }} and earlier)
{% end %}</title> background-color: silver; <a href="{{ setrev() }}">back to tip
</a> {% set prevrev = changesets[0]['rev'] + 120 if changesets else None %} {% if prevrev %}<a href="{{ setrev(prevrev) }}">prev page
</a>{% end %} {% set nextrev = changesets[-1]['rev'] - 1 if changesets else None %} {% if nextrev > -1 %}<a href="{{ setrev(nextrev) }}">next page
</a>{% end %} <span style="color: #777;"> hover things for a tooltip; red means slow, green means fast; first
color and time means without .hg/cache, second means with .hg/cache.
local colors (
<a href="{{ setlocal(None) }}">switch to global colors
</a>)
global colors (
<a href="{{ setlocal(1) }}">switch to local colors
</a>)
{% for mark, desc in marks.items() %} -
<a href="{{ setmarks(remove=mark) }}" title="{{ desc }}">{{ mark }}</a> {% for mark, desc in moremarks.items() %} +
<a href="{{ setmarks(add=mark) }}" title="{{ desc }}">{{ mark }}</a> *
<a href="{{ setmarks() }}">all
</a> {% for mark, desc in marks.items() %} <td title="{{ desc }}">{{ mark }}</td> {% for cset in changesets %} <td>{{ cset['rev'] }}</td> <td><a href="http://selenic.com/hg/rev/{{ cset['node'] }}">{{ cset['node'][:12] }}</a></td> <td>{{ 'M' if len(cset['parents']) > 1 else '' }}</td> <td>{{ cset['branch'] }}</td> <td>{{ ', '.join(cset['tags']) }}</td> <td title="{{ showuser(cset['user']) }}">{{ showuser(cset['user'], short=True) }}</td> <td class="hint"><div title="{{ cset['desc'] }}">{{ cset['desc'].partition('\n')[0] }}</div></td> {% set result = results.get(cset['node'], {}) %} {% set v1, c1, v2, c2 = result.get(mark, (None, None, None, None)) %} <span{% if c1 is not None %} style="background-color: rgb{{ str(c1) }};"{% end %}> </span>{# #}<span{% if c2 is not None %} style="background-color: rgb{{ str(c2) }};"{% end %}> </span> <span title="{{ v1 }} without .hg/cache">{{ '{:.2f}s'.format(v1) if v1 is not None else '-' }}</span>{# #}<span title="{{ v2 }} with .hg/cache">{{ '{:.2f}s'.format(v2) if v2 is not None else '-' }}</span> <a href="{{ setrev() }}">back to tip
</a> {% if prevrev %}<a href="{{ setrev(prevrev) }}">prev page
</a>{% end %} {% if nextrev > -1 %}<a href="{{ setrev(nextrev) }}">next page
</a>{% end %}