You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by joncarl <jo...@fmfever.com> on 2008/05/26 15:31:32 UTC

Linux post commit script help

Hi

I need help writing a post commit script

(I will be using a 'repository per project' set up and we're a web
development company)

I want all developers to have personal working copies of a project on their
local machine and perform all checkin/checkouts etc on a the project's
repository located on a server. On top of this, I also want a working copy
located on the server that gets updated automatically (post commit) from the
project's repository.

Can anyone help me write the post script hook to do this? I'm using Fedora
9. 

Regards,
Jon
-- 
View this message in context: http://www.nabble.com/Linux-post-commit-script-help-tp17474092p17474092.html
Sent from the Subversion Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Linux post commit script help

Posted by John Peacock <jo...@havurah-software.org>.
joncarl wrote:
> I want all developers to have personal working copies of a project on their
> local machine and perform all checkin/checkouts etc on a the project's
> repository located on a server. On top of this, I also want a working copy
> located on the server that gets updated automatically (post commit) from the
> project's repository.

Checkout SVN::Notify::Mirror and SVN::Notify::Config -

	http://search.cpan.org/search?query=SVN::Notify::Mirror
	http://search.cpan.org/search?query=SVN::Notify::Config

which I wrote specifically to maintain websites in Subversion.  My working model 
was that trunk development is always mirrored to a test server and tags that 
match a pre-defined regex get automatically mirrored to a production server.  It 
means that the developers never have to personally login to either the test or 
production server to perform the updates (except e.g. to move the test server to 
a branch for speculative development).

HTH

John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Linux post commit script help

Posted by Jean-Claude Antonio <jc...@arcetis.com>.
Hi,
What you could do is to use in your post-commit script the svn update 
command (to the project on the server). You need to check it out first.

*Jean-Claude Antonio*
Responsable Méthodes/Outils

Arcetis




joncarl a écrit :
> Hi
>
> I need help writing a post commit script
>
> (I will be using a 'repository per project' set up and we're a web
> development company)
>
> I want all developers to have personal working copies of a project on their
> local machine and perform all checkin/checkouts etc on a the project's
> repository located on a server. On top of this, I also want a working copy
> located on the server that gets updated automatically (post commit) from the
> project's repository.
>
> Can anyone help me write the post script hook to do this? I'm using Fedora
> 9. 
>
> Regards,
> Jon
>   

Re: Linux post commit script help

Posted by Rudy Godoy Guillén <ru...@gmail.com>.
Hi,

2008/5/26 joncarl <jo...@fmfever.com>:

>
> Hi, Thanks for the replies.
>
> "Jon probably wants to _update_ a working copy as soon as a new commit
> enters"
>
> That's exactly what I want to do. Database migrations aren't an issue at
> this stage. I've just read the post-commit section of the book
> (http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.post-commit.html)
> but
> it doesn't go into any detail of how to construct such a script.
>

There is a hooks directory in the subversion distribution. Under Linux you
can find them at /usr/share/subversion/hook-scripts there are some on the
subversion website too.

regards

Re: Linux post commit script help

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 26, 2008, at 14:56, joncarl wrote:

>> Jon probably wants to _update_ a working copy as soon as a new commit
>> enters
>
>
> That's exactly what I want to do. Database migrations aren't an  
> issue at
> this stage. I've just read the post-commit section of the book
> (http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.post- 
> commit.html) but
> it doesn't go into any detail of how to construct such a script.


Off the top of my head, here's a bash post-commit hook script:



#!/bin/bash

REPOS="$1"
REV="$2"

SVN="/usr/local/bin/svn"
WC=/path/to/my/servers/working/copy"

$SVN update --non-interactive $WC



You would first need to check out a working copy to the path at $WC.

You would need to make sure that the user as whom this script is  
running (i.e. the user as whom the repository is served) has  
permission to write to that working copy. Also, that user's  
~/.subversion directory needs to have the appropriate credentials  
cached already (otherwise the $SVN update command will ask for a  
username and password, which the process running the hook script  
won't be able to provide).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Linux post commit script help

Posted by joncarl <jo...@fmfever.com>.
Hi, Thanks for the replies.

"Jon probably wants to _update_ a working copy as soon as a new commit
enters"

That's exactly what I want to do. Database migrations aren't an issue at
this stage. I've just read the post-commit section of the book
(http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.post-commit.html) but
it doesn't go into any detail of how to construct such a script.

Any pointers?

Regards,
Jon



paul r-2 wrote:
> 
> "Rudy Godoy Guillén" <ru...@gmail.com> writes:
> 
>> I'm afraid that what you need isn't a post-commit but a script which
>> syncs the webserver with the current
>> revision. Syncing in a postcommit might lead to issues and could be error
>> prone.
>> This will depende, of course, of your development setup.
>>
> 
> Still, Jon probably wants to _update_ a working copy as soon as a new
> commit enters, and post-commit hook is the way to go. But Rudy point
> is probably that you might want to do some more interventions
> (database migrations etc) before propagating changes to your running
> instance.
> You have to read to svnbook at redbean. It contains all you need for
> such a common hook.
> 
> -- 
>       Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Linux-post-commit-script-help-tp17474092p17478224.html
Sent from the Subversion Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Linux post commit script help

Posted by Paul R <pa...@gmail.com>.
"Rudy Godoy Guillén" <ru...@gmail.com> writes:

> I'm afraid that what you need isn't a post-commit but a script which syncs the webserver with the current
> revision. Syncing in a postcommit might lead to issues and could be error prone.
> This will depende, of course, of your development setup.
>

Still, Jon probably wants to _update_ a working copy as soon as a new
commit enters, and post-commit hook is the way to go. But Rudy point
is probably that you might want to do some more interventions
(database migrations etc) before propagating changes to your running
instance.
You have to read to svnbook at redbean. It contains all you need for
such a common hook.

-- 
      Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Linux post commit script help

Posted by Rudy Godoy Guillén <ru...@gmail.com>.
Hi,

2008/5/26 joncarl <jo...@fmfever.com>:

>
> Hi
>
> I need help writing a post commit script
>
> (I will be using a 'repository per project' set up and we're a web
> development company)
>
> I want all developers to have personal working copies of a project on their
> local machine and perform all checkin/checkouts etc on a the project's
> repository located on a server. On top of this, I also want a working copy
> located on the server that gets updated automatically (post commit) from
> the
> project's repository.
>


I'm afraid that what you need isn't a post-commit but a script which syncs
the webserver with the current revision. Syncing in a postcommit might lead
to issues and could be error prone.
This will depende, of course, of your development setup.

regards,
Rudy

Re: Linux post commit script help

Posted by Pat Farrell <pf...@pfarrell.com>.
joncarl wrote:
> I want all developers to have personal working copies of a project on their
> local machine and perform all checkin/checkouts etc on a the project's
> repository located on a server. On top of this, I also want a working copy
> located on the server that gets updated automatically (post commit) from the
> project's repository.

I went with a less coupled design. I had  a cron job that just did an 
'svn update' into a directory visible by normal Apache.

it will have a delay, but most of the time, this is acceptable. It makes 
it easy.


-- 
Pat Farrell
http://www.pfarrell.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org