diff --git a/MAINTAINING.md b/MAINTAINING.md index 1bbebb949..574ccad03 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -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, diff --git a/merge-pr.sh b/merge-pr.sh index 5f4bfdd2d..6e5bb50bd 100755 --- a/merge-pr.sh +++ b/merge-pr.sh @@ -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 diff --git a/tools/lib/PR_bash.source b/tools/lib/PR_bash.source index 50663c806..4e1c24f72 100644 --- a/tools/lib/PR_bash.source +++ b/tools/lib/PR_bash.source @@ -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)" }