Menu

[r361]: / update_changelog.py  Maximize  Restore  History

Download this file

37 lines (35 with data), 1.5 kB

 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
import os, xml.dom.minidom, subprocess
xmlprocess = subprocess.Popen("svn log -v --xml --with-all-revprops > templog.xml", shell=True)
xmlprocess.wait()
myxml = xml.dom.minidom.parse("templog.xml")
try:
os.remove(os.getcwd() + os.path.sep + "ChangeLog")
except:
pass
os.remove(os.getcwd() + os.path.sep + "templog.xml")
log = myxml.getElementsByTagName("log")[0]
for entry in log.getElementsByTagName("logentry"):
revision = entry.getAttribute("revision")
author = entry.getElementsByTagName("author")[0].firstChild.data
date, time = entry.getElementsByTagName("date")[0].firstChild.data.split("T")
time = time[:-8]
msg = ""
try:
msg = entry.getElementsByTagName("msg")[0].firstChild.data.rstrip()
except Exception:
pass
commit = "\nRevision " + revision + " was commited by " + author + " on " + date + " " + time + ": " + msg + "\n\n"
paths = entry.getElementsByTagName("paths")[0]
for path in paths.getElementsByTagName("path"):
action = path.getAttribute("action")
kind = path.getAttribute("kind")
copyfrompath = path.getAttribute("copyfrom-path")
copyfromrev = path.getAttribute("copyfrom-rev")
modified = path.firstChild.data
if action == "A": action = "added"
elif action == "M": action = "modified"
elif action == "D": action = "deleted"
commit += " " + kind.capitalize() + " " + modified + " was " + action + ".\n"
f = open("ChangeLog", "a")
f.write(commit)
f.close()