- be more verbose when .checkhg is used

Mon, 29 Sep 2014 04:26:27 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 29 Sep 2014 04:26:27 +0300
changeset 34
1a1ee9e8bda6
parent 33
2dcf980521a9
child 35
237e82bcd02f

- be more verbose when .checkhg is used

cobalt.py file | annotate | diff | comparison | revisions
--- a/cobalt.py	Mon Sep 29 04:19:10 2014 +0300
+++ b/cobalt.py	Mon Sep 29 04:26:27 2014 +0300
@@ -247,14 +247,15 @@
 
 ' Retrieves and processes commits for zandronum repositories '
 ' Ensure both repositories are OK before using this! '
-def process_zan_repo_updates (usestable):
+def process_zan_repo_updates (repo_name):
 	global repocheck_timeout
 	global suds_client
 	global g_config
 	global g_clients
 
-	repo_name = 'zandronum' if usestable == False else 'zandronum-stable'
+	usestable = repo_name == 'zandronum-stable'
 	repo_url = 'https://bitbucket.org/Torr_Samaho/' + repo_name
+	num_commits = 0
 
 	if time.time() < repocheck_timeout[repo_name]:
 		return
@@ -409,6 +410,7 @@
 			#fi
 
 			suds_client.service.mc_issue_note_add (g_config['trackeruser'], g_config['trackerpassword'], ticket_id, { 'text': message })
+			num_commits += 1
 		except Exception as e:
 			chanlog ('Error while processing %s: %s' % (commit_node, `e`))
 			failed = True
@@ -437,6 +439,8 @@
 			chanlog ('Warning: unable to pull: %s' % `e`)
 		#tried
 	#fi
+
+	return num_commits > 0
 #enddef
 
 #
@@ -564,8 +568,7 @@
 			bt_checklatest()
 
 			# Check for new commits in the repositories
-			# note: stable (i.e. True) goes first!
-			for n in [True, False]:
+			for n in ['zandronum-stable', 'zandronum']:
 				process_zan_repo_updates (n)
 
 	def channel_by_name (self, name):
@@ -878,8 +881,14 @@
 			check_admin (sender, ident, host, command)
 			global repocheck_timeout
 			repocheck_timeout = {'zandronum':0, 'zandronum-stable':0}
-			process_zan_repo_updates (True)
-			process_zan_repo_updates (False)
+
+			for n in ['zandronum-stable', 'zandronum']:
+				numcommits = process_zan_repo_updates (n)
+
+				if numcommits == 0:
+					self.privmsg (replyto, 'No new commits in ' + n)
+				#fi
+			#done
 		elif command == 'die':
 			check_admin (sender, ident, host, command)
 			quit()

mercurial