You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Zouari Fourat <fo...@gmail.com> on 2005/10/28 18:09:29 UTC

cannot get post-commit.tmpl to work

Hello,
I've a problem using the post commit hook, here's my post-commit.tmpl file :

#!/bin/sh
REPOS="$1"
REV="$2"
echo errr>>/tmp/log.test

it's too simple but it's not working :(
i do the commit and check my /tmp/log.test file and get nothing :(
can u hlp me please

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


Re: cannot get post-commit.tmpl to work

Posted by Frank Gruman <fg...@verizon.net>.
Zouari Fourat wrote:
> ohh thanks a lot i didnt see it
> am using this to do Revision number insertion in source code when committing :
> so here's my post-commit file :
>
> ---------------------------begin
> #!/bin/sh
> REPOS="$1"
> REV="$2"
> #echo errr>>/tmp/log.test
> /var/subversion/search-replace.sh .SVNREV. $REV "$REPOS/version"
> ---------------------------end
>
> here's my bash script search-replace.sh (it search for a string in a
> file and replace it by a given value)
>
> ---------------------------begin
> #!/bin/sh
>
> ARGS=3
> if [ $# -ne "$ARGS" ]
> then
>    echo "Usage: `basename $0` <search-word> <replace-word> <file>"
>    exit $E_BADARGS
> fi
>
> mv $3 $3.old.svn
> sed "s/$1/$2/g" $3.old.svn > $3
> rm -f $3.old.svn
> ---------------------------end
>
> it doesnt work, it seems as the system does not call that script
> (search-replace.sh) , even if i insert an 'echo something' on top of
> the script it doesnt echo anything.
>
> it does not work even with this post-commit file :
> ---------------------------begin
> #!/bin/sh
> mv  "$REPOS/version" "$REPOS/version.old.svn"
> sed "s/.SVNREV./$REV/g" "$REPOS/version.old.svn">"$REPOS/version"
> rm -f "$REPOS/version.old.svn"
> ---------------------------end
>
> what's the matter with this ?
> thank you for help
>
> On 10/28/05, Frank Gruman <fg...@verizon.net> wrote:
>   
>> Zouari Fourat wrote:
>>     
>>> Hello,
>>> I've a problem using the post commit hook, here's my post-commit.tmpl file :
>>>
>>> #!/bin/sh
>>> REPOS="$1"
>>> REV="$2"
>>> echo errr>>/tmp/log.test
>>>
>>> it's too simple but it's not working :(
>>> i do the commit and check my /tmp/log.test file and get nothing :(
>>> can u hlp me please
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>>> For additional commands, e-mail: users-help@subversion.tigris.org
>>>
>>>
>>>
>>>       
>> how about copying the post-commit.tmpl to post-commit??
>>
>> those files are there as a template (guide) to use if and when you want
>> them.  To actually use them, you have to copy and drop the .tmpl extension.
>>
>> regards,
>> Frank
>>
>>     
Well - I'm not the right person to ask about shell scripts.  Perhaps you 
could state your goal with the script and maybe someone else could help 
out??

Regards,
Frank

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

Re: cannot get post-commit.tmpl to work

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Oct 28, 2005, at 20:44, Zouari Fourat wrote:

> am using this to do Revision number insertion in source code when  
> committing :

Nope. Definitely not. You cannot change a transaction in a hook. It's  
not designed for that. All you can do in a post-commit hook is notify  
by email that the commit has happened, or update a working copy, or  
something like that. By the time the post-commit hook has been  
called, the commit has already completely taken place. The pre-commit  
hook is also not the place to look to do this.

What you want to do is to stop writing hook scripts and read this FAQ:

http://subversion.tigris.org/faq.html#version-value-in-source


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

Re: cannot get post-commit.tmpl to work

Posted by Re...@DSTInnovis.com.
Zouari wrote:
>>>>>>>
it doesnt work, it seems as the system does not call that script
(search-replace.sh) , even if i insert an 'echo something' on top of
the script it doesnt echo anything.
am using this to do Revision number insertion in source code when 
committing :
so here's my post-commit file :

---------------------------begin
#!/bin/sh
REPOS="$1"
REV="$2"
#echo errr>>/tmp/log.test
/var/subversion/search-replace.sh .SVNREV. $REV "$REPOS/version"
---------------------------end

here's my bash script search-replace.sh (it search for a string in a
file and replace it by a given value)

---------------------------begin
#!/bin/sh

ARGS=3
if [ $# -ne "$ARGS" ]
then
   echo "Usage: `basename $0` <search-word> <replace-word> <file>"
   exit $E_BADARGS
fi

mv $3 $3.old.svn
sed "s/$1/$2/g" $3.old.svn > $3
rm -f $3.old.svn
---------------------------end

it does not work even with this post-commit file :
---------------------------begin
#!/bin/sh
mv  "$REPOS/version" "$REPOS/version.old.svn"
sed "s/.SVNREV./$REV/g" "$REPOS/version.old.svn">"$REPOS/version"
rm -f "$REPOS/version.old.svn"
---------------------------end
<<<<<<<<<<<<< end of Zouari wrote

Zouari,  first, did you successfully get the post commit hook script to 
execute?
Assuming so, perhaps you need to fully qualify all commands, since I 
believe that no PATH is sent to script.
One more thing, you could send an output of your call to your script to a 
log, catching stderr and stdout.
OK, third thing, will your search/replace work after the first 
substitution?  It seems like you're 
doing a token search/replace on .SVNREV. but then it looks to me like the 
next time it will not be there--
it will already be replaced by the actual SVN rev number?  (perhaps not 
all the script typed)




-----------------------------------------
The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged. The information is
intended to be conveyed only to the designated recipient(s) of the message.
If the reader of this message is not the intended recipient, you are hereby
notified that any dissemination, use, distribution or copying of this
communication is strictly prohibited and may be unlawful. If you have
received this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.

Re: cannot get post-commit.tmpl to work

Posted by Zouari Fourat <fo...@gmail.com>.
ohh thanks a lot i didnt see it
am using this to do Revision number insertion in source code when committing :
so here's my post-commit file :

---------------------------begin
#!/bin/sh
REPOS="$1"
REV="$2"
#echo errr>>/tmp/log.test
/var/subversion/search-replace.sh .SVNREV. $REV "$REPOS/version"
---------------------------end

here's my bash script search-replace.sh (it search for a string in a
file and replace it by a given value)

---------------------------begin
#!/bin/sh

ARGS=3
if [ $# -ne "$ARGS" ]
then
   echo "Usage: `basename $0` <search-word> <replace-word> <file>"
   exit $E_BADARGS
fi

mv $3 $3.old.svn
sed "s/$1/$2/g" $3.old.svn > $3
rm -f $3.old.svn
---------------------------end

it doesnt work, it seems as the system does not call that script
(search-replace.sh) , even if i insert an 'echo something' on top of
the script it doesnt echo anything.

it does not work even with this post-commit file :
---------------------------begin
#!/bin/sh
mv  "$REPOS/version" "$REPOS/version.old.svn"
sed "s/.SVNREV./$REV/g" "$REPOS/version.old.svn">"$REPOS/version"
rm -f "$REPOS/version.old.svn"
---------------------------end

what's the matter with this ?
thank you for help

On 10/28/05, Frank Gruman <fg...@verizon.net> wrote:
> Zouari Fourat wrote:
> > Hello,
> > I've a problem using the post commit hook, here's my post-commit.tmpl file :
> >
> > #!/bin/sh
> > REPOS="$1"
> > REV="$2"
> > echo errr>>/tmp/log.test
> >
> > it's too simple but it's not working :(
> > i do the commit and check my /tmp/log.test file and get nothing :(
> > can u hlp me please
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> > For additional commands, e-mail: users-help@subversion.tigris.org
> >
> >
> >
> how about copying the post-commit.tmpl to post-commit??
>
> those files are there as a template (guide) to use if and when you want
> them.  To actually use them, you have to copy and drop the .tmpl extension.
>
> regards,
> Frank
>

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


Re: cannot get post-commit.tmpl to work

Posted by Frank Gruman <fg...@verizon.net>.
Zouari Fourat wrote:
> Hello,
> I've a problem using the post commit hook, here's my post-commit.tmpl file :
>
> #!/bin/sh
> REPOS="$1"
> REV="$2"
> echo errr>>/tmp/log.test
>
> it's too simple but it's not working :(
> i do the commit and check my /tmp/log.test file and get nothing :(
> can u hlp me please
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>   
how about copying the post-commit.tmpl to post-commit??

those files are there as a template (guide) to use if and when you want 
them.  To actually use them, you have to copy and drop the .tmpl extension.

regards,
Frank

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