diff -r 0f96e3157b7f -r 9880bb697149 hgpoll.py --- a/hgpoll.py Thu Jan 15 20:48:57 2015 +0200 +++ b/hgpoll.py Mon Jan 19 16:42:36 2015 -0500 @@ -6,9 +6,12 @@ import os from datetime import datetime from configfile import Config +import utility g_needCommitsTxtRebuild = True def color_for_repo (repo_name): + repo_name = repo_name.lower() + if repo_name == 'zandronum': color = 4 elif repo_name == 'zandronum-stable': @@ -19,6 +22,8 @@ color = 3 elif repo_name == 'zfc9000': color = 6 + elif repo_name == 'doomseeker': + color = 5 else: color = 0 return color @@ -207,6 +212,7 @@ check_repo_exists ('zandronum-sandbox-stable', 'crimsondusk') check_repo_exists ('zandronum-everything', '') check_repo_exists ('zfc9000', 'crimsondusk') + check_repo_exists ('doomseeker', 'Blzut3') global repocheck_timeout repocheck_timeout = (time.time()) + 15 @@ -245,12 +251,23 @@ if time.time() < repocheck_timeout: return - for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable', 'zfc9000']: + for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable', 'zfc9000', 'doomseeker']: poll_one_repo (n) hgns = Config.get_node ('hg') repocheck_timeout = time.time() + hgns.get_value ('checkinterval', default=15) * 60 +def get_repo_owner (repo_name): + usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' + repo_name = repo_name.lower() + if repo_name[:9] == 'zandronum': + repo_owner = 'Torr_Samaho' if (not usesandbox) else 'crimsondusk' + elif repo_name == 'zfc9000': + repo_owner = 'crimsondusk' + elif repo_name == 'doomseeker': + repo_owner = 'Blzut3' + return repo_owner + def poll_one_repo (repo_name): global repocheck_timeout hgns = Config.get_node ('hg') @@ -259,7 +276,7 @@ return usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' - repo_owner = 'Torr_Samaho' if (not usesandbox and repo_name != 'zfc9000') else 'crimsondusk' + repo_owner = get_repo_owner (repo_name) zanrepo = hgapi.Repo (repo_name) commit_data = [] delimeter = '@@@@@@@@@@' @@ -301,9 +318,10 @@ if len (commit_data) == 0: return + repo_name = repo_name.lower() usestable = repo_name == 'zandronum-stable' usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' - repo_owner = 'Torr_Samaho' if (not usesandbox and repo_name != 'zfc9000') else 'crimsondusk' + repo_owner = get_repo_owner (repo_name) repo_url = 'https://bitbucket.org/%s/%s' % (repo_owner, repo_name) num_commits = 0 zanrepo = hgapi.Repo (repo_name) @@ -382,7 +400,7 @@ irc_client.privmsg (channel.get_value ('name'), "\003%d%s\003: new commit\0035 %s%s\003 by\0032 %s\003: %s" % (color_for_repo (repo_name), repo_name, commit_node, commit_bookmarks, - committer, commit_url)) + committer, utility.shorten_link (commit_url))) for line in commit_message.split ('\n'): irc_client.privmsg (channel.get_value ('name'), line)