1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #3037

Zetok Zalbavar (1):
      chore(merge-script): add a way to add optional merge message
This commit is contained in:
sudden6 2016-03-23 11:45:15 +01:00
commit 990a50f1ca
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -21,34 +21,57 @@
# Requires SSH key that github accepts and GPG set to sign merge commits. # Requires SSH key that github accepts and GPG set to sign merge commits.
# usage: # usage:
# ./$script $pr_number # ./$script $pr_number $optional_message
#
#
# $pr_number number of the PR as shown on GH
# $optional_message message that is going to be put in merge commit,
# before the appended shortlog.
#
PR=$1 PR=$1
# make sure to add newlines to the message, otherwise merge message
# will not look well
if [[ ! -z $2 ]]
then
OPT_MSG="
$2
"
fi
# FIXME: ↓ # FIXME: ↓
#[[ ${PR} =~ "^[:digit:]+$" ]] || echo "Not a PR number!" && exit 1 #[[ ${PR} =~ "^[:digit:]+$" ]] || echo "Not a PR number!" && exit 1
# list remotes, and if there's no tux3 one, add it # list remotes, and if there's no tux3 one, add it
if ! git remote | grep original if ! git remote | grep original > /dev/null
then then
git remote add original git@github.com:tux3/qTox.git git remote add original git@github.com:tux3/qTox.git
fi fi
# print the message only if the merge was successful
after_merge_msg() {
echo ""
echo "PR #$PR was merged into «merge$PR» branch."
echo "To compare with master:"
echo "git diff master..merge$PR"
echo ""
echo "To push that to master on github:"
echo "git checkout master && git merge --ff merge$PR && git push original master"
echo ""
echo "After pushing to master, delete branches:"
echo ""
echo "git branch -d {merge,}$PR"
}
git fetch original && \ git fetch original && \
git checkout master && \ git checkout master && \
git rebase original/master master && \ git rebase original/master master && \
git fetch original pull/$PR/head:$PR && \ git fetch original pull/$PR/head:$PR && \
git checkout master -b merge$PR && \ git checkout master -b merge$PR && \
git merge --no-ff -S $PR -m "Merge pull request #$PR git merge --no-ff -S $PR -m "Merge pull request #$PR
$OPT_MSG
$(git shortlog master..$PR)" && \ $(git shortlog master..$PR)" && \
echo "" after_merge_msg
echo "PR #$PR was merged into «merge$PR» branch."
echo "To compare with master:"
echo "git diff master..merge$PR"
echo ""
echo "To push that to master on github:"
echo "git checkout master && git merge --ff merge$PR && git push original master"
echo ""
echo "After pushing to master, delete branches:"
echo "git branch -d {merge,}$PR"