Be compatible with Mercurial 2.2.2. Thanks, Debian...

Tue, 12 Jan 2016 21:14:26 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 12 Jan 2016 21:14:26 +0200
changeset 165
8131cf387e3d
parent 164
e18f73e4c2e2
child 166
2ddfa9840eea

Be compatible with Mercurial 2.2.2. Thanks, Debian...

hgpoll.py file | annotate | diff | comparison | revisions
hgrepo.py file | annotate | diff | comparison | revisions
--- a/hgpoll.py	Mon Jan 11 18:29:14 2016 +0200
+++ b/hgpoll.py	Tue Jan 12 21:14:26 2016 +0200
@@ -40,6 +40,7 @@
 import traceback
 import sys
 from munge import munge
+import datetime
 
 Repositories = []
 RepositoriesByName = {}
@@ -115,10 +116,13 @@
 	# Acquire additional data
 	commit = repo.get_commit_data (rev=cset,
 		author='author|person',
-		date='date(date, "%A %d %B %Y %H:%M:%S")',
+		date='date|hgdate',
 		email='author|email',
 		message='desc')
 
+	commit['date'] = datetime.datetime.utcfromtimestamp(int(commit['date'][0]) - int(commit['date'][1]))
+	commit['date'] = commit['date'].strftime('%A %d %B %Y %H:%M:%S')
+
 	diffstat = repo.hg ('diff', '--change', cset, '--stat')
 
 	try:
--- a/hgrepo.py	Mon Jan 11 18:29:14 2016 +0200
+++ b/hgrepo.py	Tue Jan 12 21:14:26 2016 +0200
@@ -80,7 +80,7 @@
 			data = data.split (separator)
 			return self.merge_template (data, kvargs)
 		except subprocess.CalledProcessError:
-			raise ValueError ('''couldn't find changeset %s in %s''' % (node, repo.name))
+			raise ValueError ('''couldn't find changeset %s in %s''' % (rev, repo.name))
 
 	def incoming (self, maxcommits=0, **kvargs):
 		if not kvargs:
@@ -106,4 +106,4 @@
 
 	def clone (self):
 		print ('Cloning %s from %s...' % (self.name, self.url))
-		subprocess.call (['hg', 'clone', self.url, self.name])
\ No newline at end of file
+		subprocess.call (['hg', 'clone', self.url, self.name])

mercurial