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);
}
}
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());
}
}
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;
}
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;
}
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;
}
}
Aggregations