271 #done |
271 #done |
272 |
272 |
273 return result |
273 return result |
274 #enddef |
274 #enddef |
275 |
275 |
|
276 def find_developer_by_email (email): |
|
277 for developer, emails in g_config['developer_emails'].iteritems(): |
|
278 for email in emails: |
|
279 if commit_email == email: |
|
280 return developer |
|
281 #fi |
|
282 #done |
|
283 #done |
|
284 #enddef |
|
285 |
276 ' Retrieves and processes commits for zandronum repositories ' |
286 ' Retrieves and processes commits for zandronum repositories ' |
277 ' Ensure both repositories are OK before using this! ' |
287 ' Ensure both repositories are OK before using this! ' |
278 def process_zan_repo_updates (repo_name): |
288 def process_zan_repo_updates (repo_name): |
279 global repocheck_timeout |
289 global repocheck_timeout |
280 global suds_client |
290 global suds_client |
366 |
376 |
367 try: |
377 try: |
368 if usesandbox: |
378 if usesandbox: |
369 commit_author = get_commit_data (zanrepo, commit_node, '{author}') |
379 commit_author = get_commit_data (zanrepo, commit_node, '{author}') |
370 commit_url = '%s/commits/%s' % (repo_url, commit_node) |
380 commit_url = '%s/commits/%s' % (repo_url, commit_node) |
|
381 commit_email = '' |
371 |
382 |
372 # Remove the email address from the author if possible |
383 # Remove the email address from the author if possible |
373 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
384 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
374 match = rex.match (commit_author) |
385 match = rex.match (commit_author) |
375 if match: |
386 if match: |
376 commit_author = match.group (1) |
387 commit_author = match.group (1) |
|
388 commit_email = match.group (2) |
377 #fi |
389 #fi |
|
390 |
|
391 commit_trackeruser = find_developer_by_email (commit_email) |
|
392 committer = commit_trackeruser if commit_trackeruser != '' else commit_author |
378 |
393 |
379 for irc_client in g_clients: |
394 for irc_client in g_clients: |
380 for channel in irc_client.cfg['channels']: |
395 for channel in irc_client.cfg['channels']: |
381 if 'btprivate' in channel and channel['btprivate'] == True: |
396 if 'btprivate' in channel and channel['btprivate'] == True: |
382 irc_client.privmsg (channel['name'], |
397 irc_client.privmsg (channel['name'], |
383 "%s: new commit %s by %s: %s" |
398 "%s: new commit %s by %s: %s" |
384 % (repo_name, commit_node, commit_author, commit_url)) |
399 % (repo_name, commit_node, committer, commit_url)) |
385 |
400 |
386 for line in commit_message.split ('\n'): |
401 for line in commit_message.split ('\n'): |
387 irc_client.privmsg (channel['name'], line) |
402 irc_client.privmsg (channel['name'], line) |
388 #fi |
403 #fi |
389 #done |
404 #done |
438 commit_diffstat = 'Changes in files:\n' + bbcodify(commit_diffstat) |
453 commit_diffstat = 'Changes in files:\n' + bbcodify(commit_diffstat) |
439 else: |
454 else: |
440 commit_diffstat = 'No changes in files.' |
455 commit_diffstat = 'No changes in files.' |
441 |
456 |
442 # Compare the email addresses against known developer usernames |
457 # Compare the email addresses against known developer usernames |
443 commit_trackeruser = '' |
458 commit_trackeruser = find_developer_by_email (commit_email) |
444 |
|
445 for developer, emails in g_config['developer_emails'].iteritems(): |
|
446 for email in emails: |
|
447 if commit_email == email: |
|
448 commit_trackeruser = developer |
|
449 break; |
|
450 #fi |
|
451 else: |
|
452 continue |
|
453 #done |
|
454 break |
|
455 #done |
|
456 |
459 |
457 if commit_trackeruser != '': |
460 if commit_trackeruser != '': |
458 commit_author += ' [%s]' % commit_trackeruser |
461 commit_author += ' [%s]' % commit_trackeruser |
459 #fi |
462 #fi |
460 |
463 |