You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Manuel Ferrero <mf...@reer.it> on 2013/01/24 13:46:17 UTC

Problem on a post-commit hook to change the current author (windows batch)

In this discussion a user suggested how to change the commit author 
using a post-commit hook: http://goo.gl/7dJ4l
I'd like to do exacly that, so I wrote a pre-revprop-change hook that 
checks that allows the change under certain circumstances.
I tested and it's working.
My problem is that I can't make the post-commit hoow to work.
My SVN server is CollabNet's SubversionEdge on a Windows 7 machine, so 
my hooks are written in MS-DOS batch language.
My post-commit hook is here: http://pastebin.com/MpjCYAsE
In it I first send an email to a bunch of people and then I want to 
extract the current author, change it to a new one and then write the 
svn:author property.
When I make a commit on TortoiseSVN from my computer I get the window 
telling me that the information are sent, but it never exits: 
http://img14.imageshack.us/img14/4922/commitloop.png

The commit is done, but the author isn't changed.
It seems top me that the batch file hangs when try to lookup the current 
user:
for /f "delims=" %%a in ('svn propget svn:author --revprop -r %REV% 
http://my_server_address') do @set myAuthor=%%a

What I'm doing wrong?

Reer SpA	
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.


Re: Problem on a post-commit hook to change the current author (windows batch)

Posted by Manuel Ferrero <mf...@reer.it>.
Branko Čibej ha scritto:

> You are running the svn command-line client from your post-commit hook.
> If 'svn propget' requires authorization, your hook script will hang
> waiting for input.

That's it.


> Since the hook script will always have access to the repository, it
> would be better to use "svnlook propget --revprop" and "svnadmin
> setrevprop" -- incidentally, the latter does not need any special
> pre-revprop-change hook in order to work.

I'll dig into it, thanks.
-- 
Kind regards,
Manuel Ferrero
R&D department
+39 0112482215

Reer SpA	
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.


Re: Problem on a post-commit hook to change the current author (windows batch)

Posted by Branko Čibej <br...@wandisco.com>.
On 24.01.2013 14:38, Manuel Ferrero wrote:
> Thorsten Schöning wrote:
>
>>> The commit is done, but the author isn't changed.
>>> It seems top me that the batch file hangs when try to lookup the
>>> current
>>> user:
>>> for /f "delims=" %%a in ('svn propget svn:author --revprop -r %REV%
>>> http://my_server_address') do @set myAuthor=%%a
>>
>> May it be that the client is just waiting for a password? You don't
>> seem to provide auth credentials.
>
> Which client?
> I use TortoiseSVN to commit changes on the server.
> I suppose that the server gets the commit, do the commit and then
> execute the post-commit hook.
> Who and where needs to authorize?
> And how can I authorize?

You are running the svn command-line client from your post-commit hook.
If 'svn propget' requires authorization, your hook script will hang
waiting for input.

Since the hook script will always have access to the repository, it
would be better to use "svnlook propget --revprop" and "svnadmin
setrevprop" -- incidentally, the latter does not need any special
pre-revprop-change hook in order to work.

-- Brane

-- 
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com


Re: Problem on a post-commit hook to change the current author (windows batch)

Posted by Manuel Ferrero <mf...@reer.it>.
Thorsten Schöning wrote:

>> The commit is done, but the author isn't changed.
>> It seems top me that the batch file hangs when try to lookup the current
>> user:
>> for /f "delims=" %%a in ('svn propget svn:author --revprop -r %REV%
>> http://my_server_address') do @set myAuthor=%%a
>
> May it be that the client is just waiting for a password? You don't
> seem to provide auth credentials.

Which client?
I use TortoiseSVN to commit changes on the server.
I suppose that the server gets the commit, do the commit and then 
execute the post-commit hook.
Who and where needs to authorize?
And how can I authorize?
-- 
Kind regards,
Manuel Ferrero
R&D department
+39 0112482215

Reer SpA	
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.


Re: Problem on a post-commit hook to change the current author (windows batch)

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Manuel Ferrero,
am Donnerstag, 24. Januar 2013 um 14:03 schrieben Sie:

> The commit is done, but the author isn't changed.
> It seems top me that the batch file hangs when try to lookup the current
> user:
> for /f "delims=" %%a in ('svn propget svn:author --revprop -r %REV% 
> http://my_server_address') do @set myAuthor=%%a

May it be that the client is just waiting for a password? You don't
seem to provide auth credentials.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Problem on a post-commit hook to change the current author (windows batch)

Posted by Manuel Ferrero <mf...@reer.it>.
In this discussion a user suggested how to change the commit author
using a post-commit hook: http://goo.gl/7dJ4l
I'd like to do exacly that, so I wrote a pre-revprop-change hook that
checks that allows the change under certain circumstances.
I tested and it's working.
My problem is that I can't make the post-commit hoow to work.
My SVN server is CollabNet's SubversionEdge on a Windows 7 machine, so
my hooks are written in MS-DOS batch language.
My post-commit hook is here: http://pastebin.com/MpjCYAsE
In it I first send an email to a bunch of people and then I want to
extract the current author, change it to a new one and then write the 
svn:author property.
When I make a commit on TortoiseSVN from my computer I get the window 
telling me that the information are sent, but it never exits:
http://img14.imageshack.us/img14/4922/commitloop.png

The commit is done, but the author isn't changed.
It seems top me that the batch file hangs when try to lookup the current 
user:
for /f "delims=" %%a in ('svn propget svn:author --revprop -r %REV% 
http://my_server_address') do @set myAuthor=%%a

What I'm doing wrong?

Reer SpA	
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.