1. 程式人生 > >svn通過hook開啟修改提交日誌許可權pre-revprop-change

svn通過hook開啟修改提交日誌許可權pre-revprop-change

首先在伺服器開啟更改log的設定:
找到版本庫的hooks目錄,
cp pre-revprop-change.tmpl pre-revprop-change
chmod a+x pre-revprop-change
svn自帶的hook已經寫好了,只要把它啟用就可以。

但是呢,自帶的pre-revprop-change是可以允許當前使用者修改任何人的日誌的,這顯然在實際工作中應該被禁止,應該是當前使用者只能修改自己的log才對。因此該指令碼要加上一段:

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if
[ "$USER" != $(/usr/bin/svnlook author -r "$2" "$1") ]; then echo "author error!" >$2 exit 1 elif [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0 fi echo "Changing revision properties other than svn:log is prohibited" >&2 exit 1

更改提交log的命令:
svn propset svn:log “xxxxxx” -r10** URL –revprop