Skip to content
Browse files

Hacked for mercurial

  • Loading branch information...
1 parent a7d3d85 commit b143d43c8c6bb5ab9521f6603538d31014efe4ef @rosslagerwall committed Mar 18, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 gitaggregates.py
View
13 gitaggregates.py
@@ -11,15 +11,20 @@ def __init__(self):
self.h = defaultdict(lambda: 0)
def add_logs(self, directory=None, log_args=['HEAD']):
- args=['git']
+ args=['hg']
if directory:
args.append('--git-dir=' + directory)
- args.extend(['log', '--pretty=format:%at'])
+ args.extend(['log', '--template={date}\n'])
args.extend(log_args)
sub = subprocess.Popen(args, stdout=subprocess.PIPE, close_fds=True)
for l in sub.stdout:
- self.h[time.strftime("%w %H", time.localtime(float(l.strip())))] += 1
+ t, offset = l.strip().split('.')
+ t = float(t)
+ offset = offset[1:]
+ t -= int(offset)
+
+ self.h[time.strftime("%w %H", time.gmtime(t))] += 1
def dump(self):
for h in range(24):
@@ -173,4 +178,4 @@ def to_gchart(self):
return self.mk_chart().get_url()
def open_chart(chartish):
- subprocess.check_call(['open', chartish.to_gchart()])
+ subprocess.check_call(['firefox', chartish.to_gchart()])

0 comments on commit b143d43

Please sign in to comment.
Something went wrong with that request. Please try again.