def commitsByDayhour(self): datehourFunc= lambda entry: (int(entry['date'].strftime("%H")), int(entry['date'].strftime("%w"))) # (hour, day) seriesArr = [] byDatehour = countLogEntriesByFunc(self.log, datehourFunc) overviewSeries = self.getSeries('overview', byDatehour) seriesArr.append(overviewSeries) for user in self.log.getUserList(): byDatehour = countLogEntriesByFunc(self.log, datehourFunc, user) series = self.getSeries(user, byDatehour) seriesArr.append(series) for series in seriesArr: series['data'] = [[key[0], (key[1]-1 if key[1] != 0 else 6), value] for key, value in series['data'].items()] return seriesArr
def commitsByName(self): nameFunc= lambda entry: entry['name'] seriesArr = [] for user in self.log.getUserList(): byName = countLogEntriesByFunc(self.log, nameFunc, user) series = self.getSeries(user, byName[user]) seriesArr.append(series) return seriesArr
def commitsByDate(self): seriesArr = [] byDateFunc = lambda entry: entry['date'].date() for user in self.log.getUserList(): byDate = countLogEntriesByFunc(self.log, byDateFunc, user) data = [(int(mktime(date.timetuple())) * 1000, count) for date, count in byDate.items()] series = self.getSeries(user, data) seriesArr.append(series) return seriesArr
def commitsByHour(self): seriesArr = [] byHourFunc = lambda entry: int(entry['date'].strftime("%H")) for user in self.log.getUserList(): byHour = countLogEntriesByFunc(self.log, byHourFunc, user) for hour in range(24): if not byHour.has_key(hour): byHour[hour] = 0 series = self.getSeries(user, byHour.items()) seriesArr.append(series) return seriesArr
def commitsByWeekDay(self): byDayFunc = lambda entry: int(entry['date'].strftime("%w")) seriesArr = [] for user in self.log.getUserList(): byDay = countLogEntriesByFunc(self.log, byDayFunc, user) for day in range(7): if not byDay.has_key(day): byDay[day] = 0 byDay = [(day-1 if day != 0 else 6, value) for day, value in byDay.items()] series = self.getSeries(user, byDay) seriesArr.append(series) return seriesArr
from svnLog import SvnLog from svnLogHelper import countLogEntriesByFunc ''' Created on 08.10.2012 @author: Christine Emrich ''' if __name__ == '__main__': repoUrl = 'https://scm.mi.hs-rm.de/svn/2011db/2011db02/' log = SvnLog(repoUrl) print log.getUserList() func = lambda entry: int(entry['date'].strftime("%w")) print countLogEntriesByFunc(log, func) print countLogEntriesByFunc(log, func, 'cemri001')