You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2019/03/01 16:27:58 UTC
svn commit: r1854607 -
/subversion/trunk/tools/dist/create-minor-release-branch.py
Author: julianfoad
Date: Fri Mar 1 16:27:58 2019
New Revision: 1854607
URL: http://svn.apache.org/viewvc?rev=1854607&view=rev
Log:
Update 'create-minor-release-branch.py' script to take account of the comment
lines that we now have at the top of the 'CHANGES' file.
* tools/dist/create-minor-release-branch.py
(edit_changes_file): Rename; skip comments before inserting new text.
Modified:
subversion/trunk/tools/dist/create-minor-release-branch.py
Modified: subversion/trunk/tools/dist/create-minor-release-branch.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/create-minor-release-branch.py?rev=1854607&r1=1854606&r2=1854607&view=diff
==============================================================================
--- subversion/trunk/tools/dist/create-minor-release-branch.py (original)
+++ subversion/trunk/tools/dist/create-minor-release-branch.py Fri Mar 1 16:27:58 2019
@@ -102,11 +102,20 @@ def edit_file(path, pattern, replacement
assert new_text != old_text
open(path, 'w').write(new_text)
-def prepend_file(path, text):
+def edit_changes_file(path, newtext):
+ """Insert NEWTEXT in the 'CHANGES' file found at PATH,
+ just before the first line that starts with 'Version '.
+ """
print("Prepending to '%s'" % (path,))
- print(" text='%s'" % (text,))
- original = open(path, 'r').read()
- open(path, 'w').write(text + original)
+ print(" text='%s'" % (newtext,))
+ lines = open(path, 'r').readlines()
+ for i, line in enumerate(lines):
+ if line.startswith('Version '):
+ with open(path, 'w') as newfile:
+ newfile.writelines(lines[:i])
+ newfile.write(newtext)
+ newfile.writelines(lines[i:])
+ break
#----------------------------------------------------------------------
def make_release_branch(ver, revnum):
@@ -158,7 +167,7 @@ def update_minor_ver_in_trunk(ver, revnu
relpath = 'CHANGES'
relpaths.append(relpath)
# insert at beginning of CHANGES file
- prepend_file(get_trunk_wc_path(relpath),
+ edit_changes_file(get_trunk_wc_path(relpath),
'Version ' + next_ver.base + '\n'
+ '(?? ??? 20XX, from /branches/' + next_ver.branch + '.x)\n'
+ get_tag_url(next_ver) + '\n'