Skip to content

Commit 8b6d631

Browse files
committed
JT: Remove jt pr as it is no longer used
PullRequest: truffleruby/669
2 parents 89e5a01 + e52efe7 commit 8b6d631

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

tool/jt.rb

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,6 @@ def help
587587
jt profile profiles an application, including the TruffleRuby runtime, and generates a flamegraph
588588
jt where repos ... find these repositories
589589
jt next tell you what to work on next (give you a random core library spec)
590-
jt pr [pr_number] pushes GitHub's PR to bitbucket to let CI run under github/pr/<number> name
591-
if the pr_number is not supplied current HEAD is used to find a PR which contains it
592-
jt pr clean [--dry-run] delete all github/pr/<number> branches from BB whose GitHub PRs are closed
593590
jt install jvmci install a JVMCI JDK in the parent directory
594591
jt install graal [--no-jvmci] install Graal in the parent directory (--no-jvmci to use the system Java)
595592
jt docker build a Docker image - see doc/contributor/docker.md
@@ -823,79 +820,6 @@ def compile_cext(name, ext_dir, target, clang_opts, env: {})
823820
end
824821
end
825822

826-
module PR
827-
include Utilities
828-
extend self
829-
830-
def pr_clean(*args)
831-
require 'net/http'
832-
833-
dry_run = args.delete '--dry-run'
834-
uri = URI('https://api.github.com/repos/oracle/truffleruby/pulls')
835-
puts "Contacting GitHub: #{uri}"
836-
data = Net::HTTP.get(uri)
837-
prs_data = JSON.parse data
838-
open_prs = prs_data.map { |prd| Integer(prd.fetch('number')) }
839-
puts "Open PRs: #{open_prs}"
840-
841-
sh 'git', 'fetch', Remotes.bitbucket, '--prune' # ensure we have locally only existing remote branches
842-
branches = sh 'git', 'branch', '--remote', '--list', capture: true
843-
branches_to_delete = branches.
844-
scan(/^ *#{Remotes.bitbucket}\/(github\/pr\/(\d+))$/).
845-
reject { |_, number| open_prs.include? Integer(number) }
846-
847-
puts "Deleting #{branches_to_delete.size} remote branches on #{Remotes.bitbucket}:"
848-
puts branches_to_delete.map(&:last).map(&:to_i).to_s
849-
return if dry_run
850-
851-
branches_to_delete.each do |remote_branch, _|
852-
sh 'git', 'push', '--no-verify', Remotes.bitbucket, ":#{remote_branch}"
853-
end
854-
855-
# update remote branches
856-
sh 'git', 'fetch', Remotes.bitbucket, '--prune'
857-
end
858-
859-
def pr_push(*args)
860-
# Fetch PRs on GitHub
861-
fetch = "+refs/pull/*/head:refs/remotes/#{Remotes.github}/pr/*"
862-
out = sh 'git', 'config', '--get-all', "remote.#{Remotes.github}.fetch", capture: true
863-
sh 'git', 'config', '--add', "remote.#{Remotes.github}.fetch", fetch unless out.include? fetch
864-
sh 'git', 'fetch', Remotes.github
865-
866-
pr_number = args.first
867-
if pr_number
868-
github_pr_branch = "#{Remotes.github}/pr/#{pr_number}"
869-
else
870-
github_pr_branch = begin
871-
out = sh 'git', 'branch', '-r', '--contains', 'HEAD', capture: true
872-
candidate = out.lines.find { |l| l.strip.start_with? "#{Remotes.github}/pr/" }
873-
candidate && candidate.strip.chomp
874-
end
875-
876-
unless github_pr_branch
877-
puts 'Could not find HEAD in any of the GitHub pull-requests.'
878-
exit 1
879-
end
880-
881-
pr_number = github_pr_branch.split('/').last
882-
end
883-
884-
target_branch = if git_branch.start_with?('release')
885-
git_branch
886-
else
887-
"github/pr/#{pr_number}"
888-
end
889-
890-
sh 'git', 'push', '--force', '--no-verify', Remotes.bitbucket, "#{github_pr_branch}:refs/heads/#{target_branch}"
891-
end
892-
893-
def pr_update_master(skip_upstream_fetch: false)
894-
sh 'git', 'fetch', Remotes.github unless skip_upstream_fetch
895-
sh 'git', 'push', '--no-verify', Remotes.bitbucket, "#{Remotes.github}/master:master"
896-
end
897-
end
898-
899823
module Remotes
900824
include Utilities
901825
extend self
@@ -931,20 +855,6 @@ def try_fetch(repo)
931855
end
932856
end
933857

934-
def pr(*args)
935-
command, *options = args
936-
case command
937-
when 'clean'
938-
PR.pr_clean *options
939-
when 'up'
940-
PR.pr_update_master *options
941-
else
942-
PR.pr_push *args
943-
# To regularly update bb/master
944-
PR.pr_update_master skip_upstream_fetch: true
945-
end
946-
end
947-
948858
def test(*args)
949859
path, *rest = args
950860

0 commit comments

Comments
 (0)