Search in sources :

Example 6 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project Gargoyle by callakrsos.

the class SVNList method listEntry.

/**
	 *  메타정보를 포함하는 리소스 탐색.
	 *  데이터를 바로 처리하기위한 handler 처리 .
	 * @작성자 : KYJ
	 * @작성일 : 2017. 1. 3.
	 * @param relativePath
	 * 			탐색할 상대경로
	 * @param handler
	 * @throws Exception
	 */
public void listEntry(String relativePath, ScmDirHandler<SVNDirEntry> handler) throws Exception {
    try {
        SVNRepository repository = getRepository();
        SVNURL location = repository.getLocation();
        List<SVNDirEntry> list = new ArrayList<>();
        /*
			 * @param  path                    a directory path
			 * @param  revision                a revision number
			 * @param  includeCommitMessages   if <span class="javakeyword">true</span> then
			 *                                 dir entries (<b>SVNDirEntry</b> objects) will be supplied
			 *                                 with commit log messages, otherwise not
			 * @param  entries                 a collection that receives fetched dir entries
			*/
        repository.getDir(relativePath, /* relativePath */
        -1, true, list);
        Iterator<SVNDirEntry> iterator = list.iterator();
        while (iterator.hasNext()) {
            SVNDirEntry entry = iterator.next();
            /*
				*  @param protocol       a protocol component
				 * @param userInfo       a user info component
				 * @param host           a host component
				 * @param port           a port number
				 * @param path           a path component
				 * @param uriEncoded     <span class="javakeyword">true</span> if
				*/
            /*
				 * 2016-12-14
				 * VisualSVN과의 호환성을 위해 상대경로를 만드는 URL로직을 추가한다.
				 * Root경로를 확인하려면
				 *
				 * SVNDirEntry클래스의 .getRepositoryRoot()를 확인해보면된다.
				 * by kyj.
				 */
            SVNURL url = SVNURL.create(location.getProtocol(), location.getUserInfo(), location.getHost(), location.getPort(), getJavaSVNManager().relativePath(entry.getURL()), true);
            if (entry.getKind() == SVNNodeKind.DIR) {
                if (handler.test(entry)) {
                    handler.accept(entry);
                    //만들어진 상대경로
                    listEntry(url.getPath(), handler);
                }
            } else {
                //만들어진 상대경로
                entry = new SVNDirEntry(url, entry.getRepositoryRoot(), entry.getName(), entry.getKind(), entry.getSize(), entry.hasProperties(), entry.getRevision(), entry.getDate(), entry.getAuthor(), entry.getCommitMessage());
                handler.accept(entry);
            }
        }
    //			if (parseLong != -1)
    //				resultList.addAll(list.stream().filter(v -> parseLong <= v.getRevision()).collect(Collectors.toList()));
    //			else
    //				resultList.addAll(list);
    //			return resultList;
    } catch (SVNException e) {
        throw e;
    }
}
Also used : SVNDirEntry(org.tmatesoft.svn.core.SVNDirEntry) SVNURL(org.tmatesoft.svn.core.SVNURL) ArrayList(java.util.ArrayList) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) SVNException(org.tmatesoft.svn.core.SVNException)

Example 7 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project Gargoyle by callakrsos.

the class SVNLog method getAllLogs.

public Collection<SVNLogEntry> getAllLogs(String relativePath, long startRevision, long endRevision) throws SVNException {
    SVNRepository repository = getRepository();
    @SuppressWarnings("unchecked") Collection<SVNLogEntry> logEntries = repository.log(new String[] { relativePath }, null, startRevision, endRevision, true, true);
    return logEntries;
}
Also used : SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository)

Example 8 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project intellij-community by JetBrains.

the class PrimitivePool method createRepository.

@Override
public SVNRepository createRepository(SVNURL url, boolean mayReuse) throws SVNException {
    final SVNRepository repos = SVNRepositoryFactory.create(url, this);
    repos.setAuthenticationManager(myManager);
    repos.setTunnelProvider(myTunnelProvider);
    repos.setDebugLog(new ProxySvnLog(SVNDebugLog.getDefaultLog()));
    repos.setCanceller(new SvnKitProgressCanceller());
    return repos;
}
Also used : SvnKitProgressCanceller(org.jetbrains.idea.svn.svnkit.SvnKitProgressCanceller) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository)

Example 9 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project intellij-community by JetBrains.

the class SvnKitManager method createRepository.

@NotNull
public SVNRepository createRepository(@NotNull SVNURL url) throws SVNException {
    SVNRepository repository = SVNRepositoryFactory.create(url);
    repository.setAuthenticationManager(getAuthenticationManager());
    repository.setTunnelProvider(getSvnOptions());
    return repository;
}
Also used : SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project sling by apache.

the class SvnChangeLogFinder method getChanges.

public List<String> getChanges(String first, String second) throws SVNException {
    SVNURL svnUrl = SVNURL.parseURIEncoded(SLING_SVN_REPO_BASE);
    List<String> changes = new ArrayList<>();
    SVNClientManager manager = SVNClientManager.newInstance();
    SVNRepository repo = manager.getRepositoryPool().createRepository(svnUrl, true);
    SVNRevision from = SVNRevision.create(getRevision(first, repo));
    SVNRevision to = SVNRevision.create(getRevision(second, repo));
    repo.log(new String[] { "tags/" + second }, from.getNumber(), to.getNumber(), false, false, (e) -> changes.add(e.getMessage()));
    return changes;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) ArrayList(java.util.ArrayList) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNClientManager(org.tmatesoft.svn.core.wc.SVNClientManager)

Aggregations

SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)12 ArrayList (java.util.ArrayList)5 SVNDirEntry (org.tmatesoft.svn.core.SVNDirEntry)5 SVNException (org.tmatesoft.svn.core.SVNException)4 SVNNodeKind (org.tmatesoft.svn.core.SVNNodeKind)4 SVNProperties (org.tmatesoft.svn.core.SVNProperties)3 SVNURL (org.tmatesoft.svn.core.SVNURL)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 RuntimeException (com.sun.star.uno.RuntimeException)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 NotNull (org.jetbrains.annotations.NotNull)1 SvnKitProgressCanceller (org.jetbrains.idea.svn.svnkit.SvnKitProgressCanceller)1 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)1 ISVNAuthenticationManager (org.tmatesoft.svn.core.auth.ISVNAuthenticationManager)1 SVNClientManager (org.tmatesoft.svn.core.wc.SVNClientManager)1 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)1