use of org.tmatesoft.svn.core.SVNDirEntry 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());
}
use of org.tmatesoft.svn.core.SVNDirEntry 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());
}
use of org.tmatesoft.svn.core.SVNDirEntry in project Gargoyle by callakrsos.
the class CommandTest3 method scenarioTest.
/**
*
* ################# 시나리오 테스트 ###################
*
* 1. svn 디렉토리 파일목록만 추출.
*
* 2. 추출된 파일목록에서 컨텐츠 조회
*
* @작성자 : KYJ
* @작성일 : 2016. 5. 13.
*/
@Test
public void scenarioTest() {
List<SVNDirEntry> list = testServerManager.listEntry("/sos/pass-batch-core");
Optional<String> findFirst = list.stream().filter(e -> {
SVNNodeKind kind = e.getKind();
if (SVNNodeKind.FILE == kind)
return true;
return false;
}).map(e -> {
try {
SVNURL url = e.getURL();
SVNURL repositoryRoot = e.getRepositoryRoot();
String relativeURL = SVNURLUtil.getRelativeURL(repositoryRoot, url, true);
return relativeURL;
} catch (Exception e1) {
e1.printStackTrace();
}
return "error";
}).peek(e -> {
System.out.println(testServerManager.cat(e));
}).findFirst();
// 첫번째 데이터를 찾은후...
findFirst.ifPresent(url -> {
try {
File outDir = new File("c://sampleDir");
outDir.mkdir();
System.out.println("checout dir ::: " + outDir.getAbsolutePath());
System.out.println("checout url ::: " + url);
Long checkout = testServerManager.checkout(url, outDir);
System.out.println("result ::: " + checkout);
} catch (Exception e1) {
e1.printStackTrace();
}
});
}
use of org.tmatesoft.svn.core.SVNDirEntry 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.SVNDirEntry 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;
}
Aggregations