aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/format_changelog.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/maint/format_changelog.py')
-rwxr-xr-xscripts/maint/format_changelog.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index 86f5c5039..f67e89b60 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -270,7 +270,16 @@ class ChangeLog(object):
CL = ChangeLog()
parser = head_parser
-sys.stdin = open('ChangeLog', 'r')
+if len(sys.argv) == 1:
+ fname = 'ChangeLog'
+else:
+ fname = sys.argv[1]
+
+fname_new = fname+".new"
+
+sys.stdin = open(fname, 'r')
+
+nextline = None
for line in sys.stdin:
line = line.rstrip()
@@ -286,13 +295,14 @@ for line in sys.stdin:
CL.lint()
-sys.stdout = open('ChangeLog.new', 'w')
+sys.stdout = open(fname_new, 'w')
CL.dump()
-print nextline
+if nextline is not None:
+ print nextline
for line in sys.stdin:
sys.stdout.write(line)
-os.rename('ChangeLog.new', 'ChangeLog')
+os.rename(fname_new, fname)