In an SVN post commit hook, how can I get the user who executed the commit?
Asked
Active
Viewed 5,351 times
3 Answers
23
Using the svnlook
command with author
. For example, in a shell script, it might be:
REPOS="$1"
REV="$2"
AUTHOR="$(svnlook author -r $REV $REPOS)"

Matthias Braun
- 32,039
- 22
- 142
- 171

Avi
- 19,934
- 4
- 57
- 70
6
post-commit
hook script example:
#!/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

splash
- 13,037
- 1
- 44
- 67
0
The second parameter to your post-commit script will be the revision number - you can use this to query SVN for whatever information you need.

Jim Brissom
- 31,821
- 4
- 39
- 33