You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/05/13 19:23:40 UTC
lucene-solr:branch_6_0: Improve addVersion.py: in Version.java,
remove 'Use this to get the latest...' from the previous LATEST,
and add it to the new LATEST
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6_0 1af681b05 -> 8ea8c51ef
Improve addVersion.py: in Version.java, remove 'Use this to get the latest...' from the previous LATEST, and add it to the new LATEST
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8ea8c51e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8ea8c51e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8ea8c51e
Branch: refs/heads/branch_6_0
Commit: 8ea8c51ef19437fed0c360c42df4b7c02ce01b2c
Parents: 1af681b
Author: Steve Rowe <sa...@apache.org>
Authored: Fri May 13 15:23:18 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Fri May 13 15:23:18 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/addVersion.py | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8ea8c51e/dev-tools/scripts/addVersion.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py
index 112da45..4b8c966 100644
--- a/dev-tools/scripts/addVersion.py
+++ b/dev-tools/scripts/addVersion.py
@@ -48,28 +48,36 @@ def add_constant(new_version, deprecate):
last = buffer[-1]
if last.strip() != '@Deprecated':
spaces = ' ' * (len(last) - len(last.lstrip()) - 1)
- buffer[-1] = spaces + (' * @deprecated (%s) Use latest\n' % new_version)
- buffer.append(spaces + ' */\n')
- buffer.append(spaces + '@Deprecated\n')
+ del buffer[-1] # Remove comment closer line
+ if (len(buffer) >= 4 and re.search('for Lucene.\s*$', buffer[-1]) != None):
+ del buffer[-3:] # drop the trailing lines '<p> / Use this to get the latest ... / ... for Lucene.'
+ buffer.append(( '{0} * @deprecated ({1}) Use latest\n'
+ + '{0} */\n'
+ + '{0}@Deprecated\n').format(spaces, new_version))
def buffer_constant(buffer, line):
spaces = ' ' * (len(line) - len(line.lstrip()))
- buffer.append('\n' + spaces + '/**\n')
- buffer.append(spaces + ' * Match settings and bugs in Lucene\'s %s release.\n' % new_version)
+ buffer.append(( '\n{0}/**\n'
+ + '{0} * Match settings and bugs in Lucene\'s {1} release.\n')
+ .format(spaces, new_version))
if deprecate:
- buffer.append(spaces + ' * @deprecated Use latest\n')
- buffer.append(spaces + ' */\n')
+ buffer.append('%s * @deprecated Use latest\n' % spaces)
+ else:
+ buffer.append(( '{0} * <p>\n'
+ + '{0} * Use this to get the latest & greatest settings, bug\n'
+ + '{0} * fixes, etc, for Lucene.\n').format(spaces))
+ buffer.append('%s */\n' % spaces)
if deprecate:
- buffer.append(spaces + '@Deprecated\n')
- buffer.append(spaces + 'public static final Version %s = new Version(%d, %d, %d);\n' %
- (new_version.constant, new_version.major, new_version.minor, new_version.bugfix))
+ buffer.append('%s@Deprecated\n' % spaces)
+ buffer.append('{0}public static final Version {1} = new Version({2}, {3}, {4});\n'.format
+ (spaces, new_version.constant, new_version.major, new_version.minor, new_version.bugfix))
class Edit(object):
found = -1
def __call__(self, buffer, match, line):
if new_version.constant in line:
return None # constant already exists
- # outter match is just to find lines declaring version constants
+ # outer match is just to find lines declaring version constants
match = prev_matcher.search(line)
if match is not None:
ensure_deprecated(buffer) # old version should be deprecated