You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Olivier Sannier <ob...@free.fr> on 2008/04/18 13:47:18 UTC

How to output warnings in pre-commit hook?

Hi all,

Is there a way to get warning messages sent to the user via a pre-commit 
hook?
I mean, I can get an error message if the pre-commit hook returns a non 
zero value, but what I would like to do is accept the commit while still 
displaying a warning message that the user will see in the result 
message from his commit.
This way I can inform of suspicious commits without preventing them as 
the detection of such items can not decide by itself to fail the commit.
I tried to write on STDERR and still return 0 in my pre-commit hook, but 
I could not get the output to show in the output of svn commit.

Thanks for your help

Cheers
Olivier

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

Re: How to output warnings in pre-commit hook?

Posted by Olivier Sannier <ob...@free.fr>.
Ryan Schmidt wrote:
>
> On Apr 18, 2008, at 8:47 AM, Olivier Sannier wrote:
>
>> Is there a way to get warning messages sent to the user via a 
>> pre-commit hook?
>> I mean, I can get an error message if the pre-commit hook returns a 
>> non zero value, but what I would like to do is accept the commit 
>> while still displaying a warning message that the user will see in 
>> the result message from his commit.
>
> No, that is not possible. You can only send a message to the client if 
> you also return a non-zero return value and thereby prevent the commit.
>
>> This way I can inform of suspicious commits without preventing them 
>> as the detection of such items can not decide by itself to fail the 
>> commit.
>> I tried to write on STDERR and still return 0 in my pre-commit hook, 
>> but I could not get the output to show in the output of svn commit.
>
>
> If you want to inform the user of something while also accepting the 
> commit, you have to do so through other means. For example, the 
> MacPorts project sends and email to the committer if any non-critical 
> problems were found with the commit.

Fair enough...
Is there a place where I can put this as a feature request?

Thanks
Olivier

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

Re: How to output warnings in pre-commit hook?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 18, 2008, at 8:47 AM, Olivier Sannier wrote:

> Is there a way to get warning messages sent to the user via a pre- 
> commit hook?
> I mean, I can get an error message if the pre-commit hook returns a  
> non zero value, but what I would like to do is accept the commit  
> while still displaying a warning message that the user will see in  
> the result message from his commit.

No, that is not possible. You can only send a message to the client  
if you also return a non-zero return value and thereby prevent the  
commit.

> This way I can inform of suspicious commits without preventing them  
> as the detection of such items can not decide by itself to fail the  
> commit.
> I tried to write on STDERR and still return 0 in my pre-commit  
> hook, but I could not get the output to show in the output of svn  
> commit.


If you want to inform the user of something while also accepting the  
commit, you have to do so through other means. For example, the  
MacPorts project sends and email to the committer if any non-critical  
problems were found with the commit.



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