You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2016/04/12 12:58:51 UTC

[1/2] lucene-solr:branch_6x: LUCENE-7155: Script addVersion.py does not detect the new naming convention for bugfix branches (cherry picked from commit 6e446c0)

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 882901dcf -> 485fd48c3


LUCENE-7155: Script addVersion.py does not detect the new naming convention for bugfix branches
(cherry picked from commit 6e446c0)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a7c171f5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a7c171f5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a7c171f5

Branch: refs/heads/branch_6x
Commit: a7c171f51237663acc6fc79247ce0943149fddc1
Parents: 882901d
Author: Jan Høydahl <ja...@apache.org>
Authored: Thu Mar 31 15:35:48 2016 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Tue Apr 12 12:51:01 2016 +0200

----------------------------------------------------------------------
 dev-tools/scripts/scriptutil.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a7c171f5/dev-tools/scripts/scriptutil.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index 6a3bcab..10efd2b 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -107,9 +107,9 @@ def find_branch_type():
 
   if branchName == b'master':
     return 'master'
-  if branchName.startswith(b'branch_'):
+  if re.match(r'branch_(\d+)x', branchName.decode('UTF-8')):
     return 'stable'
-  if branchName.startswith(b'lucene_solr_'):
+  if re.match(r'branch_(\d+)_(\d+)', branchName.decode('UTF-8')):
     return 'release'
   raise Exception('Cannot run bumpVersion.py on feature branch')
 


[2/2] lucene-solr:branch_6x: LUCENE-7155: Detect master/major branch using enum, abort on more errors (cherry picked from commit 10c7757)

Posted by ja...@apache.org.
LUCENE-7155: Detect master/major branch using enum, abort on more errors
(cherry picked from commit 10c7757)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/485fd48c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/485fd48c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/485fd48c

Branch: refs/heads/branch_6x
Commit: 485fd48c30f85c2029906a3a90a37efa2cbe58c8
Parents: a7c171f
Author: Jan Høydahl <ja...@apache.org>
Authored: Mon Apr 11 23:22:40 2016 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Tue Apr 12 12:51:43 2016 +0200

----------------------------------------------------------------------
 dev-tools/scripts/addVersion.py | 18 ++++++++++--------
 dev-tools/scripts/scriptutil.py | 16 ++++++++++------
 2 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/485fd48c/dev-tools/scripts/addVersion.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py
index 6eaf517..ccf1a49 100644
--- a/dev-tools/scripts/addVersion.py
+++ b/dev-tools/scripts/addVersion.py
@@ -19,9 +19,7 @@ sys.path.append(os.path.dirname(__file__))
 from scriptutil import *
 
 import argparse
-import io
 import re
-import subprocess
 
 def update_changes(filename, new_version):
   print('  adding new section to %s...' % filename, end='', flush=True)
@@ -168,18 +166,22 @@ def check_solr_version_tests():
 def read_config():
   parser = argparse.ArgumentParser(description='Add a new version')
   parser.add_argument('version', type=Version.parse)
-  parser.add_argument('-c', '--changeid', type=str, help='SVN ChangeId for downstream version change to merge')
+  parser.add_argument('-c', '--changeid', type=str, help='Git ChangeId (commit hash) for downstream version change to merge')
   c = parser.parse_args()
 
   c.branch_type = find_branch_type()
-  c.matching_branch = c.version.is_bugfix_release() and c.branch_type == 'release' or \
-                      c.version.is_minor_release() and c.branch_type == 'stable' or \
-                      c.branch_type == 'major'
+  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.major
 
-  if c.changeid and c.matching_branch:
-    parser.error('Cannot use --changeid on branch that new version will originate on')
   if c.changeid and c.version.is_major_release():
     parser.error('Cannot use --changeid for major release')
+  if c.changeid and c.matching_branch:
+    parser.error('Cannot use --changeid on branch that new version will originate on')
+  if c.version.is_bugfix_release() and c.branch_type in [BranchType.major, BranchType.stable] and not c.changeid:
+    parser.error('Adding bugfix release on master or stable branch requires --changeid')
+  if c.version.is_minor_release() and c.branch_type in [BranchType.major] and not c.changeid:
+    parser.error('Adding minor release on master branch requires --changeid')
 
   return c
   

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/485fd48c/dev-tools/scripts/scriptutil.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index 10efd2b..216bde4 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -14,11 +14,10 @@
 # limitations under the License.
 
 import argparse
-import io
-import os
 import re
 import subprocess
 import sys
+from enum import Enum
 
 class Version(object):
   def __init__(self, major, minor, bugfix, prerelease):
@@ -95,7 +94,12 @@ def update_file(filename, line_re, edit):
     f.write(''.join(buffer))
   return True
 
-# branch types are "release", "stable" and "trunk"
+# branch types are "release", "stable" and "major"
+class BranchType(Enum):
+  major   = 1
+  stable  = 2
+  release = 3
+
 def find_branch_type():
   output = subprocess.check_output('git status', shell=True)
   for line in output.split(b'\n'):
@@ -106,11 +110,11 @@ def find_branch_type():
     raise Exception('git status missing branch name')
 
   if branchName == b'master':
-    return 'master'
+    return BranchType.major
   if re.match(r'branch_(\d+)x', branchName.decode('UTF-8')):
-    return 'stable'
+    return BranchType.stable
   if re.match(r'branch_(\d+)_(\d+)', branchName.decode('UTF-8')):
-    return 'release'
+    return BranchType.release
   raise Exception('Cannot run bumpVersion.py on feature branch')
 
 version_prop_re = re.compile('version\.base=(.*)')