-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathgen_branches.py
59 lines (48 loc) · 1.35 KB
/
gen_branches.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
from git import Repo
import toml
BRANCHES = [
'1.11',
'1.13',
'1.14',
'1.16',
]
IMPORTANT_MODULES = [
"solana-sdk",
"solana-program",
"solana-logger",
"solana-runtime",
"solana-transaction-status",
"solana-cli-output",
"solana-bpf-loader-program",
"solana-compute-budget-program",
"solana-vote-program",
"solana-stake-program",
"solana-config-program",
"solana-client",
"solana-faucet",
"solana-program-runtime",
"solana-ledger",
]
r = Repo(os.path.dirname(os.path.realpath(__file__)))
assert r.heads.main == r.active_branch
for branch in BRANCHES:
if branch not in r.heads:
print(f'Creating branch {branch}')
r.create_head(branch, r.heads.main)
r.heads[branch].checkout()
with open('Cargo.toml') as f:
cargo = toml.load(f)
for module in IMPORTANT_MODULES:
cargo['dependencies'][module] = f'~{branch}'
with open('Cargo.toml', 'w') as f:
toml.dump(cargo, f)
os.system("cargo generate-lockfile")
r.index.add(['Cargo.toml', 'Cargo.lock'])
r.index.commit(f'Create {branch} branch')
#r.remotes.origin.push(branch)
else:
print("Updating branch %s" % branch)
r.heads[branch].checkout()
base = r.git.merge(r.heads.main)
r.heads.main.checkout()