javakit獲取SVN日志信息

johon 13年前發布 | 240 次閱讀 Rspamd 云計算 Chromebook 3D Evince

package com.svn;

import org.tmatesoft.svn.core.ISVNLogEntryHandler; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; import org.tmatesoft.svn.core.wc.SVNWCUtil; /**

  • @author pKF49035 / public class SVNFactory {

    public SVNFactory(){

     DAVRepositoryFactory.setup();
    
     SVNRepositoryFactoryImpl.setup();
    
     FSRepositoryFactory.setup();
    

    }

    public void registerCollecter(String url, String[] targetPaths, String userName, String password,

         long startRevision, long endRevision){
     SVNRepository repository = null;
     try
     {
         repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
         ISVNAuthenticationManager authManager = SVNWCUtil.
         createDefaultAuthenticationManager(userName, password);
         repository.setAuthenticationManager(authManager);
         ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {
             @Override
             public void handleLogEntry(SVNLogEntry logEntry)
                     throws SVNException {
                System.out.println(logEntry.getAuthor()+" "+logEntry.getRevision()+" "+logEntry.getDate()+" "+logEntry.getMessage()+" ");
             }
    
         };
         repository.log(targetPaths, startRevision, endRevision, true, true, handler);
     }
     catch (SVNException e)
     {
         System.err.println("Error while creating an SVNRepository for the location '"
                 + url + "': " + e.getMessage());
         return;
     }
    

    } } </pre>

 本文由用戶 johon 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!