lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [1/4] lucene-solr:branch_6x: Improve addVersion.py: in Version.java, remove 'Use this to get the latest...' from the previous LATEST, and add it to the new LATEST
Date Fri, 13 May 2016 22:41:35 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 06d2f6368 -> c9f753570


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/6e52d62f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6e52d62f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6e52d62f

Branch: refs/heads/branch_6x
Commit: 6e52d62f69c75ff160ee03a9ae0ddd6b03e4f6dd
Parents: 06d2f63
Author: Steve Rowe <sarowe@apache.org>
Authored: Fri May 13 15:23:18 2016 -0400
Committer: Steve Rowe <sarowe@apache.org>
Committed: Fri May 13 17:23:12 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/6e52d62f/dev-tools/scripts/addVersion.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py
index ccf1a49..300c9f9 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 &amp; 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


Mime
View raw message