forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
excise_stdlib.sh
executable file
·41 lines (31 loc) · 967 Bytes
/
excise_stdlib.sh
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
#!/usr/bin/env bash
# Uses https://github.com/newren/git-filter-repo
# Recommended use of `Github cli`
set -e
set -f
set -x
if [ -z "$*" ]; then echo "Expected name of stdlib"; fi
STDLIB=$1
WORKDIR=$(mktemp -d)
echo "Excising stdlib $STDLIB; workdir $WORKDIR"
pushd $WORKDIR
git clone https://github.com/JuliaLang/julia $STDLIB
pushd $STDLIB
echo "Filtering repo"
git filter-repo --subdirectory-filter stdlib/$STDLIB --path LICENSE.md \
--message-callback 'return re.sub(b"(\W)(#\d+)", lambda m: m.group(1) + b"JuliaLang/julia" + m.group(2), message)'
echo "Deleting branches"
git branch -l | grep -v release- | grep -v master | xargs git branch -v -D
popd
popd
echo "Done! Inspect the result and push it!"
echo """
cd $WORKDIR/$STDLIB
gh repo create JuliaLang/$STDLIB.jl --push --source=. --public
git push --all
git push --tags"""
echo """
Remember to:
1. Add a README.md
2. Setup GHA or similar for CI
"""