diff -r 24f0b13e87d3 -r 55d7d9aea160 rest.py --- a/rest.py Fri Nov 28 23:24:06 2014 -0500 +++ b/rest.py Sat Nov 29 16:37:36 2014 +0200 @@ -10,14 +10,14 @@ import irc as Irc from datetime import datetime, timedelta from configfile import Config +import hgpoll as HgPoll g_credentials = None g_portnumber = None g_throttle = [] valid_repos = ['Torr_Samaho/zandronum', 'Torr_Samaho/zandronum-stable', - 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable', - 'crimsondusk/testrepo'] + 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable'] def is_throttled (address): i = 0 @@ -84,14 +84,19 @@ try: jsondata = json.loads (jsonstring) repodata = jsondata['repository'] - repopath = '%s/%s' % (repodata['owner'], repodata['name']) + repo_name = '%s/%s' % (repodata['owner'], repodata['name']) - if repopath not in valid_repos: - raise ValueError ('unknown repository %s' % repopath) + if repo_name not in valid_repos: + raise ValueError ('unknown repository %s' % repo_name) + + commit_data = [] if 'commits' in jsondata: for commit in jsondata['commits']: - Irc.broadcast ('%s: new commit %s' % (address, commit['node'])) + commit_data.append ([commit['node'], commit['message']]) + + if len (commit_data) > 0: + HgPoll.process_new_commits (repo_name, commit_data) except Exception as e: Irc.broadcast ('%s provided bad JSON: %s' % (address, e))