diff options
author | lme <lme@FreeBSD.org> | 2014-01-09 06:43:21 +0800 |
---|---|---|
committer | lme <lme@FreeBSD.org> | 2014-01-09 06:43:21 +0800 |
commit | 5192371e75eaf07e6aaffa90feda9731256288d8 (patch) | |
tree | 5878b1717363606a61f3cc95b0d9dae0d0205a73 /Tools | |
parent | d7cb345adcc258a2a25a186edefdde2f92f51f2a (diff) | |
download | freebsd-ports-gnome-5192371e75eaf07e6aaffa90feda9731256288d8.tar.gz freebsd-ports-gnome-5192371e75eaf07e6aaffa90feda9731256288d8.tar.zst freebsd-ports-gnome-5192371e75eaf07e6aaffa90feda9731256288d8.zip |
- Allow a leading "r" in the svn revision
- Use a variable for the Subversion server
- Consistently use ${} around variables
- Bail out if neither svn(1) nor svnlite(1) are installed
Approved by: bapt
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/mfh | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/Tools/scripts/mfh b/Tools/scripts/mfh index 7e3d5e9bf594..e3aa04abdc18 100755 --- a/Tools/scripts/mfh +++ b/Tools/scripts/mfh @@ -53,35 +53,47 @@ ask() { [ $# -ne 2 ] && err "Takes 2 arguments: <branch> <revnumber>" branch=$1 -rev=$2 -case $rev in +rev=${2##r} # remove a leading "r" +case ${rev} in ''|*[!0-9]*) err "revision should be a number" ;; esac +svnserver="svn.FreeBSD.org" + +if [ -n "$(type svn 2>/dev/null)" ]; then + svn=svn +elif [ -n "$(type svnlite 2>/dev/null)" ]; then + svn=svnlite +else + err "svn(1) and svnlite(1) not found. please install devel/subversion" +fi + + dir=$(mktemp -d /tmp/merge.XXX) -cd $dir -svn co --depth=empty svn+ssh://svn.FreeBSD.org/ports/branches/${branch} +cd ${dir} +${svn} co --depth=empty svn+ssh://${svnserver}/ports/branches/${branch} filelist="" -for f in $(svn diff --summarize -c $rev svn://svn.FreeBSD.org/ports/head); do +# svn:// is faster than svn+ssh://. Use it wherever it's possible. +for f in $(${svn} diff --summarize -c ${rev} svn://${svnserver}/ports/head); do case ${f} in */*) ;; *)continue;; esac f=${f#*/ports/head/} f=${f%/*} - filelist="$filelist\n$f" + filelist="${filelist}\n${f}" done -filelist=$(echo -e $filelist | sort -u) -echo "MFH: r$rev" > commit.txt -svn log -r$rev svn://svn.freebsd.org/ports/head | sed '1,2d;$d;/^MFH:/d' >> commit.txt +filelist=$(echo -e ${filelist} | sort -u) +echo "MFH: r${rev}" > commit.txt +${svn} log -r${rev} svn://${svnserver}/ports/head | sed '1,2d;$d;/^MFH:/d' >> commit.txt for f in ${filelist}; do - svn up --parents ${branch}/${f} + ${svn} up --parents ${branch}/${f} done -svn up --quiet ${branch} -svn merge -c r${rev} ^/head/ ${branch} -svn up --quiet ${branch} -svn diff ${branch} +${svn} up --quiet ${branch} +${svn} merge -c r${rev} ^/head/ ${branch} +${svn} up --quiet ${branch} +${svn} diff ${branch} ask "Do you want to commit?" || clean ${EDITOR:-vi} commit.txt -svn ci -F commit.txt ${branch} -rm -rf $dir +${svn} ci -F commit.txt ${branch} +rm -rf ${dir} |