Auto merge of #2600 - str4d:2497-hotfix-release, r=str4d
Implement process for hotfix releases Closes #2497.
This commit is contained in:
@@ -27,6 +27,7 @@ def main(args=sys.argv[1:]):
|
||||
opts.RELEASE_VERSION,
|
||||
opts.RELEASE_PREV,
|
||||
opts.RELEASE_HEIGHT,
|
||||
opts.HOTFIX,
|
||||
)
|
||||
except SystemExit as e:
|
||||
logging.error(str(e))
|
||||
@@ -44,6 +45,12 @@ def parse_args(args):
|
||||
type=str,
|
||||
help='Path to repository root.',
|
||||
)
|
||||
p.add_argument(
|
||||
'--hotfix',
|
||||
action='store_true',
|
||||
dest='HOTFIX',
|
||||
help='Use if this is a hotfix release from a non-master branch.',
|
||||
)
|
||||
p.add_argument(
|
||||
'RELEASE_VERSION',
|
||||
type=Version.parse_arg,
|
||||
@@ -63,9 +70,10 @@ def parse_args(args):
|
||||
|
||||
|
||||
# Top-level flow:
|
||||
def main_logged(release, releaseprev, releaseheight):
|
||||
def main_logged(release, releaseprev, releaseheight, hotfix):
|
||||
verify_releaseprev_tag(releaseprev)
|
||||
initialize_git(release)
|
||||
verify_version(release, releaseprev, hotfix)
|
||||
initialize_git(release, hotfix)
|
||||
patch_version_in_files(release, releaseprev)
|
||||
patch_release_height(releaseheight)
|
||||
commit('Versioning changes for {}.'.format(release.novtext))
|
||||
@@ -123,17 +131,41 @@ def verify_releaseprev_tag(releaseprev):
|
||||
)
|
||||
|
||||
|
||||
@phase('Checking version.')
|
||||
def verify_version(release, releaseprev, hotfix):
|
||||
if not hotfix:
|
||||
return
|
||||
|
||||
expected = Version(
|
||||
releaseprev.major,
|
||||
releaseprev.minor,
|
||||
releaseprev.patch,
|
||||
releaseprev.betarc,
|
||||
releaseprev.hotfix + 1 if releaseprev.hotfix else 1,
|
||||
)
|
||||
if release != expected:
|
||||
raise SystemExit(
|
||||
"Expected {!r}, given {!r}".format(
|
||||
expected, release,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@phase('Initializing git.')
|
||||
def initialize_git(release):
|
||||
def initialize_git(release, hotfix):
|
||||
junk = sh_out('git', 'status', '--porcelain')
|
||||
if junk.strip():
|
||||
raise SystemExit('There are uncommitted changes:\n' + junk)
|
||||
|
||||
branch = sh_out('git', 'rev-parse', '--abbrev-ref', 'HEAD').strip()
|
||||
if branch != 'master':
|
||||
if hotfix:
|
||||
expected = 'hotfix-' + release.vtext
|
||||
else:
|
||||
expected = 'master'
|
||||
if branch != expected:
|
||||
raise SystemExit(
|
||||
"Expected branch 'master', found branch {!r}".format(
|
||||
branch,
|
||||
"Expected branch {!r}, found branch {!r}".format(
|
||||
expected, branch,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user