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

RE: svn update in post-commit hook

From: Gale, David <David.Gale_at_Hypertherm.com>
Date: 2005-11-08 20:58:21 CET

Rob Brandt wrote:
> I was hoping to avoid programming anything more than shell or perl. I
> don't do
> C. THanks for clearing up the protocol issue, I'll stick with http.
> I had noted the 3rd slash - it's actually the start of the path.
>
> Rob
>
> Quoting "Gale, David" <David.Gale@Hypertherm.com>:
>
>> Rob Brandt wrote:
>>> svn --newbie
>>>
>>> I have svn up and running on my debian server, using tortoise-svn
>>> on XP workstations.
>>>
>>> I would like to set up something that would "publish" HEAD to a web
>>> root directory on each commit. This is a development server, not
>>> "live". I've been reading the docs and it seems like it should be
>>> straightforward, but I just starting looking at the command line
>>> arguments and I can't think through how this is going to work.
>>> Specifically, permissions. My projects need to be password
>>> protected, and the "published" files need to have the right
>>> user/group permissions on the server.
>>
>> Have you checked the FAQ?
>> http://subversion.tigris.org/faq.html#website-auto-update
>>
>> Use that as a starting point. Changing permissions, if need be,
>> should be a straightforward modification of the code.

The code in the FAQ is simply a way to get around the UNIX limitation on
setting the sticky bit. If you're accessing the repository through
apache (which you are, given the http:// protocol), and your web root
directory is actually a working copy owned by apache, you shouldn't have
to worry about this--just have the post-commit hook update the working
copy directly. You only need to set the sticky bit if you need
different permissions than you usually have.

And, if you really do need to use a sticky-bit binary, you can basically
treat the given code as a slightly munged shell script:

#include <stdlib.h>
int main(int argc, const char *argv[])
{
  system("/usr/local/bin/svn update /home/joe/public_html/");
  system("/usr/bin/chown -R someone:else /home/joe/public_html/");
  system("/usr/bin/echo 'Hello, World!'");
}

etc. Compiling is simple, since the code is simple--you don't need to
worry about libraries, etc. Just put whatever you want into a system()
call.

-David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Nov 8 21:10:00 2005

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.