- be more liberal on posting commit messages to IRC

Sat, 29 Nov 2014 16:53:32 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 29 Nov 2014 16:53:32 +0200
changeset 100
2a56ccf67782
parent 99
147d78eea80b
child 101
5e32ab7ae823
child 103
e4891ab34fb1

- be more liberal on posting commit messages to IRC
- don't log REST connections to log channel anymore

hgpoll.py file | annotate | diff | comparison | revisions
rest.py file | annotate | diff | comparison | revisions
--- a/hgpoll.py	Sat Nov 29 16:44:09 2014 +0200
+++ b/hgpoll.py	Sat Nov 29 16:53:32 2014 +0200
@@ -326,41 +326,37 @@
 		print 'Processing new commit %s...' % commit_node
 
 		try:
-			if usesandbox:
-				commit_author = get_commit_data (zanrepo, commit_node, '{author}')
-				commit_url = '%s/commits/%s' % (repo_url, commit_node)
-				commit_email = ''
+			commit_author = get_commit_data (zanrepo, commit_node, '{author}')
+			commit_url = '%s/commits/%s' % (repo_url, commit_node)
+			commit_email = ''
 
-				# Remove the email address from the author if possible
-				rex = re.compile (r'^(.+) <([^>]+)>$.*')
-				match = rex.match (commit_author)
-				if match:
-					commit_author = match.group (1)
-					commit_email = match.group (2)
+			# Remove the email address from the author if possible
+			rex = re.compile (r'^(.+) <([^>]+)>$.*')
+			match = rex.match (commit_author)
+			if match:
+				commit_author = match.group (1)
+				commit_email = match.group (2)
 
-				commit_trackeruser = Config.find_developer_by_email (commit_email)
-				committer = commit_trackeruser if commit_trackeruser != '' else commit_author
+			commit_trackeruser = Config.find_developer_by_email (commit_email)
+			committer = commit_trackeruser if commit_trackeruser != '' else commit_author
 
-				for irc_client in Irc.all_clients:
-					for channel in irc_client.channels:
-						if channel.get_value ('btprivate', False):
-							irc_client.privmsg (channel.get_value ('name'),
-								"%s: new commit %s by %s: %s"
-								% (repo_name, commit_node, committer, commit_url))
-
-							for line in commit_message.split ('\n'):
-								irc_client.privmsg (channel.get_value ('name'), line)
+			for irc_client in Irc.all_clients:
+				for channel in irc_client.channels:
+					if not usesandbox or channel.get_value ('btprivate', False):
+						irc_client.privmsg (channel.get_value ('name'),
+							"%s: new commit %s by %s: %s"
+							% (repo_name, commit_node, committer, commit_url))
 
-				num_commits += 1
-				continue
+						for line in commit_message.split ('\n'):
+							irc_client.privmsg (channel.get_value ('name'), line)
 
-			rex = re.compile (r'^.*(fixes|resolves|addresses|should fix) ([0-9]+).*$')
-			match = rex.match (commit_message)
+			if not usesandbox:
+				rex = re.compile (r'^.*(fixes|resolves|addresses|should fix) ([0-9]+).*$')
+				match = rex.match (commit_message)
 
-			if not match:
-				continue # no "fixes" message in the commit
+				if match:
+					announce_ticket_resolved (match.group (2), commit_node)
 
-			announce_ticket_resolved (match.group (2), commit_node)
 			num_commits += 1
 		except Exception as e:
 			Irc.broadcast ('Error while processing %s: %s' % (commit_node, e))
--- a/rest.py	Sat Nov 29 16:44:09 2014 +0200
+++ b/rest.py	Sat Nov 29 16:53:32 2014 +0200
@@ -194,7 +194,6 @@
 			sock.close()
 			return
 
-		Irc.broadcast ('REST connection from %s:%s' % address)
 		conn = RESTConnection (sock, address)
 
 	def handle_error (self):

mercurial