[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Problem with python + hook

From: David Weintraub <qazwart_at_gmail.com>
Date: Sun, 24 Aug 2008 22:08:41 -0400

A couple of hints:

Hooks only print out information if:

1). The information is sent to STDERR and not STDOUT
2). If the hook itself fails (that is the exit code is not zero)

If you want to see if your hook is working, cause it to fail with an
exit code of "2" and print to STDERR. I'm not a Python person, but it
would be something like this:

import sys
print >> sys.stderr, "this is a test"
call( "svn", "update", "--non-interactive", "/srv/http/website" )
exit 2

--
David Weintraub
qazwart_at_gmail.com
On Sun, Aug 24, 2008 at 5:33 PM, Robert Dailey <rcdailey_at_gmail.com> wrote:
> I'm trying to create a post-commit hook using python, but it isn't
> working. I can't tell where it is failing, either, as I"m not sure if
> any logging is taking place somewhere. Can someone tell me if there
> are any error logs somewhere I can look at? Also, is there anything
> obviously wrong with my script? Thanks. The filename is "post-commit",
> by the way.
>
> #!/usr/bin/python
>
> #REPOS="$1"
> #REV="$2"
>
> #commit-email.pl "$REPOS" "$REV" commit-watchers_at_example.org
> #log-commit.py --repository "$REPOS" --revision "$REV"
>
> #svn update --non-interactive /srv/http/website
> #chown -R :svn_group /srv/http
> #chmod -R 774 /srv/http/website
>
> import sys
> from subprocess import call
>
> REPOS = sys.argv[1]
> REV = sys.argv[2]
>
> print "This is a test"
>
> call( "svn", "update", "--non-interactive", "/srv/http/website" )
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-25 04:09:05 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.