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

Re: Post-commit hooks

From: John Peacock <john.peacock_at_havurah-software.org>
Date: 2007-09-25 15:46:31 CEST

Mike A. wrote:
> The problem is the Post-commit script works when I run it in command
> line but when using tortoisesvn, it doesn't seem to work. All files are
> of user apache already. The weird thing is some of my repository is
> working and some are not.. and I can't pinpoint where the problem really
> is.

Testing a post-commit script from the commandline requires running in as
close to the actual environment as possible. In particular, you pretty
much *must* execute the script as the "apache" user (whatever user that
happens to be, mine is wwwrun), ala

        $ sudo su -s /bin/bash apache

which will give you a shell even on accounts that normally don't have
one (and you shouldn't normally allow "service" accounts to login normally).

Once you are logged in as that user, you may even want to reduce your
environment (since Apache AFAIR doesn't provide $PATH for example).
Only then can you truly replicate how the post-commit will actually
operated during a commit.

One thing I have noticed is that if you allow any other process to write
to a WC that you are trying to update (I'm assuming that is what you are
doing), you can get into a situation where an update will be obstructed.
  For example, if some other process creates a new directory, and you
independently add that directory to the repository, the update will
block. This could definitely cause certain areas of your repository to
"work" and others "fail".

<advert>Depending on how complicated your post-commit needs are, you may
want to consider a framework like SVN::Notify (for commit e-mails) and
SVN::Notify::Mirror (for multiple ways to update web server WC's).
Using SVN::Notify::Config actually allows you to combine multiple
different operations (e-mails, syncs, snapshots) into a single data file
(which actually comprises the entire post-commit script itelf). Full
disclosure, I wrote SVN::Notify::Mirror and I now support
SVN::Notify::Config and SVN::Notify::Snapshot.</advert>

HTH

John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Sep 25 15:47:03 2007

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.