You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jeroen Coumans <je...@jeroencoumans.nl> on 2004/05/26 16:07:22 UTC
post-commit question
Hi,
Our company sells customized Mambo code. We import data from the latest
stable release to /trunk/ and use /branches/client/ for our own
customizions. I'd like to use a post-commit hook which checks which
branch the commit is made (eg. /branches/client1/) and checks out that
branch to a specific directory.
Eg. if some commits to /branches/client1/, the post-commit script would
export /branches/client1/ to /www/client1/
Is this possible? Thanks for any answers.
--
Groeten/Greetings,
Jeroen Coumans
www.jeroencoumans.nl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: post-commit question
Posted by Ian Schneider <Ia...@ars.usda.gov>.
On Thursday 27 May 2004 11:36 am, Jeroen Coumans wrote:
> Ben Collins-Sussman said the following on 26-05-2004 20:53:
> > On Wed, 2004-05-26 at 11:07, Jeroen Coumans wrote:
> >>Eg. if some commits to /branches/client1/, the post-commit script would
> >>export /branches/client1/ to /www/client1/
> >
> > Of course it's possible. Have your post-commit script use 'svnlook' to
> > examine the commit that just happened, and act accordingly.
>
> Aha, ok, thanks! My scripting is not very good, but I hope I can manage
> this by myself. What would be the best way to test and debug the
> post-commit hook? I have setup a test repository to test it out, but it
> doesn't show me the output of the script. I have the following:
>
> #!/bin/sh
> set -x
>
> REPOS="$1"
> REV="$2"
> branch='svnlook changed /subversion/mambo/ | cut -d / -f 3'
>
> echo "REPOS = $REPOS"
> echo "REV = $REV"
> echo "branch = $branch"
>
> How do I view the output?
I also found this quite frustrating at times.
For one, unless the user that the script executes under (in my case , Fedora
Core uses apache) has a login shell (which sets path,etc.) then you will have
to use absolute paths, like /bin/echo or come up with a scheme for getting
paths (like sourcing a common file)
I do stuff like this:
<command> >> /tmp/hook_log 2 >&1
This will append output from your command to the /tmp/hook_log file
redirecting both stdout and stderr.
Note that if you want output to make it to subversion, i.e. Cannot commit
because you didn't do something/don't have permissions, it must be on stderr.
Here is a pre-commit check for committing to tags:
/usr/bin/svnlook changed -t $2 $1 | grep "^U\W*tags" && /bin/echo "CANNOT
COMMIT TO TAGS!!!" 1>&2 && exit 1
The
/bin/echo <message> 1>&2
does a redirect to stderr.
Hope this helps,
Ian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: post-commit question
Posted by Jeroen Coumans <je...@jeroencoumans.nl>.
Ben Collins-Sussman said the following on 26-05-2004 20:53:
> On Wed, 2004-05-26 at 11:07, Jeroen Coumans wrote:
>
>>Eg. if some commits to /branches/client1/, the post-commit script would
>>export /branches/client1/ to /www/client1/
>
>
> Of course it's possible. Have your post-commit script use 'svnlook' to
> examine the commit that just happened, and act accordingly.
Aha, ok, thanks! My scripting is not very good, but I hope I can manage
this by myself. What would be the best way to test and debug the
post-commit hook? I have setup a test repository to test it out, but it
doesn't show me the output of the script. I have the following:
#!/bin/sh
set -x
REPOS="$1"
REV="$2"
branch='svnlook changed /subversion/mambo/ | cut -d / -f 3'
echo "REPOS = $REPOS"
echo "REV = $REV"
echo "branch = $branch"
How do I view the output?
--
Groeten/Greetings,
Jeroen Coumans
www.jeroencoumans.nl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: post-commit question
Posted by Ben Collins-Sussman <su...@collab.net>.
On Wed, 2004-05-26 at 11:07, Jeroen Coumans wrote:
> Hi,
>
> Our company sells customized Mambo code. We import data from the latest
> stable release to /trunk/ and use /branches/client/ for our own
> customizions. I'd like to use a post-commit hook which checks which
> branch the commit is made (eg. /branches/client1/) and checks out that
> branch to a specific directory.
> Eg. if some commits to /branches/client1/, the post-commit script would
> export /branches/client1/ to /www/client1/
>
> Is this possible? Thanks for any answers.
Of course it's possible. Have your post-commit script use 'svnlook' to
examine the commit that just happened, and act accordingly.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org