This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f331ff6
commit 57d3d85
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# create tmp folder | ||
WORK_DIR=`mktemp -d` | ||
|
||
function cleanup { | ||
rm -rf "$WORK_DIR" | ||
echo "Deleted temp working directory $WORK_DIR" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
git clone [email protected]:grafana/pyroscope.git "${WORK_DIR}/og" | ||
git clone [email protected]:grafana/phlare.git "${WORK_DIR}/phlare" | ||
|
||
|
||
# rewrite phlare history to maintain correct links | ||
cd "$WORK_DIR/phlare" | ||
git filter-repo --message-callback ' | ||
import re | ||
return re.sub(b"#([0-9]+)", b"https://github.com/grafana/phlare/issues/\\1", message) | ||
' | ||
|
||
# move import path to new repo's | ||
git ls-files '*.go' go.mod go.sum | xargs sed -i 's#github.com/grafana/phlare#github.com/grafana/pyroscope#g' | ||
go mod tidy | ||
git add -A . | ||
git commit -m "Rename go import path" | ||
|
||
# move og into subfolder | ||
cd "$WORK_DIR/og" | ||
mkdir -p ../temp | ||
mv * ../temp | ||
mv .* ../temp | ||
mv ../temp/.git . | ||
mv ../temp og/ | ||
git add -A . | ||
git commit -m "Move og-pyroscope into subfolder" | ||
|
||
# now merge phlare in | ||
git remote add phlare "${WORK_DIR}/phlare" | ||
git fetch phlare | ||
git merge phlare/main --allow-unrelated-histories -m "The new Pyroscope" | ||
|
||
git push [email protected]:simonswine/pyroscope HEAD:merged -f |