Mercurial > lcfOS
view python/repostats.py2 @ 147:4e79484a9d47
Moved core to ir folder
author | Windel Bouwman |
---|---|
date | Fri, 22 Feb 2013 10:33:48 +0100 |
parents | aaa4939a7942 |
children |
line wrap: on
line source
#!/usr/bin/python2 import sys # Use python 2 since mercurial does not support python 3 yet? assert sys.version_info.major == 2 from mercurial import ui, hg import numpy import matplotlib.pyplot as plt import datetime u = ui.ui() repo = hg.repository(u, '..') stamps = [] nds = repo.changelog.nodesbetween()[0] for hexid in nds: cset = repo.changelog.read(hexid) stamps.append(cset[2][0]) dts = [datetime.datetime.fromtimestamp(st) for st in stamps] x = [dt.weekday() for dt in dts] y = [dt.hour for dt in dts] # plot it: f = plt.figure() #plt.hexbin(x, y) plt.scatter(x, y) ax = plt.gca() ax.set_ylim([0, 24]) ax.set_ylabel('hour of day') ax.set_xlim([0, 7]) ax.set_xlabel('day of week') ax.grid() plt.show()