Skip to content

Commit

Permalink
Only create TracIssue instance once.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Coddington committed Sep 1, 2014
1 parent 2ca1ec0 commit 61ed88f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bugwarrior/services/trac.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ def validate_config(cls, config, target):

IssueService.validate_config(config, target)

def annotations(self, tag, issue):
def annotations(self, tag, issue, issue_obj):
annotations = []
changelog = self.trac.server.ticket.changeLog(issue['number'])
for time, author, field, oldvalue, newvalue, permament in changelog:
if field == 'comment':
annotations.append((author, newvalue, ))

url = issue['url']
url = self.get_issue_for_record(issue).get_processed_url(url)
url = issue_obj.get_processed_url(issue['url'])
return self.build_annotations(annotations, url)

def get_owner(self, issue):
Expand All @@ -122,8 +121,10 @@ def issues(self):
log.name(self.target).debug(" Pruned down to {0}", len(issues))

for project, issue in issues:
issue_obj = self.get_issue_for_record(issue)
extra = {
'annotations': self.annotations(project, issue),
'annotations': self.annotations(project, issue, issue_obj),
'project': project,
}
yield self.get_issue_for_record(issue, extra)
issue_obj.update_extra(extra)
yield issue_obj

0 comments on commit 61ed88f

Please sign in to comment.