svn钩子提交判断

1 #!/bin/bash

2 REPOS="$1"

3 TXN="$2"

4 PHP=/usr/local/php/bin/php

5 SVNLOOK=/usr/bin/svnlook

6

7 CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | awk '{print $2}'`

8 for LINE in $CHANGED

9 do

10 FILE=`echo $LINE | egrep \\.php$`

11 if [ $? == 0 ]

12 then

13 MESSAGE=`$SVNLOOK cat -t "$TXN" "$REPOS" "${FILE}" | $PHP -l`

14 if [ $? -ne 0 ]

15 then

16 echo "${FILE}: $MESSAGE" | sed "s| -| $FILE|g" 1>&2

17 exit 1

18 fi

19 fi

20 done

21

22 #/usr/local/bin/scripts/phpcs-svn-pre-commit "$REPOS" -t "$TXN" 1>&2 || exit 1

23 exit 0

    A+
发布日期:2021年07月23日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: