Made the CSV file aggregating data by weeks or months
[git-dm.git] / committags
blob2b7fb5b4c30dc7a74c540637d2df8bf8a195514d
1 #!/usr/bin/python
3 # Generate a database of commits and major versions they went into.
5 # committags [git-args]
7 # This code is part of the LWN git data miner.
9 # Copyright 2007-8 LWN.net
10 # Copyright 2007-8 Jonathan Corbet <corbet@lwn.net>
12 # This file may be distributed under the terms of the GNU General
13 # Public License, version 2.
15 import sys
16 import re
17 import os
18 import pickle
20 git = 'git log --decorate '
21 if len(sys.argv) > 1:
22 git += ' '.join(sys.argv[1:])
23 input = os.popen(git, 'r')
25 DB = { }
26 Tag = 'None'
28 tagline = re.compile(r'^commit ([\da-f]+) .*tag: (v2\.6\.\d\d)')
29 commit = re.compile(r'^commit ([\da-f]+)')
31 for line in input.readlines():
32 if not line.startswith('commit'):
33 continue # This makes it go faster
34 m = tagline.search(line)
35 if m:
36 DB[m.group(1)] = Tag = m.group(2)
37 else:
38 m = commit.search(line)
39 if m:
40 DB[m.group(1)] = Tag
42 print 'Found %d commits' % (len(DB.keys()))
43 out = open('committags.db', 'w')
44 pickle.dump(DB, out)
45 out.close()