我使用了一个示例java代码来获取文件的修订历史记录,但只获得了一个修订版。 存储库中有许多针对此文件的修订。那么如何立即获得该文件的所有修订版?
…
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 );
…
答案 0 :(得分:1)
使用0表示开始修订,使用-1表示结束修订
答案 1 :(得分:0)
使用这些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()获取所有修订版本直到日期。