From e7c77e70d1b710db3ecdd1f131a1f4b009832927 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 3 Jan 2017 18:33:19 +0000 Subject: Make sure the merge is done on the latest branch. Also, make the branch argument optional. Discussed with: swills Sponsored by: Absolight --- Tools/scripts/mfh | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'Tools/scripts/mfh') diff --git a/Tools/scripts/mfh b/Tools/scripts/mfh index a8b4cc323beb..6d393c19f02c 100755 --- a/Tools/scripts/mfh +++ b/Tools/scripts/mfh @@ -55,9 +55,31 @@ ask() { return 1 } -[ $# -lt 2 ] && err "$(basename $0) requires at least 2 arguments: [...]" +: ${svnserver:="svn+ssh://repo.FreeBSD.org"} + +if [ -n "$(type svn 2>/dev/null)" ]; then + svn=svn +elif [ -n "$(type svnlite 2>/dev/null)" ]; then + svn=svnlite +else + err "Neither svn(1) nor svnlite(1) found. Please install devel/subversion." +fi + +latest_branch=$("${svn}" ls ${svnserver}/ports/branches/|sed -ne '/^2.*Q./s|/$||p'|tail -1) + +[ $# -lt 1 ] && err "$(basename $0) requires at least 1 arguments: [] [...]" branch=$1 -shift + +# I sure hope by 2030 we'll be doing something else. Yes, famous last words. +if expr ${branch} : '20[12][0-9]Q[1-4]' > /dev/null; then + shift + if [ ${latest_branch} != ${branch} ]; then + ask "/!\\ The latest branch is ${latest_branch}, do you really want to commit to ${branch}?" || exit 1 + fi +else + branch=${latest_branch} +fi + revs="" for rev in $@ do @@ -67,15 +89,6 @@ do esac done -: ${svnserver:="svn+ssh://repo.FreeBSD.org"} - -if [ -n "$(type svn 2>/dev/null)" ]; then - svn=svn -elif [ -n "$(type svnlite 2>/dev/null)" ]; then - svn=svnlite -else - err "Neither svn(1) nor svnlite(1) found. Please install devel/subversion." -fi trap "rc=\$? ; rm -rf \"\${dir}\" ; exit \$rc" EXIT dir=$(mktemp -d /tmp/merge.XXXXXX) -- cgit