Skip to content

Commit 5ffb8c7

Browse files
committed
Add oneshot.rake for removing duplicated commit
1 parent ed9fb00 commit 5ffb8c7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/tasks/temporary/oneshot.rake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace :oneshot do
2+
desc 'Remove duplicated commit'
3+
task remove_duplicates: :environment do
4+
commit = Commit.find(28796) # unlink commit
5+
if commit.sha1 != "f2dec4ab9615807b7eaee25e5be24b271e2283b3"
6+
raise "wrong sha1: #{commit.sha1}"
7+
end
8+
type = BenchmarkResultType.find_by(name: 'Execution time', unit: 'Seconds')
9+
10+
BenchmarkType.all.each do |benchmark_type|
11+
unless benchmark_type.script_url.match(%r[\Ahttps://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmark/])
12+
next
13+
end
14+
15+
if run = benchmark_type.benchmark_runs.where(initiator: commit, benchmark_result_type: type)
16+
run.destroy
17+
end
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)