blob: ad28c79d9db8cdcb4f92f93c5ef1a25ba324e1c8 (
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
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/python
# Copyright (c) 2014-2015, The Tor Project, Inc.
# See LICENSE for licensing information
"""This script sorts a bunch of changes files listed on its command
line into roughly the order in which they should appear in the
changelog.
TODO: collation support.
"""
import re
import sys
def fetch(fn):
with open(fn) as f:
s = f.read()
s = "%s\n" % s.rstrip()
return s
def score(s,fname=None):
m = re.match(r'^ +o (.*)', s)
if not m:
print >>sys.stderr, "Can't score %r from %s"%(s,fname)
lw = m.group(1).lower()
if lw.startswith("major feature"):
score = 0
elif lw.startswith("major bug"):
score = 1
elif lw.startswith("major"):
score = 2
elif lw.startswith("minor feature"):
score = 10
elif lw.startswith("minor bug"):
score = 11
elif lw.startswith("minor"):
score = 12
else:
score = 100
return (score, lw, s)
changes = [ score(fetch(fn),fn) for fn in sys.argv[1:] if not fn.endswith('~') ]
changes.sort()
for _, _, s in changes:
print s
|