lib/gitscape/base.rb in gitscape-1.6.5 vs lib/gitscape/base.rb in gitscape-1.6.6
- old
+ new
@@ -42,11 +42,12 @@
working_copy_clean
end
def live_iteration
- toRet = `git branch -a --merged origin/live`.split("\n").select{|b| /release\/i(\d+)$/.match b}.map{|b| b.scan(/release\/i(\d+)$/).flatten[0].to_i}.sort.last
+ live_iteration_tag_regex = /^live\/i(\d+)/
+ toRet = `git tag`.split("\n").select { |tag| live_iteration_tag_regex.match tag }.map { |tag| tag.scan(live_iteration_tag_regex).flatten[0].to_i }.sort.last
toRet
end
def current_branch_name
toRet = `git branch`.scan(/\* (.*)$/).flatten[0]
@@ -314,10 +315,10 @@
# Select which tags to keep.
# We currently keep tags which fulfill any of the following
# 1. starts with 'service/'
# 2. starts with 'rollback-to/' or 'live/', and has an iteration number >= the live_iteration number - 3
tags = `git tag`.split "\n"
- tags_to_delete = tags.select { |tag| !(!/^service\//.match(tag).nil? || /^(?:live|rollback-to)\/i(\d+)/.match(tag).to_a[1].to_i >= live_iteration - 3) }
+ tags_to_delete = tags.select { |tag| !(!/^service\//.match(tag).nil? || /^(?:live|rollback-to)\/i(\d+)/.match(tag).to_a[1].to_i >= live_iteration.to_i - 3) }
puts "Deleting the following tags.\nThese changes #{options[:push] ? "will" : "will not"} be pushed to origin.\n"
tags_to_delete.each { |tag| puts `git tag -d #{tag}` }
tags_to_delete.each { |tag| puts `git push origin :refs/tags/#{tag}` } if options[:push]