From: Laurent Bachelier Date: Sun, 17 Feb 2013 00:57:56 +0000 (+0100) Subject: Extract commit date for Mercurial X-Git-Tag: 1.18~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5095c7ae6c1da1d7eea30fd67add451c91baf9de;p=irker.git Extract commit date for Mercurial Same as Git, without the last part about timezone though. Signed-off-by: Eric S. Raymond --- diff --git a/irkerhook.py b/irkerhook.py index 6e86b80..63ce932 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -39,7 +39,7 @@ default_channels = "irc://chat.freenode.net/#commits" version = "1.17" -import os, sys, commands, socket, urllib, subprocess, locale +import os, sys, commands, socket, urllib, subprocess, locale, datetime from pipes import quote as shellquote try: import simplejson as json # Faster, also makes us Python-2.5-compatible @@ -374,6 +374,8 @@ class HgExtractor(GenericExtractor): commit.rev = '%d:%s' % (ctx.rev(), commit.commit) commit.branch = ctx.branch() commit.author = person(ctx.user()) + commit.author_date = \ + datetime.datetime.fromtimestamp(ctx.date()[0]).strftime('%Y-%m-%d %H:%M:%S') commit.logmsg = ctx.description() # Extract changed files from status against first parent st = self.repository.status(ctx.p1().node(), ctx.node())