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

chore(tools): allow merging PR to whatever branch is checked out

Useful for either dev testing or merging PRs to dev branches. Also stop
updating local repo state beyond merging the PR.
This commit is contained in:
Anthony Bilinski 2019-09-14 12:19:18 -07:00
parent e97b270584
commit fe9d83d881
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
3 changed files with 15 additions and 13 deletions

View File

@ -58,7 +58,9 @@ git config --global alias.logs 'log --show-signature'
merge-commit **must** be signed. To simplify the process, and ensure that
things are done "right", it's preferable to use the [`merge-pr.sh`] script,
which does that for you automatically.
- **use** [`merge-pr.sh`] script to merge PRs, e.g. `./merge-pr.sh 1234`.
- **use** [`merge-pr.sh`] script to merge PRs. First checkout the target
branch, usually either `master` or a release dev branch e.g. `v1.17-dev`,
make sure it's up to date with qTox/qTox, then e.g. `./merge-pr.sh 1234`.
You don't have to use it, but then you're running into risk of breaking
travis build of master & other PRs, since it verifies all commit messages,

View File

@ -52,6 +52,9 @@ source_functions() {
main() {
local remote_name="upstream"
local merge_branch="merge"
local base_branch # because assigning on the same line will break error code parsing.. http://www.tldp.org/LDP/abs/html/localvar.html
base_branch=$(git symbolic-ref HEAD --short)
source_functions
exit_if_not_pr $PR
add_remote

View File

@ -60,24 +60,24 @@ add_remote() {
after_merge_msg() {
echo ""
echo "PR #$PR was merged into «$@$PR» branch."
echo "To compare with master:"
echo "To compare with $base_branch:"
echo ""
echo " git diff master..$@$PR"
echo " git diff $base_branch..$@$PR"
echo ""
if [[ "$@" == "merge" ]]
then
echo "To push that to master on github:"
echo "To push that to $base_branch on github:"
echo ""
echo " git checkout master && git merge --ff $@$PR && git push upstream master"
echo " git checkout $base_branch && git merge --ff $@$PR && git push upstream $base_branch"
echo ""
echo "After pushing to master, delete branches:"
echo "After pushing to $base_branch, delete branches:"
echo ""
echo " git branch -d {$@,}$PR"
echo ""
fi
echo "To discard any changes:"
echo ""
echo " git checkout master && git branch -D {$@,}$PR"
echo " git checkout $base_branch && git branch -D {$@,}$PR"
echo ""
}
@ -88,7 +88,7 @@ after_merge_failure_msg() {
echo ""
echo "You may want to remove not merged branches, if they exist:"
echo ""
echo " git checkout master && git branch -D {$@,}$PR"
echo " git checkout $base_branch && git branch -D {$@,}$PR"
echo ""
}
@ -100,16 +100,13 @@ rm_obsolete_branch() {
get_sources() {
add_remote
rm_obsolete_branch
git fetch $remote_name && \
git checkout master && \
git rebase $remote_name/master master && \
git fetch $remote_name pull/$PR/head:$PR && \
git checkout master -b $merge_branch$PR
git checkout $base_branch -b $merge_branch$PR
}
# check whether to sign
merge() {
"${@}" --no-ff $PR -m "Merge pull request #$PR
$OPT_MSG
$(git shortlog master..$PR)"
$(git shortlog $base_branch..$PR)"
}