Sun, 17 May 2015 20:40:09 +0300
Update:
- added a config option to disable the REST server
- added a message to be printed when IRC connections are first attempted
- look up the long commit node to be inserted into commits.db to avoid precision loss
cobalt.py | file | annotate | diff | comparison | revisions | |
hgpoll.py | file | annotate | diff | comparison | revisions | |
irc.py | file | annotate | diff | comparison | revisions |
--- a/cobalt.py Fri May 08 04:24:07 2015 +0300 +++ b/cobalt.py Sun May 17 20:40:09 2015 +0300 @@ -105,7 +105,8 @@ raise ValueError ("unknown autoconnect entry %s" % (aconn)) # Start the REST server - Rest.RESTServer() + if Config.get_node ('rest').get_value ('active', True): + Rest.RESTServer() g_BotActive = True asyncore.loop()
--- a/hgpoll.py Fri May 08 04:24:07 2015 +0300 +++ b/hgpoll.py Sun May 17 20:40:09 2015 +0300 @@ -301,8 +301,8 @@ for repo in all_repo_names(): check_repo_exists (repo) + g_CommitsDb = CommitsDb() repocheck_timeout = time.time() + 15 - g_CommitsDb = CommitsDb() global ZDoomRevNumber try: @@ -421,17 +421,18 @@ alreadyAdded = len (existingrepos) > 0 delim = '@@@@@@@@@@' - data = get_commit_data (zanrepo, commit_node, delim.join (['{author}', '{bookmarks}', \ + data = get_commit_data (zanrepo, commit_node, delim.join (['{node}', '{author}', '{bookmarks}', \ '{date|hgdate}'])).split (delim) - commit_author = data[0] - commit_bookmarks = prettify_bookmarks (data[1]) - commit_time = int (data[2].split (' ')[0]) + commit_full_node = data[0] + commit_author = data[1] + commit_bookmarks = prettify_bookmarks (data[2]) + commit_time = int (data[3].split (' ')[0]) commit_url = '%s/commits/%s' % (repo_url, commit_node) commit_email = '' # If the commit was already in the commits database, it is not a new one and we should # not react to it. Still add it to the db though so that the new repo name is added. - g_CommitsDb.add_commit (repo=repo_name, changeset=commit_node, timestamp=commit_time) + g_CommitsDb.add_commit (repo=repo_name, changeset=commit_full_node, timestamp=commit_time) if alreadyAdded: print ('''I already know of %s - they're in %s - not announcing.''' % (commit_node, existingrepos)) @@ -537,6 +538,7 @@ Irc.broadcast ('Error while dealing with ZDoom upgrade number: %s' % e) def update_zadev_topic(): + return fraction = float (ZDoomRevNumber - ZDoomMin) / (ZDoomMax - ZDoomMin) topicText = """ZDoom 2.6.1 progress: at r%d, %d revisions left (%d%% complete)""" %\ (ZDoomRevNumber, ZDoomMax - ZDoomRevNumber, round (fraction * 100))
--- a/irc.py Fri May 08 04:24:07 2015 +0300 +++ b/irc.py Sun May 17 20:40:09 2015 +0300 @@ -100,6 +100,7 @@ all_clients.append (self) asyncore.dispatcher.__init__ (self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) + print "Connecting to [%s] %s:%d..." % (self.name, self.host, self.port) self.connect ((self.host, self.port)) ClientsByName[self.name] = self