LUCENE-8883: addVersion.py now adds categories to CHANGES.txt

This commit is contained in:
David Smiley 2019-08-06 13:53:22 +02:00
parent 9e250f7219
commit 742e6b7eff
1 changed files with 9 additions and 5 deletions

View File

@ -25,7 +25,7 @@ import re
from configparser import ConfigParser, ExtendedInterpolation
from textwrap import dedent
def update_changes(filename, new_version, init_changes = '(No Changes)\n\n'):
def update_changes(filename, new_version, init_changes, headers):
print(' adding new section to %s...' % filename, end='', flush=True)
matcher = re.compile(r'\d+\.\d+\.\d+\s+===')
def edit(buffer, match, line):
@ -35,6 +35,8 @@ def update_changes(filename, new_version, init_changes = '(No Changes)\n\n'):
if match is not None:
buffer.append(line.replace(match.group(0), new_version.dot))
buffer.append(init_changes)
for header in headers:
buffer.append('%s\n---------------------\n(No changes)\n\n' % header)
buffer.append(line)
return match is not None
@ -206,8 +208,6 @@ def get_solr_init_changes():
Apache ZooKeeper %(/org.apache.zookeeper/zookeeper)s
Jetty %(org.eclipse.jetty.version)s
(No Changes)\n\n
''' % parse_properties_file('lucene/ivy-versions.properties'))
def main():
@ -215,10 +215,14 @@ def main():
sys.exit("Tool must be run from the root of a source checkout.")
current_version = Version.parse(find_current_version())
newconf = read_config(current_version)
is_bugfix = newconf.version.is_bugfix_release()
print('\nAdding new version %s' % newconf.version)
update_changes('lucene/CHANGES.txt', newconf.version)
update_changes('solr/CHANGES.txt', newconf.version, get_solr_init_changes())
# See LUCENE-8883 for some thoughts on which categories to use
update_changes('lucene/CHANGES.txt', newconf.version, '\n',
['Bug Fixes'] if is_bugfix else ['API Changes', 'New Features', 'Improvements', 'Optimizations', 'Bug Fixes', 'Other'])
update_changes('solr/CHANGES.txt', newconf.version, get_solr_init_changes(),
['Bug Fixes'] if is_bugfix else ['Upgrade Notes', 'New Features', 'Improvements', 'Optimizations', 'Bug Fixes', 'Other Changes'])
latest_or_backcompat = newconf.is_latest_version or current_version.is_back_compat_with(newconf.version)
if latest_or_backcompat: