From 60fac6c177f8f858573e4f40c1449f020d77ac4f Mon Sep 17 00:00:00 2001 From: Steve Rowe Date: Sat, 25 Jun 2016 13:11:16 -0400 Subject: [PATCH] Switch is-latest-version check from whether the branch types match to directly comparing the new version against the current version --- dev-tools/scripts/addVersion.py | 8 +++----- dev-tools/scripts/scriptutil.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py index cc411162c64..92a49b3dfa5 100644 --- a/dev-tools/scripts/addVersion.py +++ b/dev-tools/scripts/addVersion.py @@ -179,9 +179,7 @@ def read_config(): c = parser.parse_args() c.branch_type = find_branch_type() - c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \ - c.version.is_minor_release() and c.branch_type == BranchType.stable or \ - c.version.is_major_release() and c.branch_type == BranchType.unstable + c.is_latest_version = c.version.on_or_after(Version.parse(find_current_version())) print ("branch_type is %s " % c.branch_type) @@ -217,9 +215,9 @@ def main(): print('\nAdding new version %s' % c.version) update_changes('lucene/CHANGES.txt', c.version) update_changes('solr/CHANGES.txt', c.version, get_solr_init_changes()) - add_constant(c.version, not c.matching_branch) + add_constant(c.version, not c.is_latest_version) - if c.matching_branch: + if c.is_latest_version: print('\nUpdating latest version') update_build_version(c.version) update_latest_constant(c.version) diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py index 84c39cd9516..bf7cec5dec4 100644 --- a/dev-tools/scripts/scriptutil.py +++ b/dev-tools/scripts/scriptutil.py @@ -119,7 +119,7 @@ def find_branch_type(): version_prop_re = re.compile('version\.base=(.*)') def find_current_version(): - return version_prop_re.search(open('lucene/version.properties').read()).group(1) + return version_prop_re.search(open('lucene/version.properties').read()).group(1).strip() if __name__ == '__main__': print('This is only a support module, it cannot be run')