3 # Copyright 2008 Marcus D. Hanwell <marcus@cryos.org>
4 # Copyright 2010 Daniel Borkmann <daniel@netsniff-ng.org>
6 # Distributed under the terms of the GNU General Public License v2 or later.
10 fin
= os
.popen('git log --summary --stat --no-merges --date=short', 'r')
11 fout
= open('CHANGELOG', 'w')
23 if string
.find(line
, 'commit') >= 0:
31 elif re
.match('Author:', line
) >=0:
32 authorList
= re
.split(': ', line
, 1)
33 author
= authorList
[1]
34 author
= author
[0:len(author
)-1]
36 elif re
.match('Date:', line
) >= 0:
37 dateList
= re
.split(': ', line
, 1)
39 date
= date
[0:len(date
)-1]
41 elif re
.match('\s+git-svn-id:', line
) >= 0:
43 elif re
.search('Signed-off-by', line
) >= 0:
45 elif re
.search('.+files changed.+insertions.+deletions.+', line
) \
47 changes
= "\n :" + line
[:-1]
49 elif authorFound
& dateFound
& messageFound
== False:
59 message
= message
+ line
.strip()
61 message
= message
+ " " + line
.strip()
62 elif authorFound
& dateFound
& messageFound
:
63 authorLine
= date
+ " " + author
+ changes
64 if len(prevAuthorLine
) == 0:
65 fout
.write(authorLine
+ "\n\n")
66 elif authorLine
== prevAuthorLine
:
69 fout
.write("\n" + authorLine
+ "\n\n")
74 while i
< len(commitLine
):
75 if len(commitLine
) < i
+ 72:
77 commitLine
[i
:len(commitLine
)] + \
80 index
= commitLine
.rfind(' ', i
, i
+ 72)
82 commit
= commit
+ commitLine
[i
:index
] + \
86 commit
= commit
+ commitLine
[i
:72] + \
90 fout
.write(commit
+ "\n")
97 prevAuthorLine
= authorLine