Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 86 lines (65 sloc) 1.89 KB
#!/usr/bin/env python
from __future__ import with_statement
import sys
import subprocess
import gitaggregates
def read_tag(t):
args = ['git', 'cat-file', 'tag', t]
sub = subprocess.Popen(args, stdout=subprocess.PIPE, close_fds=True)
for l in sub.stdout:
if rv is not None:
elif l.strip() == '':
rv = []
return ''.join(rv)
def emit(prev, r, f=sys.stdout):
tagdesc = read_tag(r)
c = gitaggregates.Contributors([prev + '..' + r])
chart = c.mk_chart()
pie_url = chart.BASE_URL + '&'.join(chart.get_url_bits())
vdesc = "Changes from release %s to %s" % (prev, r)
if not prev:
vdesc = "Release " + r
f.write("<h2>%s</h2>\n" % (vdesc))
f.write("""<div><img class="pie" src="%s" alt="contributors"/>"""
% pie_url)
f.write("<pre>%s</pre></div>" % tagdesc)
if __name__ == '__main__':
if not sys.argv[1:]:
sys.stderr.write("Need to list some tag objects.\n")
title = "Changelog"
with open(".git/description") as f:
desc =
if not desc.startswith("Unnamed repository"):
title= "Changelog for " + desc
print """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" lang="en" xml:lang="en">
<style type="text/css">
.pie {
float: right;
h2 {
clear: both;
""" % title
print "<h1>%s</h1>" % title
prev = ''
pairs = []
for r in sys.argv[1:]:
pairs.append((prev, r))
prev = r
for prev, r in reversed(pairs):
emit(prev, r)
print "</body></html>"