Skip to content

Commit e52efe7

Browse files
committed
JT: Remove jt pr as it is no longer used
1 parent b2b8a85 commit e52efe7

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
@@ -822,79 +819,6 @@ def compile_cext(name, ext_dir, target, clang_opts, env: {})
822819
end
823820
end
824821

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

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

0 commit comments

Comments
 (0)