Search in sources :

Example 36 with SVNException

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

the class SvnKitRevertClient method revert.

@Override
public void revert(@NotNull Collection<File> paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
    SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
    client.setEventHandler(toEventHandler(handler));
    try {
        client.doRevert(ArrayUtil.toObjectArray(paths, File.class), toDepth(depth), null);
    } catch (SVNException e) {
        throw new VcsException(e);
    }
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) SVNException(org.tmatesoft.svn.core.SVNException) File(java.io.File)

Example 37 with SVNException

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

the class LaunchpadComparer method outputFormatted.

private static void outputFormatted(Map.Entry<ArtifactKey, VersionChange> e) {
    ArtifactKey artifact = e.getKey();
    VersionChange versionChange = e.getValue();
    System.out.format("    %-30s : %-55s : %s -> %s%n", artifact.getGroupId(), artifact.getArtifactId(), versionChange.getFrom(), versionChange.getTo());
    if (!artifact.getGroupId().equals("org.apache.sling")) {
        return;
    }
    SvnChangeLogFinder svn = new SvnChangeLogFinder();
    String fromTag = artifact.getArtifactId() + "-" + versionChange.getFrom();
    String toTag = artifact.getArtifactId() + "-" + versionChange.getTo();
    try {
        List<String> issues = svn.getChanges(fromTag, toTag).stream().map(LaunchpadComparer::toJiraKey).filter(k -> k != null).collect(Collectors.toList());
        IssueFinder issueFinder = new IssueFinder();
        issueFinder.findIssues(issues).forEach(i -> System.out.format("        %-10s - %s%n", i.getKey(), i.getSummary()));
    } catch (SVNException | IOException e1) {
        System.err.println("Failed retrieving changes : " + e1.getMessage());
    }
}
Also used : IssueFinder(org.apache.sling.tooling.lc.jira.IssueFinder) AetherSetup(org.apache.sling.tooling.lc.aether.AetherSetup) ArtifactKey(org.apache.sling.tooling.lc.aether.ArtifactKey) BundleList(org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList) Function(java.util.function.Function) BundleListUtils(org.apache.sling.maven.projectsupport.BundleListUtils) Artifact(org.apache.sling.provisioning.model.Artifact) Matcher(java.util.regex.Matcher) Map(java.util.Map) StreamSupport(java.util.stream.StreamSupport) VersionChange(org.apache.sling.tooling.lc.aether.VersionChange) Files(java.nio.file.Files) SVNException(org.tmatesoft.svn.core.SVNException) Set(java.util.Set) IOException(java.io.IOException) Artifacts(org.apache.sling.tooling.lc.aether.Artifacts) Collectors(java.util.stream.Collectors) File(java.io.File) Sets(com.google.common.collect.Sets) Objects(java.util.Objects) List(java.util.List) ModelUtility(org.apache.sling.provisioning.model.ModelUtility) SvnChangeLogFinder(org.apache.sling.tooling.lc.svn.SvnChangeLogFinder) Model(org.apache.sling.provisioning.model.Model) BufferedReader(java.io.BufferedReader) Pattern(java.util.regex.Pattern) Bundle(org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle) ModelReader(org.apache.sling.provisioning.model.io.ModelReader) IssueFinder(org.apache.sling.tooling.lc.jira.IssueFinder) ArtifactKey(org.apache.sling.tooling.lc.aether.ArtifactKey) VersionChange(org.apache.sling.tooling.lc.aether.VersionChange) SvnChangeLogFinder(org.apache.sling.tooling.lc.svn.SvnChangeLogFinder) SVNException(org.tmatesoft.svn.core.SVNException) IOException(java.io.IOException)

Example 38 with SVNException

use of org.tmatesoft.svn.core.SVNException 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 39 with SVNException

use of org.tmatesoft.svn.core.SVNException 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)

Example 40 with SVNException

use of org.tmatesoft.svn.core.SVNException 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)

Aggregations

SVNException (org.tmatesoft.svn.core.SVNException)95 File (java.io.File)37 SVNURL (org.tmatesoft.svn.core.SVNURL)37 VcsException (com.intellij.openapi.vcs.VcsException)18 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)14 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)14 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)8 Collection (java.util.Collection)8 List (java.util.List)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 DefaultSVNOptions (org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions)7 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 Date (java.util.Date)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNCancelException (org.tmatesoft.svn.core.SVNCancelException)6 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)6 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5