diff -r dbef418cc1c8 -r 2df3d5b2f364 cobalt.py --- a/cobalt.py Thu Oct 30 02:06:28 2014 +0200 +++ b/cobalt.py Thu Oct 30 02:55:14 2014 +0200 @@ -273,6 +273,16 @@ return result #enddef +def find_developer_by_email (email): + for developer, emails in g_config['developer_emails'].iteritems(): + for email in emails: + if commit_email == email: + return developer + #fi + #done + #done +#enddef + ' Retrieves and processes commits for zandronum repositories ' ' Ensure both repositories are OK before using this! ' def process_zan_repo_updates (repo_name): @@ -368,20 +378,25 @@ if usesandbox: commit_author = get_commit_data (zanrepo, commit_node, '{author}') commit_url = '%s/commits/%s' % (repo_url, commit_node) + commit_email = '' # Remove the email address from the author if possible rex = re.compile (r'^(.+) <([^>]+)>$.*') match = rex.match (commit_author) if match: commit_author = match.group (1) + commit_email = match.group (2) #fi + commit_trackeruser = find_developer_by_email (commit_email) + committer = commit_trackeruser if commit_trackeruser != '' else commit_author + for irc_client in g_clients: for channel in irc_client.cfg['channels']: if 'btprivate' in channel and channel['btprivate'] == True: irc_client.privmsg (channel['name'], "%s: new commit %s by %s: %s" - % (repo_name, commit_node, commit_author, commit_url)) + % (repo_name, commit_node, committer, commit_url)) for line in commit_message.split ('\n'): irc_client.privmsg (channel['name'], line) @@ -440,19 +455,7 @@ commit_diffstat = 'No changes in files.' # Compare the email addresses against known developer usernames - commit_trackeruser = '' - - for developer, emails in g_config['developer_emails'].iteritems(): - for email in emails: - if commit_email == email: - commit_trackeruser = developer - break; - #fi - else: - continue - #done - break - #done + commit_trackeruser = find_developer_by_email (commit_email) if commit_trackeruser != '': commit_author += ' [%s]' % commit_trackeruser