SVN post commit:提交的用户是谁?

Bla*_*mir 13 svn post-commit-hook svn-hooks

在SVN post提交挂钩中,如何获取执行提交的用户?

Avi*_*Avi 23

使用svnlook命令author.例如,在shell脚本中,它可能是:

REPOS="$1"
REV="$2"

AUTHOR="$(svnlook author -r $REV $REPOS)"
Run Code Online (Sandbox Code Playgroud)


spl*_*ash 6

post-commit 钩子脚本示例:

#!/bin/sh
REPOS="$1"
REV="$2"
AUTHOR="$(svnlook author $REPOS -r $REV)"

# output on STDERR will be marshalled back to SVN client
echo "This transaction was commited by '$AUTHOR'!" 1>&2

exit 0
Run Code Online (Sandbox Code Playgroud)