On Wed, 17 Aug 2011 19:56:13 +0200, Martin Kutter
<martin.kut...@fen-net.de> wrote:
> Hi,
> 
> Am Dienstag, den 16.08.2011, 11:14 -0400 schrieb Mark Phippard:
>> On Tue, Aug 16, 2011 at 11:09 AM, Martin Kutter
>> <martin.kut...@fen-net.de>wrote:
>> > is there a way to receive get post-commit error messages on
performing
>> > a
>> > commit with the JavaHL bindings?
>> 
>> Subclipse uses JavaHL and I believe it shows these messages.  Have you
>> registered a call back to receive the Notifications?
>> 
>>
http://subversion.apache.org/docs/javahl/1.6/org/tigris/subversion/javahl/Notify2.html
>> 

Subclipse does not show post-commit error messages (at least not ).

It also looks like JavaHL (1.6.17) does not transmit post-commit error
messages not even in notify callbacks.

Is this a bug?

Steps to reproduce:

1. Create svn repo with failing post-commit hook and output on stderr
2. Test with svn command line client, checkout, perform some change,
commit.
Expected output is like this:
D:\Martin\workspace\test>svn commit -m 'test'
Adding         site

Committed revision 19.

Warning: post-commit hook failed (exit code 1) with output:
"Ausgabe auf STDERR"

3. make some change to the wc, and run the JUnit test below (with paths
changed to match your system)

Test fails, output is 

1.6.17 (r1128011)
Acttion: 17
ChangelistName: null
ContentState: 1
ErrMsg: null
Kind: 2
LockState: 1
MimeType: null
Path: D:/Martin/workspace/test/site
PathPrefix: D:/Martin/workspace
PropState: 1
Revision: -1
Lock: null
MergeRange: null
Source: D:/Martin/workspace/test/site
Commited revision: 18

Here's the test code:

package org.tigris.subversion.javahl;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

public class SVNClientTest {

        private List<NotifyInformation> notifications = new
ArrayList<NotifyInformation>();
        
        @Test
        public void testCommit() {
                SVNClientInterface client = new SVNClient();
                System.out.println(client.getVersion());
                Notify2 notify = new Notify2() {
                        
                        @Override
                        public void onNotify(NotifyInformation info) {
                                System.out.println("Acttion: " + 
info.getAction());
                                System.out.println("ChangelistName: " + 
info.getChangelistName());
                                System.out.println("ContentState: " + 
info.getContentState());
                                System.out.println("ErrMsg: " + 
info.getErrMsg());
                                System.out.println("Kind: " + info.getKind());
                                System.out.println("LockState: " + 
info.getLockState());
                                System.out.println("MimeType: " + 
info.getMimeType());
                                System.out.println("Path: " + info.getPath());
                                System.out.println("PathPrefix: " + 
info.getPathPrefix());
                                System.out.println("PropState: " + 
info.getPropState());
                                System.out.println("Revision: " + 
info.getRevision());
                                System.out.println("Lock: " + info.getLock());
                                System.out.println("MergeRange: " + 
info.getMergeRange());
                                System.out.println("Source: " + 
info.getSource());
                
                                notifications.add(info);
                        }
                };
                
                client.notification2(notify);
                
                String[] paths = new String[] { "D:/Martin/workspace/test" };
                String[] changeLists = new String[] {};
                try {
                        long result = client.commit(paths, "test", 
Depth.infinity, false,
false, null, null);
                        if (result > 0) {
                                System.out.println("Commited revision: " + 
result);
                        }
                } catch (ClientException e) {
                        e.printStackTrace();
                }
                                
                List<String> errors = new ArrayList<String>();
                for (NotifyInformation info : notifications) {
                        if (info.getErrMsg() != null)
                                errors.add(info.getErrMsg());
                }
                assertNotSame(0, errors.size());
        }
}


Martin

Reply via email to