Skip to content

Commit 55030e2

Browse files
committed
Merge remote-tracking branch 'origin/master' into pypy
Conflicts: example/templates/base.html
2 parents 6016259 + 47d8505 commit 55030e2

File tree

15 files changed

+163
-77
lines changed

15 files changed

+163
-77
lines changed

codespeed/fixtures/testdata.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

codespeed/mercurial.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os, datetime
22
from subprocess import Popen, PIPE
3+
import logging
4+
35
from django.conf import settings
46

57

@@ -52,8 +54,8 @@ def getlogs(endrev, startrev):
5254
p = Popen(cmd, stdout=PIPE, stderr=PIPE, cwd=working_copy)
5355
stdout, stderr = p.communicate()
5456

55-
if stderr:
56-
return [{'error': True, 'message': stderr}]
57+
if p.returncode != 0:
58+
raise RuntimeError(str(stderr))
5759
else:
5860
stdout = stdout.rstrip('\n')#Remove last newline
5961
logs = []

codespeed/models.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ def clean(self):
7373
long(self.commitid)
7474
except ValueError:
7575
raise ValidationError("Invalid SVN commit id %s" % self.commitid)
76-
elif self.branch.project.repo_type in ("M", "G", "H") and len(self.commitid) != 40:
77-
raise ValidationError("Invalid %s commit hash %s" % (
78-
self.branch.project.get_repo_type_display(),
79-
self.commitid))
8076

8177

8278
class Executable(models.Model):
@@ -280,15 +276,15 @@ def get_changes_table(self, trend_depth=10, force_save=False):
280276
return self._get_tablecache()
281277
# Otherwise generate a new changes table
282278
# Get latest revisions for this branch (which also sets the project)
283-
lastrevisions = Revision.objects.filter(
284-
branch=self.revision.branch
285-
).filter(
286-
date__lte=self.revision.date
287-
).order_by('-date')[:trend_depth+1]
288279
try:
280+
lastrevisions = Revision.objects.filter(
281+
branch=self.revision.branch
282+
).filter(
283+
date__lte=self.revision.date
284+
).order_by('-date')[:trend_depth+1]
289285
# Same as self.revision unless in a different branch
290286
lastrevision = lastrevisions[0]
291-
except IndexError:
287+
except:
292288
return []
293289
change_list = []
294290
pastrevisions = []

codespeed/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
DEF_ENVIRONMENT = None #Name of the environment which should be selected as default
88

9+
DEF_BRANCH = "default" # Defines the default branch to be used.
10+
# In git projects, this branch is usually be calles
11+
# "master"
912

1013
DEF_BASELINE = None # Which executable + revision should be default as a baseline
1114
# Given as the name of the executable and commitid of the revision

codespeed/static/js/codespeed.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ function renderComparisonPlot(plotid, benchmarks, exes, enviros, baseline, chart
155155
var benchlabel = $("label[for='benchmark_" + benchmarks[b] + "']").text();
156156
var baselinelabel = $("label[for='exe_" + baseline + "']").text();
157157
var msg = "<strong>"+ title + "</strong>" + "<br><br>";
158-
msg += "Could not render plot because baseline "+baselinelabel+" has empty results for benchmark " + benchlabel;
158+
msg += "Could not render plot because the chosen baseline has empty results for benchmark " + benchlabel;
159159
return abortRender(plotid, msg);
160-
val = 0.0001;
161160
} else {
162161
baseline_is_empty = false;
163162
val = val / baseval;
@@ -181,7 +180,7 @@ function renderComparisonPlot(plotid, benchmarks, exes, enviros, baseline, chart
181180
if (baseline_is_empty) {
182181
var baselinelabel = $("label[for='exe_" + baseline + "']").text();
183182
var msg = "<strong>"+ title + "</strong>" + "<br><br>";
184-
msg += "Could not render plot because baseline "+baselinelabel+" is empty";
183+
msg += "Could not render plot because the chosen baseline is empty";
185184
return abortRender(plotid, msg);
186185
return -1;
187186
}

codespeed/subversion.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ def get_login(realm, username, may_save):
3434
)
3535
)
3636
except pysvn.ClientError:
37-
return [
38-
{'error': True,
39-
'message': "Could not resolve '" + newrev.branch.project.repo_path + "'"}]
37+
raise RuntimeError(
38+
"Could not resolve '" + newrev.branch.project.repo_path + "'")
4039
except ValueError:
41-
return [{
42-
'error': True,
43-
'message': "'%s' is an invalid subversion revision number" % newrev.commitid
44-
}]
40+
raise RuntimeError(
41+
"'%s' is an invalid subversion revision number" % newrev.commitid)
4542
log_messages.reverse()
4643
s = len(log_messages)
4744
while s > loglimit:

codespeed/templates/codespeed/changes.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,15 @@
141141
<div id="executable" class="sidebox">
142142
<div class="boxhead"><h2>Executable</h2></div>
143143
<div class="boxbody">
144-
<ul>
145-
{% for exec in executables|dictsort:"id" %}
146-
<li title="{{ exec.description }}">
147-
<input id="executable{{ exec.id }}" type="radio" name="executable" value="{{ exec.id }}" />
148-
<label for="executable{{ exec.id }}">{{ exec }}</label>
149-
</li>
144+
{% if executables|length > 1 %}<ul>{% endif %}{% for proj, execs in executables.items %}
145+
<ul>{% if executables|length > 1 %}{{ proj }}{% endif %}{% for exec in execs|dictsort:"name" %}
146+
<li title="{{ exec.description }}"><!-- the input id != value. It is used for exeutable color order -->
147+
<input id="executable{{ exec.id }}" type="radio" name="executable" value="{{ exec.id }}" />
148+
<label for="executable{{ exec.id }}">{{ exec }}</label><div class="seriescolor"></div>
149+
</li>{% endfor %}
150+
</ul>
150151
{% endfor %}
151-
</ul>
152+
{% if executables|length > 1 %}</ul>{% endif %}
152153
</div>
153154
</div>
154155

codespeed/templates/codespeed/comparison.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<div class="boxhead"><h2>Executables</h2></div>
165165
<div class="boxbody">
166166
{% for proj, executable in executables.items %}
167-
<ul>{{ proj }} (<a href="#" class="checkall">All</a>, <a href="#" class="uncheckall">None</a>)
167+
<ul>{{ proj }} <a href="#" class="checkall">(All</a>, <a href="#" class="uncheckall">None)</a>
168168
{% for exe in executable %}
169169
<li title="{{ exe.executable }} - {{ exe.revision }}">
170170
<input id="exe_{{ exe.key }}" type="checkbox" name="executables" value="{{ exe.key }}" />
@@ -177,7 +177,7 @@
177177
<div class="boxhead"><h2>Benchmarks</h2></div>
178178
<div class="boxbody">
179179
{% for key,benchlist in benchmarks.items %}
180-
<ul>{{ key }} (<a href="#" class="checkall">All</a>, <a href="#" class="uncheckall">None</a>)
180+
<ul>{{ key }} <a href="#" class="checkall">(All</a>, <a href="#" class="uncheckall">None)</a>
181181
{% for bench in benchlist|dictsort:"name" %}
182182
<li title="{{ bench.description }}">
183183
<input id="benchmark_{{ bench.id }}" type="checkbox" name="benchmarks" value="{{ bench.id }}" />

codespeed/templates/codespeed/timeline.html

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@
305305
.attr('checked', true);
306306

307307
//Add color legend to executable list
308-
$("#executable div.boxbody > ul > li > input").each(function() {
308+
$("#executable div.boxbody > ul > ul > li > input").each(function() {
309309
var colorid = $(this).attr("id").slice(10);
310310
$(this).parent().find("div.seriescolor").css("background-color", seriesColors[colorid-1]);
311311
});
@@ -339,6 +339,23 @@
339339

340340
// Init and change handlers are set to the refreshContent handler
341341
$.address.init(initializeSite).change(refreshSite);
342+
343+
// Check all and none links
344+
$('.checkall').click(function() {
345+
$(this).parent().children("li").children("input").each(function() {
346+
$(this).attr('checked', true);
347+
});
348+
refreshContent();
349+
return false;
350+
});
351+
352+
$('.uncheckall').click(function() {
353+
$(this).parent().children("li").children("input").each(function() {
354+
$(this).attr('checked', false);
355+
});
356+
refreshContent();
357+
return false;
358+
});
342359
});
343360
</script>
344361
{% endblock %}
@@ -366,12 +383,15 @@
366383
<div id="executable" class="sidebox">
367384
<div class="boxhead"><h2>Executables</h2></div>
368385
<div class="boxbody">
369-
<ul class="clearfix">{% for exec in executables|dictsort:"id" %}
370-
<li title="{{ exec.description }}"><!-- the input id != value. It is used for exeutable color order -->
371-
<input id="executable{{ forloop.counter }}" type="checkbox" name="executable" value="{{ exec.id }}" />
372-
<label for="executable{{ forloop.counter }}">{{ exec }}</label><div class="seriescolor"></div>
373-
</li>{% endfor %}
374-
</ul>
386+
<ul class="clearfix">{% for proj, execs in executables.items %}
387+
<ul>{{ proj }} <a href="#" class="checkall">(All</a>, <a href="#" class="uncheckall">None)</a>
388+
{% for exec in execs|dictsort:"name" %}
389+
<li title="{{ exec.description }}"><!-- the input id != value. It is used for exeutable color order -->
390+
<input id="executable{{ exec.id }}" type="checkbox" name="executable" value="{{ exec.id }}" />
391+
<label for="executable{{ exec.id }}">{{ exec }}</label><div class="seriescolor"></div>
392+
</li>{% endfor %}
393+
</ul>
394+
{% endfor %}
375395
<ul>
376396
<li title="Select baseline">Baseline:<div id="baselinecolor" class="seriescolor"></div><br/>
377397
<select id="baseline">

codespeed/tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ def test_submit_data_with_none_timestamp(self):
149149
response = self.client.post(self.path, modified_data)
150150
self.assertEquals(response.status_code, 202)
151151

152+
def test_add_result_with_no_project(self):
153+
"""Should add a revision with the project"""
154+
modified_data = copy.deepcopy(self.data)
155+
modified_data['project'] = "My new project"
156+
modified_data['executable'] = "My new executable"
157+
response = self.client.post(self.path, modified_data)
158+
self.assertEquals(response.status_code, 202)
159+
self.assertEquals(response.content, "Result data saved succesfully")
160+
161+
152162
class AddJSONResults(TestCase):
153163
def setUp(self):
154164
self.path = reverse('codespeed.views.add_json_results')

0 commit comments

Comments
 (0)