本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.getFile方法的具体用法?Java SVNRepository.getFile怎么用?Java SVNRepository.getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tmatesoft.svn.core.io.SVNRepository
的用法示例。
在下文中一共展示了SVNRepository.getFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importFiles
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public File importFiles(String path, File temp) {
SVNRepository svnRepository = getSVNRepository(repositoryURL, username, password);
try {
OutputStream o = new FileOutputStream(temp);
svnRepository.getFile(path, SVNRevision.HEAD.getNumber(), new SVNProperties(), o);
o.flush();
o.close();
return temp;
} catch (Exception e) {
console.printerrln(e);
return null;
}
}
示例2: retrieve
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Retrieves this version of the metadata
*
* @return the metadata document as it was in this version
* @throws MCRUsageException
* if this is a deleted version, which can not be retrieved
*/
public MCRContent retrieve() throws IOException {
if (type == DELETED) {
String msg = "You can not retrieve a deleted version, retrieve a previous version instead";
throw new MCRUsageException(msg);
}
try {
SVNRepository repository = vm.getStore().getRepository();
MCRByteArrayOutputStream baos = new MCRByteArrayOutputStream();
repository.getFile(vm.getStore().getSlotPath(vm.getID()), revision, null, baos);
baos.close();
return new MCRByteContent(baos.getBuffer(), 0, baos.size(), getDate().getTime());
} catch (SVNException e) {
throw new IOException(e);
}
}
示例3: getCopy
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public long getCopy(String relativePath, long revision, SVNProperties properties, OutputStream contents) throws SVNException {
// URL 검증
if (relativePath.isEmpty() || relativePath.endsWith("/"))
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.BAD_URL, "Invalide relativePath : " + relativePath));
SVNRepository repository = getRepository();
LOGGER.debug("getCopy : {} ", relativePath);
SVNNodeKind checkPath = repository.checkPath(relativePath, revision);
long result = -1;
if (checkPath == SVNNodeKind.FILE) {
// return the revision the file has been taken at
result = repository.getFile(relativePath, revision, properties, contents);
int lastIndexOf = ValueUtil.lastIndexOf(relativePath, '/');
String fileName = relativePath.substring(lastIndexOf) + 1;
LOGGER.debug(fileName);
}
return result;
}
示例4: readFile
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
@Nonnull
public InputStream readFile(@Nonnull String path) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
SVNRepository repository = svnProvider.getRepository();
try {
long useRevision = revision;
if (findLast && repository.checkPath(path, revision) == SVNNodeKind.NONE) {
useRevision = getLastRevision(repository, path);
}
repository.getFile(path, useRevision, new SVNProperties(), out);
} catch (SVNException e) {
throw new IOException("failed to read file: " + getFullPath(path), e);
} finally {
svnProvider.releaseRepository(repository);
}
return new ByteArrayInputStream(out.toByteArray());
}
示例5: importFiles
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public File importFiles(String path, File temp) {
SVNRepository svnRepository = getSVNRepository(repositoryURL, username, password);
try {
OutputStream o = new FileOutputStream(temp);
svnRepository.getFile(path, Long.parseLong(getCurrentRevision()), new SVNProperties(), o);
o.flush();
o.close();
return temp;
} catch (Exception e) {
console.printerrln(e);
return null;
}
}
示例6: run
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public void run() {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null) {
progress.setText(SvnBundle.message("progress.text.loading.contents", myPath));
progress.setText2(SvnBundle.message("progress.text2.revision.information", myRevision));
}
try {
SVNRepository repository = myVcs.createRepository(getFullPath());
try {
repository.getFile("", myRevision, null, myDst);
}
finally {
repository.closeSession();
}
}
catch (SVNException e) {
myException = e;
}
}
示例7: modifyFile
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@NotNull
public static SVNCommitInfo modifyFile(@NotNull SVNRepository repo, @NotNull String filePath, @NotNull byte[] newData, long fileRev) throws SVNException, IOException {
final ByteArrayOutputStream oldData = new ByteArrayOutputStream();
repo.getFile(filePath, fileRev, null, oldData);
final ISVNEditor editor = repo.getCommitEditor("Modify file: " + filePath, null, false, null);
editor.openRoot(-1);
int index = 0;
int depth = 1;
while (true) {
index = filePath.indexOf('/', index + 1);
if (index < 0) {
break;
}
editor.openDir(filePath.substring(0, index), -1);
depth++;
}
editor.openFile(filePath, fileRev);
sendDeltaAndClose(editor, filePath, oldData.toByteArray(), newData);
for (int i = 0; i < depth; ++i) {
editor.closeDir();
}
return editor.closeEdit();
}
示例8: update
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Updates the version stored in the local filesystem to the latest version
* from Subversion repository HEAD.
*/
public void update() throws Exception {
SVNRepository repository = getStore().getRepository();
MCRByteArrayOutputStream baos = new MCRByteArrayOutputStream();
long rev = repository.getFile(getFilePath(), -1, null, baos);
revision = () -> Optional.of(rev);
baos.close();
new MCRByteContent(baos.getBuffer(), 0, baos.size(), this.getLastModified().getTime()).sendTo(fo);
}
示例9: checkFileProp
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static void checkFileProp(@NotNull SVNRepository repo, @NotNull String filePath, @Nullable Map<String, String> expected) throws SVNException {
SVNProperties props = new SVNProperties();
repo.getFile(filePath, repo.getLatestRevision(), props, null);
checkProp(props, expected);
}
示例10: checkFileContent
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static void checkFileContent(@NotNull SVNRepository repo, @NotNull String filePath, @NotNull String content) throws IOException, SVNException {
try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
repo.getFile(filePath, repo.getLatestRevision(), null, stream);
Assert.assertEquals(new String(stream.toByteArray(), StandardCharsets.UTF_8), content);
}
}