# HG changeset patch # User Teemu Piippo # Date 1420039677 18000 # Node ID cdafc1a0544e06b5b0e5e6685c9e494477589c3a # Parent 44d9aea7294797327ddc44e502d134576f156f26 - stuff! diff -r 44d9aea72947 -r cdafc1a0544e hgpoll.py --- a/hgpoll.py Mon Dec 08 23:27:43 2014 +0200 +++ b/hgpoll.py Wed Dec 31 10:27:57 2014 -0500 @@ -17,6 +17,8 @@ color = 7 elif repo_name == 'zandronum-sandbox-stable': color = 3 + elif repo_name == 'zfc9000': + color = 6 else: color = 0 return color @@ -44,8 +46,7 @@ words = line.split (' ') timestamp = int (words[1]) - f.write ('%s %s\n' % (words[0], datetime.utcfromtimestamp (timestamp).strftime -('%y%m%d-%H%M'))) + f.write ('%s %s\n' % (words[0], datetime.utcfromtimestamp (timestamp).strftime ('%y%m%d-%H%M'))) f.close() g_needCommitsTxtRebuild = False @@ -203,6 +204,7 @@ check_repo_exists ('zandronum-sandbox', 'crimsondusk') check_repo_exists ('zandronum-sandbox-stable', 'crimsondusk') check_repo_exists ('zandronum-everything', '') + check_repo_exists ('zfc9000', 'crimsondusk') global repocheck_timeout repocheck_timeout = (time.time()) + 15 @@ -241,7 +243,7 @@ if time.time() < repocheck_timeout: return - for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable']: + for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable', 'zfc9000']: poll_one_repo (n) hgns = Config.get_node ('hg') @@ -255,7 +257,7 @@ return usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' - repo_owner = 'Torr_Samaho' if not usesandbox else 'crimsondusk' + repo_owner = 'Torr_Samaho' if (not usesandbox and repo_name != 'zfc9000') else 'crimsondusk' zanrepo = hgapi.Repo (repo_name) commit_data = [] delimeter = '@@@@@@@@@@' @@ -299,7 +301,7 @@ usestable = repo_name == 'zandronum-stable' usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' - repo_owner = 'Torr_Samaho' if not usesandbox else 'crimsondusk' + repo_owner = 'Torr_Samaho' if (not usesandbox and repo_name != 'zfc9000') else 'crimsondusk' repo_url = 'https://bitbucket.org/%s/%s' % (repo_owner, repo_name) num_commits = 0 zanrepo = hgapi.Repo (repo_name) @@ -324,23 +326,24 @@ try: zanrepo.hg_command ('pull', *pull_args) - # Also pull these commits to the zandronum main repository - if usestable: - devrepo = hgapi.Repo ('zandronum') - devrepo.hg_command ('pull', '../zandronum-stable', *pull_args) - # Pull everything into sandboxes too - if not usesandbox: - devrepo = hgapi.Repo ('zandronum-sandbox') + if repo_name[0:9] == 'zandronum': + # Also pull these commits to the zandronum main repository + if usestable: + devrepo = hgapi.Repo ('zandronum') + devrepo.hg_command ('pull', '../zandronum-stable', *pull_args) + # Pull everything into sandboxes too + if not usesandbox: + devrepo = hgapi.Repo ('zandronum-sandbox') + devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) + + devrepo = hgapi.Repo ('zandronum-sandbox-stable') + devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) + + devrepo = hgapi.Repo ('zandronum-everything') devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - - devrepo = hgapi.Repo ('zandronum-sandbox-stable') - devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - - devrepo = hgapi.Repo ('zandronum-everything') - devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - - global g_needCommitsTxtRebuild - g_needCommitsTxtRebuild = True + + global g_needCommitsTxtRebuild + g_needCommitsTxtRebuild = True except Exception as e: Irc.broadcast ('Warning: unable to pull: %s' % `e`) @@ -370,7 +373,10 @@ for irc_client in Irc.all_clients: for channel in irc_client.channels: - if not usesandbox or channel.get_value ('btprivate', False): + if not channel.get_value ('btannounce', False): + continue + + if (not usesandbox and repo_name != 'zfc9000') or channel.get_value ('btprivate', False): 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, diff -r 44d9aea72947 -r cdafc1a0544e irc.py --- a/irc.py Mon Dec 08 23:27:43 2014 +0200 +++ b/irc.py Wed Dec 31 10:27:57 2014 -0500 @@ -150,11 +150,12 @@ # Handle a PRIVMSG line from the IRC server # def handle_privmsg (self, line): - rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) PRIVMSG ([^ ]+) :(.+)$') + rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) PRIVMSG ([^ ]+) :(.*)$') match = rex.match (line) if not match: broadcast ("Recieved bad PRIVMSG: %s" % line) + return sender = match.group (1) user = match.group (2) diff -r 44d9aea72947 -r cdafc1a0544e mod_hgpoll.py --- a/mod_hgpoll.py Mon Dec 08 23:27:43 2014 +0200 +++ b/mod_hgpoll.py Wed Dec 31 10:27:57 2014 -0500 @@ -66,13 +66,15 @@ # The sandboxes contain all revisions in zandronum and zandronum-stable. # Thus we only need to try find the revision in the sandbox repos. try: - data = repo.hg_command ("log", "-r", node, "--template", + data = repo.hg_command ("log", "-l1", "-r", node, "--template", "{node|short}@@@@@@@" + "{desc}@@@@@@@" + "{author}@@@@@@@" + "{diffstat}@@@@@@@" + "{date|hgdate}@@@@@@@" + - "{bookmarks}") + "{bookmarks}@@@@@@@" + + "{latesttagdistance}@@@@@@@" + + "{latesttag}") except hgapi.HgException: bot.privmsg (replyto, 'couldn\'t find changeset %s' % (node)) return @@ -85,6 +87,8 @@ diffstat = data[3] date = datetime.utcfromtimestamp (int (data[4].split (' ')[0])) bookmarks = data[5] + latesttagdistance = int( data[6] ) + latesttag = data[7] delta = datetime.utcnow() - date datestring = '' @@ -147,8 +151,14 @@ else: datestring = 'on %s' % (str (date)) - bot.privmsg (replyto, 'changeset\0035 %s%s\003 (%s %s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ - (node, bookmarks, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) + versionstring = "" + if latesttagdistance != 0: + versionstring = '%s %s, %d hops from %s' % (zanversion, date.strftime ('%y%m%d-%H%M'), latesttagdistance, latesttag) + else: + versionstring = latesttag + + bot.privmsg (replyto, 'changeset\0035 %s%s\003 (%s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ + (node, bookmarks, versionstring, author, datestring, diffstat)) for line in message.split ('\n'): bot.privmsg (replyto, ' ' + line) diff -r 44d9aea72947 -r cdafc1a0544e rest.py --- a/rest.py Mon Dec 08 23:27:43 2014 +0200 +++ b/rest.py Wed Dec 31 10:27:57 2014 -0500 @@ -17,7 +17,7 @@ g_throttle = [] valid_repos = ['Torr_Samaho/zandronum', 'Torr_Samaho/zandronum-stable', - 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable'] + 'crimsondusk/zandronum-sandbox', 'crimsondusk/zandronum-sandbox-stable', 'crimsondusk/zfc9000'] def is_throttled (address): i = 0