3

これは奇妙なものです。お役に立てば幸いです。

SVNKitを使用してdoLog()をセットアップして呼び出しようとしています。セットアップは少し複雑で、いくつかのパラメーターがわかりません。エラーは(私が思うに)いくつかの「未知の」文字がSVN URLに挿入されることです。おそらく、セットアップが正しくないことが原因です。少しサニタイズされたコードは次のとおりです。

    // Auth manager
    String userName = "ksnortum";
    String password = "p@ssw0rd";
    ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( userName, password );

    // Options
    boolean readonly = true;
    ISVNOptions options = SVNWCUtil.createDefaultOptions( readonly );

    // Get log client
    SVNLogClient logClient = new SVNLogClient( authManager, options );

    // SVN URL parameters
    String protocol = "https";
    String userInfo = userName;
    String host = "svn.hostname.com";
    int port = 8443;
    String path = "";
    boolean uriEncoded = true;
    SVNURL url = null;

    // Create URL
    try {
        url = SVNURL.create( protocol, userInfo, host, port, path, uriEncoded );
    }
    catch ( SVNException e ) {
        System.out.println( "Can't create URL: " + e.toString() );
    }

    System.out.println( "URL: " + url.toString() ); // debug

    // Parameters for doLog()
    String[] paths = { "svn/Training/PDX_Cycle_2_2011" };
    SVNRevision pegRevision = SVNRevision.create( 0l );
    SVNRevision startRevision = SVNRevision.create( 0l );
    SVNRevision endRevision = SVNRevision.create( -1l );
    boolean stopOnCopy = false;
    boolean discoverChangedPaths = true;
    long limit = 9999l;

    // Log event handler
    ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {

        /**
         * This method will process when doLog() is done
         */
        @Override
        public void handleLogEntry( SVNLogEntry logEntry ) throws SVNException {
            System.out.println( "Author: " + logEntry.getAuthor() );
            System.out.println( "Date: " + logEntry.getDate() );
            System.out.println( "Message: " + logEntry.getMessage() );
            System.out.println( "Revision: " + logEntry.getRevision() );
        }
    };

    // Do log
    try {
        logClient.doLog( url, paths, pegRevision, startRevision, endRevision, stopOnCopy, discoverChangedPaths, limit, handler );
    }
    catch ( SVNException e ) {
        System.out.println( "Error in doLog() " );
        e.printStackTrace();
    }

デバッグとスタックトレースの情報は次のとおりです。

URL: https://ksnortum@svn.hostname.com:8443
org.tmatesoft.svn.core.SVNException: svn: '/svn/Training/!svn/bc/0/PDX_Cycle_2_2011' path not found: 404 Not Found (https://ksnortum@svn.hostname.com:8443)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.logImpl(DAVRepository.java:986)
at org.tmatesoft.svn.core.io.SVNRepository.log(SVNRepository.java:1034)
at org.tmatesoft.svn.core.wc.SVNLogClient.doLog(SVNLogClient.java:1028)
at org.tmatesoft.svn.core.wc.SVNLogClient.doLog(SVNLogClient.java:895)
at org.tmatesoft.svn.core.wc.SVNLogClient.doLog(SVNLogClient.java:827)
at org.tmatesoft.svn.examples.repository.LogEntry.start(LogEntry.java:93)
at org.tmatesoft.svn.examples.repository.LogEntry.main(LogEntry.java:27)
Error in doLog()

問題はsvn: '/svn/Training/!svn/bc/0/PDX_Cycle_2_2011' path not foundです。!svn/bc/0パス名になぜ含まれているのかわかりません。


編集:

リビジョンをもっとうまくやる必要があったようです。私はこの行を変更しました:

SVNRevision endRevision = SVNRevision.HEAD;

それは大いに役立ちました。また、doLog()パラメータからパスを取得しました。

String[] paths = { "" };

...そしてそれらをURLに入れます:

String path = "svn/Training/PDX_Cycle_2_2011";

改訂が最大の問題だったようです。コメントしてくれてありがとう。

4

1 に答える 1

2

要するに、これが!svn/bc/0正当な URL であり、リビジョン 0 を指していることを知っているということです。そのため、最後のリビジョンを -1 ではなく HEAD に変更すると機能しました。

于 2012-08-27T22:41:04.460 に答える