cobalt.py

changeset 66
74d8ca04ff01
parent 65
20bd76353eb5
child 67
f8cc57c608e2
--- a/cobalt.py	Sun Nov 09 19:13:08 2014 +0200
+++ b/cobalt.py	Sun Nov 09 19:17:45 2014 +0200
@@ -263,7 +263,7 @@
 check_repo_exists ('zandronum-sandbox-stable', 'crimsondusk')
 check_repo_exists ('zandronum-everything', '')
 
-repocheck_timeout = {(time.time()) + 15}
+repocheck_timeout = (time.time()) + 15
 
 def get_commit_data (zanrepo, rev, template):
 	return zanrepo.hg_command ('log', '-l', '1', '-r', rev, '--template', template)
@@ -319,7 +319,15 @@
 
 ' Retrieves and processes commits for zandronum repositories '
 ' Ensure both repositories are OK before using this! '
-def process_zan_repo_updates (repo_name):
+def process_zan_repo_updates():
+	result = 0
+	
+	for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable']:
+		result += process_one_repo (n)
+	
+	return result
+
+def process_one_repo (repo_name):
 	global repocheck_timeout
 	global suds_client
 	global g_clients
@@ -682,8 +690,7 @@
 			bt_checklatest()
 
 			# Check for new commits in the repositories
-			for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable']:
-				process_zan_repo_updates (n)
+			process_zan_repo_updates()
 
 	def channel_by_name (self, name):
 		for channel in self.channels:
@@ -817,15 +824,12 @@
 		elif command == 'checkhg':
 			check_admin (sender, ident, host, command)
 			global repocheck_timeout
-			repocheck_timeout = {'zandronum':0, 'zandronum-stable':0, 'zandronum-sandbox':0, 'zandronum-sandbox-stable':0}
-
-			for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox', 'zandronum-sandbox-stable']:
-				numcommits = process_zan_repo_updates (n)
+			repocheck_timeout = 0
+			numcommits = process_zan_repo_updates()
 
-				if numcommits == 0:
-					self.privmsg (replyto, 'No new commits in ' + n)
-				#fi
-			#done
+			if numcommits == 0:
+				self.privmsg (replyto, 'No new commits in ' + n)
+			#fi
 		elif command == 'die':
 			check_admin (sender, ident, host, command)
 			quit()

mercurial