| 67 print 'Cloning done.' |
67 print 'Cloning done.' |
| 68 except Exception as e: |
68 except Exception as e: |
| 69 print 'Unable to clone %s from %s: %s' % (repo_name, repo_url, str (`e`)) |
69 print 'Unable to clone %s from %s: %s' % (repo_name, repo_url, str (`e`)) |
| 70 quit (1) |
70 quit (1) |
| 71 |
71 |
| |
72 |
| |
73 class HgProcessError (Exception): |
| |
74 def __init__ (self, value): |
| |
75 self.message = value |
| |
76 def __str__ (self): |
| |
77 return self.message |
| |
78 |
| 72 def announce_ticket_resolved (ticket_id, commit_node): |
79 def announce_ticket_resolved (ticket_id, commit_node): |
| 73 zanrepo = hgapi.Repo ('zandronum-everything') |
80 zanrepo = hgapi.Repo ('zandronum-everything') |
| 74 |
81 |
| 75 # Acquire additional data |
82 # Acquire additional data |
| 76 moredata = get_commit_data (zanrepo, commit_node, |
83 moredata = get_commit_data (zanrepo, commit_node, |
| 77 '{author|nonempty}\n{date(date, \'%A %d %B %Y %T\')}').split('\n') |
84 '{author|nonempty}\n{date(date, \'%A %d %B %Y %T\')}').split('\n') |
| 78 |
85 |
| 79 if len (moredata) != 2: |
86 if len (moredata) != 2: |
| 80 Irc.broadcast ('error while processing %s: malformed hg data' % commit_node) |
87 raise HgProcessError ('malformed hg data while processing %s' % commit_node) |
| 81 continue |
|
| 82 |
88 |
| 83 commit_author = moredata[0] |
89 commit_author = moredata[0] |
| 84 commit_date = moredata[1] |
90 commit_date = moredata[1] |
| 85 commit_email = "" |
91 commit_email = "" |
| 86 |
92 |
| 87 try: |
93 try: |
| 88 ticket_data = Bt.get_issue (ticket_id) |
94 ticket_data = Bt.get_issue (ticket_id) |
| 89 except Exception as e: |
95 except Exception as e: |
| 90 Irc.broadcast ('error while processing %s: %s' % (commit_node, `e`)) |
96 raise HgProcessError ("error while processing %s: %s" % (commit_node, e)) |
| 91 continue |
|
| 92 |
97 |
| 93 # Remove the email address from the author if possible |
98 # Remove the email address from the author if possible |
| 94 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
99 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
| 95 match = rex.match (commit_author) |
100 match = rex.match (commit_author) |
| 96 if match: |
101 if match: |