-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmkchangelog
executable file
·37 lines (30 loc) · 1.06 KB
/
mkchangelog
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import piksemel
if len(sys.argv) < 2:
print "Usage: %s logfile.xml" % sys.argv[0]
print "create logfile with svn log --xml > logfile.xml"
sys.exit()
replaces = [["BUG:COMMENT:","\t* Comment added to http://bugs.pardus.org.tr/"],
["BUG:FIXED:","\t* Bug fixed at http://bugs.pardus.org.tr/"],
["svnusername","Your Name <[email protected]>"]]
scheme = """%s %s
%s
"""
def rep(source):
for base in replaces:
source = source.replace(base[0], base[1])
return source
def _msg(source):
for line in source.splitlines():
source = source.replace(line, line.lstrip(" \n\t*"))
return "\n".join(map(lambda x: " * %s" % x, filter(None,source.splitlines())))
xml = piksemel.parse(sys.argv[1])
for node in xml.tags():
if node.getTagData("msg"):
author = rep(node.getTagData("author"))
msg = _msg(rep(node.getTagData("msg").rstrip("\n")))
print scheme % (node.getTagData("date")[0:10],
author,
msg)