Skip to content

Commit 16e10a3

Browse files
[wasm] sync update-checkout-config.json with main
1 parent 388c0bb commit 16e10a3

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

utils/update_checkout/update-checkout-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"llbuild": "main",
9696
"swift-tools-support-core": "main",
9797
"swiftpm": "main",
98-
"swift-argument-parser": "1.1.4",
98+
"swift-argument-parser": "1.2.2",
9999
"swift-atomics": "1.0.2",
100100
"swift-collections": "1.0.1",
101101
"swift-crypto": "2.2.3",
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env ruby
2+
3+
require "json"
4+
5+
DOWNSTREAM_FORKS = ["swift", "swift-corelibs-foundation", "swift-corelibs-xctest"]
6+
7+
def sync_checkout(options)
8+
config = JSON.parse(File.read(options[:config_path]))
9+
branch_schemes = config["branch-schemes"]
10+
upstream = branch_schemes[options[:upstream]]
11+
raise "No branch scheme for #{options[:upstream]}" unless upstream
12+
downstream = branch_schemes[options[:downstream]]
13+
raise "No branch scheme for #{options[:downstream]}" unless downstream
14+
15+
upstream["repos"].each do |project, upstream_branch|
16+
next if DOWNSTREAM_FORKS.include?(project)
17+
downstream_branch = downstream["repos"][project]
18+
next if downstream_branch == upstream_branch
19+
20+
puts "Please update #{project} to #{upstream_branch} (currently #{downstream_branch})"
21+
end
22+
end
23+
24+
def main
25+
require "optparse"
26+
options = {
27+
config_path: File.expand_path(File.join(__dir__, "..", "update_checkout", "update-checkout-config.json")),
28+
upstream: "main",
29+
downstream: "wasm",
30+
}
31+
32+
opts = OptionParser.new do |opts|
33+
opts.banner = "Usage: sync-update-checkout.rb [options]"
34+
35+
opts.on("--config PATH", "Path to update-checkout-config.json") do |path|
36+
options[:config_path] = path
37+
end
38+
39+
opts.on("--upstream BRANCH", "Name of upstream branch") do |branch|
40+
options[:upstream] = branch
41+
end
42+
43+
opts.on("--downstream BRANCH", "Name of downstream branch") do |branch|
44+
options[:downstream] = branch
45+
end
46+
end
47+
opts.parse!
48+
49+
sync_checkout(options)
50+
end
51+
52+
main if $0 == __FILE__

0 commit comments

Comments
 (0)