2
0
mirror of https://github.com/boostorg/website.git synced 2026-02-20 15:22:08 +00:00
Files
website/site-tools/git-prep-beta.sh
Daniel James 3bd3d4c7fc Improve unmerged changes list.
Display the changes first to last, and use two dots which gives better
results.
2014-07-13 11:38:35 +01:00

70 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -e
# Do a fast forward merge without checking out the destination branch.
git_ff_merge() {
from=$1
to=$2
if [[ $(git symbolic-ref --short -q HEAD) == $to ]]
then
git merge -q --ff-only $from
else
git fetch -q . $from:$to
fi
}
# Goto the root of the website
cd $(dirname $0)/..
# Check if tree is clean
if ! git diff-index --quiet HEAD --
then
echo "Tree is dirty."
exit 1
fi
echo "- Fetching from origin"
git fetch -q origin
echo "- Update local beta from origin"
if ! git_ff_merge origin/beta beta
then
echo "Unable to fast forward merge from origin/beta."
echo
echo "Changes on origin/beta:"
echo
git log --reverse --pretty=oneline beta..origin/beta
echo
echo "Changes on beta:"
echo
git log --reverse --pretty=oneline origin/beta..beta
exit 1
fi
echo "- Check for unmerged changes in beta"
if [ $(git rev-parse beta) != $(git merge-base origin/master beta) ]
then
echo "Unmerged changes on beta:"
echo
git log --reverse --pretty=oneline origin/master..beta
exit 1
fi
echo "- Update beta from origin/master"
#TODO: Should I also merge changes from local master?
git_ff_merge origin/master beta
git push origin beta
git checkout beta
echo "- Beta is now up to date."