Extract commit dates
authorLaurent Bachelier <laurent@bachelier.name>
Sun, 17 Feb 2013 00:57:54 +0000 (01:57 +0100)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 22 Feb 2013 19:27:57 +0000 (14:27 -0500)
So they can be handled by the filter hook.
For now, only git is handled.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
irkerhook.py

index 29434c75f12826b2e8e03a840b909e9b5b40e381..09cb20441a481f18a6feedede1a6b2229fd65fe8 100755 (executable)
@@ -60,6 +60,8 @@ class Commit:
         self.files = None
         self.logmsg = None
         self.url = None
+        self.author_date = None
+        self.commit_date = None
         self.__dict__.update(extractor.__dict__)
     def __unicode__(self):
         "Produce a notification string from this commit."
@@ -271,6 +273,8 @@ class GitExtractor(GenericExtractor):
         # for spammers' address harvesters - getting this wrong
         # would make the freenode #commits channel into harvester heaven.
         commit.author = commit.mail.split("@")[0]
+        commit.author_date, commit.commit_date = \
+            do("git log -1 '--pretty=format:%ai|%ci' " + shellquote(commit.commit)).split("|")
         return commit
 
 class SvnExtractor(GenericExtractor):