|
Revision 4245, 1.2 kB
(checked in by bobbysmith007, 4 months ago)
|
Added a copy of my git-post-receive incase others are interested this interacts with the trac-post-commit hook
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
# |
|---|
| 3 |
# An example hook script for the post-receive event |
|---|
| 4 |
# |
|---|
| 5 |
# This script is run after receive-pack has accepted a pack and the |
|---|
| 6 |
# repository has been updated. It is passed arguments in through stdin |
|---|
| 7 |
# in the form |
|---|
| 8 |
# <oldrev> <newrev> <refname> |
|---|
| 9 |
# For example: |
|---|
| 10 |
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master |
|---|
| 11 |
# |
|---|
| 12 |
# see contrib/hooks/ for an sample, or uncomment the next line (on debian) |
|---|
| 13 |
# |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
TRAC_ENV="YOUR TRAC ENV HERE" |
|---|
| 17 |
LOG="/dev/null" |
|---|
| 18 |
echo "in git post commit: $TRAC_ENV" | cat >>$LOG |
|---|
| 19 |
|
|---|
| 20 |
while read oval nval ref ; do |
|---|
| 21 |
if expr "$oval" : '0*$' >/dev/null |
|---|
| 22 |
then |
|---|
| 23 |
git-rev-list "$nval" |
|---|
| 24 |
else |
|---|
| 25 |
git-rev-list "$nval" "^$oval" |
|---|
| 26 |
fi | while read com ; do |
|---|
| 27 |
echo "posting a comment to trac" | cat >>$LOG |
|---|
| 28 |
/usr/bin/python /usr/share/trac/contrib/trac-post-commit.py \ |
|---|
| 29 |
-p "$TRAC_ENV" \ |
|---|
| 30 |
-r "$com" \ |
|---|
| 31 |
-u "$(git-rev-list -n 1 $com --pretty=format:%an | sed '1d')" \ |
|---|
| 32 |
-m "$(git-rev-list -n 1 $com --pretty=medium | sed '1,3d;s:^ ::')" |
|---|
| 33 |
echo "DONE posting a comment to trac" | cat >>$LOG |
|---|
| 34 |
done |
|---|
| 35 |
done |
|---|
| 36 |
|
|---|
| 37 |
echo "Done with trac commit hook: $TRAC_ENV" | cat >>$LOG |
|---|
| 38 |
|
|---|
| 39 |
git reset --hard |
|---|
| 40 |
echo "resetting repo working copy" | cat >>$LOG |
|---|