blob: f1c8fc3106ee0e1299a6d6b1628f48ef76d0590e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/usr/bin/python
#
# Generate a database of commits and major versions they went into.
#
# committags [git-args]
#
import sys
import re
import os
import pickle
git = 'git log --decorate '
if len(sys.argv) > 1:
git += ' '.join(sys.argv[1:])
input = os.popen(git, 'r')
DB = { }
Tag = 'None'
tagline = re.compile(r'^commit ([\da-f]+) .*tag: (v2\.6\.\d\d)')
commit = re.compile(r'^commit ([\da-f]+)')
for line in input.readlines():
if not line.startswith('commit'):
continue # This makes it go faster
m = tagline.search(line)
if m:
DB[m.group(1)] = Tag = m.group(2)
else:
m = commit.search(line)
if m:
DB[m.group(1)] = Tag
print 'Found %d commits' % (len(DB.keys()))
out = open('committags.db', 'w')
pickle.dump(DB, out)
out.close()
|