3

サンプルの Java コードを使用してファイルのリビジョン履歴を取得しましたが、取得したリビジョンは 1 つだけです。このファイルのリポジトリには多くのリビジョンがあります。では、このファイルのすべてのリビジョンを一度に取得するにはどうすればよいでしょうか?

…
long startRevision = -1;
long endRevision = 0; //HEAD (i.e. the latest) revision

SVNRepositoryFactoryImpl.setup();
repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded(url) );
ISVNAuthenticationManager authManager = 
         SVNWCUtil.createDefaultAuthenticationManager( name, password );
repository.setAuthenticationManager( authManager );

Collection logEntries = null;
logEntries = repository.log( new String[] { "EJB.java" }, null, startRevision,
                             endRevision, true, true );
…
4

2 に答える 2

1

開始リビジョンには0を使用し、終了リビジョンには-1を使用します

于 2011-09-18T16:17:39.960 に答える
1

ログを取得し、それらの logEntries を使用してリビジョンを取得します

SVNRepository repository = null;
            repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
            ISVNAuthenticationManager authManager =
                               SVNWCUtil.createDefaultAuthenticationManager("", "");
            repository.setAuthenticationManager(authManager);
            SvnOperationFactory operationFactory = new SvnOperationFactory();
            SvnLog logOperation = operationFactory.createLog();
            logOperation.setSingleTarget(
                    SvnTarget.fromURL(
                            SVNURL.parseURIEncoded(url)));
            logOperation.setRevisionRanges( Collections.singleton(
                    SvnRevisionRange.create(
                            SVNRevision.create( 1 ),
                            SVNRevision.HEAD
                    )
            ) );
            Collection<SVNLogEntry> logEntries = logOperation.run( null );

ここで、logEntries を反復処理し、logEntry.getRevision() を使用して日付までのすべてのリビジョンを取得します。

于 2017-08-17T11:52:48.980 に答える