def get_trac_comments(self): sorted_events = sorted(c for c in self.trac._changes_and_attachments) for event in sorted_events: if len(event) == 5: time, author, field, oldvalue, newvalue = event if field == 'comment' and newvalue not in [ '', '<change title>' ]: header = "_%s wrote on %s_" % ( util.mention_trac_user(author), _t(time)) body = t2g_markup(newvalue) yield "\n".join([header, "", body]) elif field == 'milestone': try: new_milestone = ghissues.find_milestone(newvalue).title except: new_milestone = "Unscheduled" yield "Milestone changed to `%s` by %s on %s" % ( new_milestone, util.mention_trac_user(author), _t(time)) elif field == 'summary': yield "Title changed from `%s` to `%s` by %s on %s" % ( oldvalue, newvalue, util.mention_trac_user(author), _t(time)) elif len(event) == 4: time, author, description, filename = event url = "http://projects.scipy.org/numpy/attachment/ticket/%d/%s" % ( self.trac.id, filename) body = "Attachment added by %s on %s: [%s](%s)" % \ (util.mention_trac_user(author), _t(time), filename, url) yield body
def get_trac_comments(self): sorted_events = sorted(c for c in self.trac._changes_and_attachments) for event in sorted_events: if len(event) == 5: time, author, field, oldvalue, newvalue = event if field == 'comment' and newvalue not in [ '', '<change title>' ]: header = "_%s wrote on %s_" % ( util.mention_trac_user(author), _t(time)) body = t2g_markup(newvalue) yield "\n".join([header, "", body]) elif field == 'milestone': try: new_milestone = ghissues.find_milestone(newvalue).title except: new_milestone = "Unscheduled" yield "Milestone changed to `%s` by %s on %s" % ( new_milestone, util.mention_trac_user(author), _t(time)) elif field == 'summary': yield "Title changed from `%s` to `%s` by %s on %s" % ( oldvalue, newvalue, util.mention_trac_user(author), _t(time)) elif len(event) == 4: time, author, description, filename = event url = "http://trac.elgg.org/attachment/ticket/%d/%s" % ( self.trac.id, filename) body = "Attachment added by %s on %s: [%s](%s)" % \ (util.mention_trac_user(author), _t(time), filename, url) yield body
def gh_set_milestone(self): self.github.milestone = ghissues.find_milestone(self.trac.milestone)