- update formatting on mod_hgpoll.py

Mon, 10 Nov 2014 17:22:37 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 10 Nov 2014 17:22:37 +0200
changeset 79
6d17630d1468
parent 78
afc0fc2a57e4
child 80
0f6bfd359a7f

- update formatting on mod_hgpoll.py

mod_hgpoll.py file | annotate | diff | comparison | revisions
--- a/mod_hgpoll.py	Mon Nov 10 02:50:06 2014 +0200
+++ b/mod_hgpoll.py	Mon Nov 10 17:22:37 2014 +0200
@@ -45,7 +45,7 @@
 		datetime.strptime (args['key'], '%y%m%d-%H%M')
 		HgPoll.make_commits_txt()
 		commits_txt = open ('commits.txt', 'r')
-
+		
 		for line in commits_txt:
 			data = line.replace ('\n', '').split (' ')
 			if data[1] == args['key']:
@@ -54,11 +54,9 @@
 		else:
 			bot.privmsg (replyto, 'couldn\'t find changset for date %s' % args['key'])
 			return
-		#done
 	except ValueError:
 		pass
-	#tried
-
+	
 	# The sandboxes contain all revisions in zandronum and zandronum-stable.
 	# Thus we only need to try find the revision in the sandbox repos.
 	try:
@@ -66,13 +64,12 @@
 	except hgapi.HgException:
 		bot.privmsg (replyto, 'couldn\'t find changeset %s' % (node))
 		return
-	#tried
-
+	
 	try:
 		data = repo.hg_command ("log", "-r", node, "--template",
 			"{node|short}@@@@@@@{desc}@@@@@@@{author}@@@@@@@{diffstat}@@@@@@@{date|hgdate}")
 		data = data.split ('@@@@@@@')
-
+		
 		node = data[0]
 		message = data[1]
 		author = data[2]
@@ -80,18 +77,18 @@
 		date = datetime.utcfromtimestamp (int (data[4].split (' ')[0]))
 		delta = datetime.now() - date
 		datestring = ''
-
+		
 		# Remove the email address from the author if possible
 		match = re.compile (r'^(.+) <([^>]+)>$.*').match (author)
 		if match:
 			author = match.group (1)
 			email = match.group (2)
-
+		
 		username = Config.find_developer_by_email (email)
-
+		
 		if username != '':
 			author = username
-
+		
 		if delta.days < 4:
 			if delta.days == 0:
 				if delta.seconds < 60:
@@ -106,21 +103,19 @@
 				datestring = '%d day%s ago' % (delta.days, plural (delta.days))
 		else:
 			datestring = 'on %s' % (str (date))
-		#fi
-
+		
 		bot.privmsg (replyto, 'changeset %s (%s): committed by %s %s (%s)' % \
 			(node, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat))
-
+		
 		for line in message.split ('\n'):
 			bot.privmsg (replyto, '    ' + line)
 	except hgapi.HgException as e:
 		result = HgPoll.decipher_hgapi_error (e)
-
+		
 		if result[0]:
 			bot.privmsg (replyto, 'error: %s' % result[1])
 		else:
 			bot.privmsg (replyto, 'error: %s' % `e`)
-	#tried
 
 def cmd_hg (bot, args, **rest):
 	try:
@@ -129,10 +124,8 @@
 		self.privmsg (replyto, result)
 	except hgapi.hgapi.HgException as e:
 		result = HgPoll.decipher_hgapi_error (e)
-
+		
 		if result[0]:
 			self.privmsg (replyto, 'error: %s' % result[1])
 		else:
-			self.privmsg (replyto, 'error: %s' % `e`)
-		#fi
-	#tried
\ No newline at end of file
+			self.privmsg (replyto, 'error: %s' % `e`)
\ No newline at end of file

mercurial