#!/usr/local/bin/python import sys import time class delta: def __init__(self, file): self.file = file self.date = "" self.time = 0 self.rev = "" self.log = []; self.commitno = -1 def setdate(self, date): #print "DATE = [%s]" % (date) self.date = date self.time = time.mktime(time.strptime(date, "%Y/%m/%d %H:%M:%S")) #print "TIME = ", self.time def setrev(self, rev): self.rev = rev def setauthor(self, author): self.author = author def setlog(self, log): self.log.append(log) def setcommitno(self, commitno): self.commitno = commitno deltas = [] d = None startlog = 0 file = None for line in sys.stdin.xreadlines(): line = line.strip() if (line[0:14] == "Working file: "): file = line[14:] elif (file != None) and (line.find("revision ") == 0): d = delta(file) d.setrev(line[9:]) deltas.append(d) elif (d != None) and (line.find("date: ") == 0): d.setdate(line[6:line.find(";")]) l = line.split() author = l[4][:-1] d.setauthor(author) startlog = 1 elif (d != None) and (startlog): if (line == "----------------------------"): startlog = 0 else: d.setlog(line) def by_time(d1, d2): if d1.time > d2.time: return 1 elif d1.time < d2.time: return -1 else: return 0 deltas.sort(by_time) prevtime = 0 commit_no = 0 for d in deltas: if (prevtime != d.time): commit_no = commit_no + 1 d.setcommitno(commit_no) prevtime = d.time pcno = 0 for d in deltas: if pcno != d.commitno: print print "------------------------------------------------------------" print print "COMMIT NUMBER: %d" % d.commitno print print " DATE: %s (%d)" % (d.date, d.time) print print " REV %s of %s" % (d.rev, d.file) print " AUTH %s" % d.author print " LOG:" for log in d.log: print " > %s" % log print pcno = d.commitno