Skip to content

Commit 6c115bc

Browse files
committed
bigbang script
1 parent 39838c2 commit 6c115bc

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

util/pyret-bigbang.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/zsh
2+
3+
# Historical: Initialize the pyret monorepo by pulling each subrepo into its
4+
# own branch, moving its files into a subdirectory, tagging the import, then
5+
# merging all branches into main.
6+
7+
typeset -A repos=(
8+
["embed"]="git@github.com:jpolitz/pyret-embed.git"
9+
["vscode"]="git@github.com:jpolitz/pyret-parley-vscode.git"
10+
["npm"]="git@github.com:brownplt/pyret-npm.git"
11+
["pyret.org"]="git@github.com:brownplt/pyret.org.git"
12+
["docs"]="git@github.com:brownplt/pyret-docs.git"
13+
["codemirror-mode"]="git@github.com:brownplt/pyret-codemirror-mode.git"
14+
["code.pyret.org"]="git@github.com:brownplt/code.pyret.org.git"
15+
["lang"]="git@github.com:brownplt/pyret-lang.git"
16+
)
17+
18+
pull_subrepo() {
19+
local branch="$1"
20+
local repo="$2"
21+
branch="$1"
22+
repo="$2"
23+
24+
git branch "$branch"
25+
git checkout "$branch"
26+
git pull --allow-unrelated-histories --no-ff "$repo"
27+
28+
mkdir "$branch"
29+
git mv $(git ls-tree --name-only "$branch") "$branch"
30+
git commit -m "move $branch files into $branch"
31+
git checkout main
32+
}
33+
34+
35+
git init
36+
git commit --allow-empty -m "Initial commit"
37+
38+
for branch in "${(@k)repos}"; do
39+
echo "$branch" "${repos[$branch]}"
40+
pull_subrepo "$branch" "${repos[$branch]}"
41+
git tag -a "repo-$branch" "$branch" -m "Moving ${repos[$branch]} into monorepo as $branch/"
42+
done
43+
44+
for branch in "${(@k)repos}"; do
45+
git merge "$branch"
46+
done

0 commit comments

Comments
 (0)