Index: dashboard/dashboard/pinpoint/models/job.py |
diff --git a/dashboard/dashboard/pinpoint/models/job.py b/dashboard/dashboard/pinpoint/models/job.py |
index a2bf223084ee3787ffaf551eec2d48e5847920e5..d6ff7b4845c77891af3d76470146c37c2e8d08cd 100644 |
--- a/dashboard/dashboard/pinpoint/models/job.py |
+++ b/dashboard/dashboard/pinpoint/models/job.py |
@@ -114,7 +114,7 @@ class Job(ndb.Model): |
self._PostBugComment('started') |
def Complete(self): |
- self._PostBugComment('completed') |
+ self._PostBugComment('completed', include_differences=True) |
def Fail(self): |
self.exception = traceback.format_exc() |
@@ -159,27 +159,22 @@ class Job(ndb.Model): |
d.update(self.state.AsDict()) |
return d |
- def _PostBugComment(self, status): |
+ def _PostBugComment(self, status, include_differences=False): |
if not self.bug_id: |
return |
title = '%s Pinpoint job %s.' % (_ROUND_PUSHPIN, status) |
header = '\n'.join((title, self.url)) |
- # Include list of Changes. |
change_details = [] |
- for _, change in self.state.Differences(): |
- # TODO: Store the commit info in the Commit. |
- commit = change.last_commit |
- commit_info = gitiles_service.CommitInfo(commit.repository_url, |
- commit.git_hash) |
- subject = commit_info['message'].split('\n', 1)[0] |
- author = commit_info['author']['email'] |
- time = commit_info['committer']['time'] |
- |
- byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time) |
- git_link = commit.repository + '@' + commit.git_hash |
- change_details.append('\n'.join((subject, byline, git_link))) |
+ if include_differences: |
+ # Include list of Changes. |
+ differences = self.state.Differences() |
+ if differences: |
+ for _, change in differences: |
+ change_details.append(_FormatChangeForBug(change)) |
+ else: |
+ change_details.append('No change points found.') |
sullivan
2017/09/18 20:55:47
This might be a little confusing to users. "No sig
shatch
2017/09/18 21:00:14
Kinda wonder if people will ask what this means, m
perezju
2017/09/19 11:56:07
It would also help figure out the right wording if
|
comment = '\n\n'.join([header] + change_details) |
@@ -353,6 +348,20 @@ class _JobState(object): |
return _UNKNOWN |
+def _FormatChangeForBug(change): |
+ # TODO: Store the commit info in the Commit. |
+ commit = change.last_commit |
+ commit_info = gitiles_service.CommitInfo(commit.repository_url, |
+ commit.git_hash) |
+ subject = commit_info['message'].split('\n', 1)[0] |
+ author = commit_info['author']['email'] |
+ time = commit_info['committer']['time'] |
+ |
+ byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time) |
+ git_link = commit.repository + '@' + commit.git_hash |
+ return '\n'.join((subject, byline, git_link)) |
+ |
+ |
def _CombineResultsPerQuest(attempts): |
aggregate_results = collections.defaultdict(list) |
for attempt in attempts: |