VIVO-272 Do proper merge and tag of the final release

This commit is contained in:
j2blake 2013-09-02 13:09:40 -04:00
parent f72913a2f1
commit 8ed2523a7d
2 changed files with 21 additions and 16 deletions

View file

@ -23,7 +23,7 @@ require '_common'
#
def export_files(vivo_path, vitro_path, tag, export_dir)
approve_and_execute([
"rm -Rf #{export_dir}/..",
"rm -Rf #{File.expand_path("..", export_dir)}",
"mkdir -pv #{export_dir}",
"cp -R #{vivo_path}/* #{export_dir}",
"mkdir -pv #{export_dir}/vitro-core",

View file

@ -1,9 +1,11 @@
=begin
--------------------------------------------------------------------------------
Merge the new tags into the master branches.
Merge the maintenance branches into the master branchs, and create the final
release tags.
This will only work if the tag is present, and if the release candidate is "final".
This will only work if the release candidate is "final", and if the maintenance
branches already exist.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
@ -13,14 +15,17 @@ $: << File.dirname(File.expand_path(__FILE__))
require '_common'
#
# Merge the tag to the master branch.
# Merge the maintenance branch to the master branch and create the tag.
#
def merge_tag_to_master(tag, repo_path)
def merge_branch_to_master(branch, tag, message, repo_path)
Dir.chdir(repo_path) do |path|
approve_and_execute([
"git checkout master",
"git merge #{tag}"
])
cmds = [
"git checkout master",
"git merge --no-ff -Xtheirs #{branch}",
"git tag -a -f #{tag} -m '#{message}'"
]
cmds.insert(0, "git branch master origin/master") if `git branch --list master`.strip.empty?
approve_and_execute(cmds, "in #{path}")
end
end
@ -31,24 +36,24 @@ end
#
begin
branch = Settings.branch_name
candidate_label = Settings.confirm_candidate_label(Settings.candidate_label)
tag = Settings.tag_name
message = Settings.tag_message
vivo_path = Settings.vivo_path
vitro_path = Settings.vitro_path
raise BadState.new("Only the final release gets merged to the master branch.") unless candidate_label == "final"
raise BadState.new("Tag #{tag} doesn't exist in VIVO.") unless tag_exists?(vivo_path, tag)
raise BadState.new("Tag #{tag} doesn't exist in Vitro.") unless tag_exists?(vitro_path, tag)
raise BadState.new("Tag has already been merged to master branch in VIVO." if tag_commit(tag, vivo_path) == master_commit(vivo_path)
raise BadState.new("Tag has already been merged to master branch in Vitro." if tag_commit(tag, vitro_path) == master_commit(vitro_path)
raise BadState.new("Only the final release gets merged to the master branch.") unless candidate_label == "final"
raise BadState.new("Branch #{branch} doesn't exist in VIVO.") unless branch_exists?(vivo_path, branch)
raise BadState.new("Branch #{branch} doesn't exist in Vitro.") unless branch_exists?(vitro_path, branch)
puts
yn = prompt("OK to merge the #{tag} tags to the master branches? (y/n)")
if yn.downcase == 'y'
puts
puts "Merging tags"
merge_tag_to_master(tag, vivo_path)
merge_tag_to_master(tag, vitro_path)
merge_branch_to_master(branch, tag, message, vivo_path)
merge_branch_to_master(branch, tag, message, vitro_path)
puts
else
puts