From 5095c7ae6c1da1d7eea30fd67add451c91baf9de Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Sun, 17 Feb 2013 01:57:56 +0100 Subject: [PATCH] Extract commit date for Mercurial Same as Git, without the last part about timezone though. Signed-off-by: Eric S. Raymond --- irkerhook.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()) -- 2.26.2