-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
3 changed files
with
97 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,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
source $(realpath $(dirname $0))/utils.sh | ||
|
||
BEEPER_REMOTE=$(get_beeper_remote) | ||
|
||
VERSION=${1:-} | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo >&2 "Must specify version!" | ||
exit 1 | ||
fi | ||
|
||
echo "Completing Synapse: Beeper Edition version $VERSION" | ||
echo "WARNING: this script will DELETE the branch called: beeper" | ||
read -p "Press enter to continue" | ||
|
||
UPSTREAM_BRANCH=upstream-$VERSION | ||
BEEPER_BRANCH=beeper-$VERSION | ||
|
||
git checkout $BEEPER_BRANCH | ||
git branch -D beeper | ||
git checkout -b beeper | ||
git push --force $BEEPER_REMOTE beeper | ||
|
||
# Cleanup | ||
git branch -D $BEEPER_BRANCH | ||
git push $BEEPER_REMOTE --delete $BEEPER_BRANCH | ||
git branch -D $UPSTREAM_BRANCH | ||
git push $BEEPER_REMOTE --delete $UPSTREAM_BRANCH |
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,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
source $(realpath $(dirname $0))/utils.sh | ||
|
||
BEEPER_REMOTE=$(get_beeper_remote) | ||
|
||
VERSION=${1:-} | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo >&2 "Must specify version!" | ||
exit 1 | ||
fi | ||
|
||
STARTING_BRANCH=$(git branch --show-current) | ||
|
||
echo "Preparing Synapse: Beeper Edition version $VERSION" | ||
echo "WARNING: this script will rebase on top of the CURRENT BRANCH: $STARTING_BRANCH" | ||
read -p "Press enter to continue" | ||
|
||
TAG=v$VERSION | ||
UPSTREAM_BRANCH=upstream-$VERSION | ||
BEEPER_BRANCH=beeper-$VERSION | ||
|
||
# Checkout the tag, create upstream branch, push it | ||
echo "Setup branch $UPSTREAM_BRANCH" | ||
git checkout -f $TAG | ||
git checkout -b $UPSTREAM_BRANCH | ||
git push -u $BEEPER_REMOTE $UPSTREAM_BRANCH | ||
|
||
# Switch back to our starting branch, create new version branch from it | ||
echo "Setup branch $BEEPER_BRANCH" | ||
git checkout $STARTING_BRANCH | ||
git checkout -b $BEEPER_BRANCH | ||
|
||
# And rebase against upstream, applying only our Beeper commits | ||
echo "Initiate rebase..." | ||
git rebase $UPSTREAM_BRANCH || read -p "Rebase was a mess, press enter once you fix it" | ||
|
||
git push -u $BEEPER_REMOTE $BEEPER_BRANCH | ||
|
||
echo "OK we done!" | ||
echo "Go HERE and make the PR: https://github.com/beeper/synapse/compare/upstream-$VERSION...beeper-$VERSION?expand=1" |
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,23 @@ | ||
function get_upstream_remote() { | ||
for remote in $(git remote); do | ||
url=$(git remote get-url $remote) | ||
if [ "$url" = "[email protected]:element-hq/synapse.git" ]; then | ||
echo $remote | ||
return 0 | ||
fi | ||
done | ||
echo >&2 "No upstream remote found (looking for URL: [email protected]:element-hq/synapse.git)" | ||
return 1 | ||
} | ||
|
||
function get_beeper_remote() { | ||
for remote in $(git remote); do | ||
url=$(git remote get-url $remote) | ||
if [ "$url" = "[email protected]:beeper/synapse.git" ]; then | ||
echo $remote | ||
return 0 | ||
fi | ||
done | ||
echo >&2 "No upstream remote found (looking for URL: [email protected]:beeper/synapse.git)" | ||
return 1 | ||
} |