Search in sources :

Example 1 with SVNRepository

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

the class SvnProtocolsTest method testBrowseRepositoryImpl.

private void testBrowseRepositoryImpl(final String url) throws SVNException {
    final List<SVNDirEntry> list = new ArrayList<>();
    final SVNRepository repository = myVcs.getSvnKitManager().createRepository(url);
    repository.getDir(".", -1, null, dirEntry -> list.add(dirEntry));
    Assert.assertTrue(!list.isEmpty());
}
Also used : SVNDirEntry(org.tmatesoft.svn.core.SVNDirEntry) ArrayList(java.util.ArrayList) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository)

Example 2 with SVNRepository

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

the class SvnNativeClientAuthTest method testBrowseRepositoryImpl.

private void testBrowseRepositoryImpl(final String url) throws SVNException {
    final List<SVNDirEntry> list = new ArrayList<>();
    final SVNRepository repository = myVcs.getSvnKitManager().createRepository(url);
    repository.getDir(".", -1, null, dirEntry -> list.add(dirEntry));
    Assert.assertTrue(!list.isEmpty());
}
Also used : SVNDirEntry(org.tmatesoft.svn.core.SVNDirEntry) ArrayList(java.util.ArrayList) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository)

Example 3 with SVNRepository

use of org.tmatesoft.svn.core.io.SVNRepository in project oxTrust by GluuFederation.

the class SubversionService method checkRootSvnPath.

private boolean checkRootSvnPath(SVNClientManager clientManager, SVNURL repositoryURL) throws SVNException {
    SVNRepository repository = SvnHelper.getSVNRepository(clientManager, repositoryURL);
    // Check if root path exist
    log.debug("Checking if root path exist");
    SVNNodeKind nodeKind = SvnHelper.exist(repository, "");
    if (nodeKind != SVNNodeKind.DIR) {
        log.error("Failed to commit files to repository. Please check SVN URL gluuAppliance.properties");
        return false;
    }
    return true;
}
Also used : SVNNodeKind(org.tmatesoft.svn.core.SVNNodeKind) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository)

Example 4 with SVNRepository

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

the class SVNList method list.

/********************************
	 * 작성일 : 2016. 5. 4. 작성자 : KYJ
	 *
	 * path에 속하는 구성정보 조회
	 *
	 * @param path
	 * @param revision
	 * @param exceptionHandler
	 * @return
	 ********************************/
public List<String> list(String path, String revision, Consumer<Exception> exceptionHandler) {
    List<String> resultList = Collections.emptyList();
    try {
        SVNProperties fileProperties = new SVNProperties();
        SVNRepository repository = getRepository();
        Collection<SVNDirEntry> dir = repository.getDir(path, Long.parseLong(revision), fileProperties, new ArrayList<>());
        resultList = dir.stream().map(d -> {
            SVNNodeKind kind = d.getKind();
            if (SVNNodeKind.DIR == kind) {
                return d.getRelativePath().concat("/");
            } else {
                return d.getRelativePath();
            }
        }).collect(Collectors.toList());
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
        if (exceptionHandler != null)
            exceptionHandler.accept(e);
    }
    return resultList;
}
Also used : SVNDirEntry(org.tmatesoft.svn.core.SVNDirEntry) SVNNodeKind(org.tmatesoft.svn.core.SVNNodeKind) SVNProperties(org.tmatesoft.svn.core.SVNProperties) SVNRepository(org.tmatesoft.svn.core.io.SVNRepository) SVNException(org.tmatesoft.svn.core.SVNException)

Example 5 with SVNRepository

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

the class SVNList method listEntry.

/********************************
	 * 작성일 : 2016. 5. 9. 작성자 : KYJ
	 *
	 * 메타정보를 포함하는 SVN 엔트리 반환
	 *
	 * 2016-11-03 버그 수정
	 *
	 * @param path
	 * @param revision
	 * @param exceptionHandler
	 * @return
	 ********************************/
public List<SVNDirEntry> listEntry(String path, String revision, boolean isRecursive, Consumer<Exception> exceptionHandler) {
    List<SVNDirEntry> resultList = new LinkedList<>();
    try {
        SVNRepository repository = getRepository();
        long parseLong = Long.parseLong(revision, 10);
        List<SVNDirEntry> list = new ArrayList<>();
        String _path = path;
        try {
            _path = URLDecoder.decode(_path, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        repository.getDir(_path, parseLong, true, list);
        if (isRecursive) {
            Iterator<SVNDirEntry> iterator = list.iterator();
            while (iterator.hasNext()) {
                SVNDirEntry entry = iterator.next();
                if (entry.getKind() == SVNNodeKind.DIR) {
                    SVNURL url = entry.getURL();
                    List<SVNDirEntry> listEntry = listEntry(url.getPath(), revision, isRecursive, exceptionHandler);
                    resultList.addAll(listEntry);
                } else {
                    resultList.add(entry);
                }
            }
        } else {
            resultList.addAll(list);
        }
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
        if (exceptionHandler != null)
            exceptionHandler.accept(e);
    }
    return resultList;
}
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) LinkedList(java.util.LinkedList) SVNException(org.tmatesoft.svn.core.SVNException)

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