brew-test-bot: better name hash and url builds.

This commit is contained in:
Mike McQuaid 2013-06-02 13:01:02 +01:00
parent bec7ff9807
commit 4f3d1f029e

View File

@ -145,6 +145,10 @@ class Test
git('symbolic-ref HEAD').gsub('refs/heads/', '').strip git('symbolic-ref HEAD').gsub('refs/heads/', '').strip
end end
def single_commit? start_revision, end_revision
git("rev-list --count #{start_revision}..#{end_revision}").to_i == 1
end
@category = __method__ @category = __method__
@start_branch = current_branch @start_branch = current_branch
@ -160,7 +164,8 @@ class Test
end end
if @hash == 'HEAD' if @hash == 'HEAD'
if diff_start_sha1 == diff_end_sha1 if diff_start_sha1 == diff_end_sha1 or \
single_commit?(diff_start_sha1, diff_end_sha1)
@name = diff_end_sha1 @name = diff_end_sha1
else else
@name = "#{diff_start_sha1}-#{diff_end_sha1}" @name = "#{diff_start_sha1}-#{diff_end_sha1}"
@ -174,7 +179,14 @@ class Test
test "git checkout #{current_sha1}" test "git checkout #{current_sha1}"
test "brew pull --clean #{@url}" test "brew pull --clean #{@url}"
diff_end_sha1 = current_sha1 diff_end_sha1 = current_sha1
@name = "#{@url}-#{diff_end_sha1}" @short_url = @url.gsub('https://github.com/', '')
if @short_url.include? '/commit/'
# 7 characters should be enough for a commit (not 40).
@short_url.gsub!(/(commit\/\w{7}).*/, '\1')
@name = @short_url
else
@name = "#{@short_url}-#{diff_end_sha1}"
end
else else
diff_start_sha1 = diff_end_sha1 = current_sha1 diff_start_sha1 = diff_end_sha1 = current_sha1
@name = "#{@formulae.first}-#{diff_end_sha1}" @name = "#{@formulae.first}-#{diff_end_sha1}"