Subversion: Difference between revisions

No edit summary
 
Line 15: Line 15:
* '''All commits to a given repopath PATH, with details'''
* '''All commits to a given repopath PATH, with details'''
** <code>svn log -d --xml | xml sel -t -c "//logentry[paths/path='PATH']"
** <code>svn log -d --xml | xml sel -t -c "//logentry[paths/path='PATH']"
==Hooks==
==Hook Examples==
===Pre-commit===
===Pre-commit===
<pre>#!/bin/sh
<pre>#!/bin/sh
Line 28: Line 28:


[[Category:Source Control]]
[[Category:Source Control]]
===Post-commit===
<pre>#!/bin/bash
set -e
set -o nounset
set -o pipefail
umask 0002
export REPOS="$1"
export REV="$2"
LASTREV="$(($REV - 1))"
REPONAME="`basename $REPOS`"
MSG="`svn log --xml -r$REV file://$REPOS | xmlstarlet sel -t -v //msg`"
TITLE="`echo $MSG | cut -b-56`"
AUTHOR="`svn log --xml -r$REV file://$REPOS | xmlstarlet sel -t -v //author`"
AUTHORMAIL="`finger -m -p $AUTHOR | head -n1 | cut -d: -f3- | cut -b2-` <$AUTHOR@providence.research.sys>"
( echo -e "From: $AUTHORMAIL" && \
echo "Subject: [$REPONAME-$REV] $TITLE" && \
echo -e "\n" && echo "`echo $MSG | fmt -w72 - `" && echo && \
svn diff file://$REPOS@$LASTREV file://$REPOS@$REV && \
echo -e "\n-- \ngenerated by $0 on $HOSTNAME\nreport bugs to nblack@securecomputing.com" \
) | snmail -s -c "$REPONAME" sys.research.subversion.</pre>