本文整理汇总了Java中org.tmatesoft.svn.core.SVNProperties类的典型用法代码示例。如果您正苦于以下问题:Java SVNProperties类的具体用法?Java SVNProperties怎么用?Java SVNProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVNProperties类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importFiles
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的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: apply
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
@Override
public File apply(SVNFileItem t) {
String simpleFileName = t.getSimpleName();
File file = new File(outDir, simpleFileName);
File resultFile = null;
try (FileOutputStream out = new FileOutputStream(file, false)) {
LOGGER.debug("getCopy] SVN relativePath : {} out File Request : {} ", relativePath, file.getAbsolutePath());
long result = t.getManager().getCopy(relativePath, Long.parseLong(revision), new SVNProperties(), out);
if (result != -1)
resultFile = file;
} catch (Exception e1) {
if (exceptionHandler != null) {
exceptionHandler.handle(e1);
} else {
LOGGER.error(ValueUtil.toString(e1));
}
}
return resultFile;
}
示例3: getCopy
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的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: list
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
/********************************
* 작성일 : 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;
}
示例5: performSVNcommit
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @param aComment
* The SVN Comment which has been entered.
* @param aConfig
* CommanderConfig for SVN Connect.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNcommit(final String svnPathString,
final String aComment, final CommanderConfig aConfig) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File[] paths = new File[1];
// paths[0] = projectFile;
// boolean svnNew = false;
// svn add
SVNProperties props = new SVNProperties();
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
// if (svnNew) {
// SVNWCClient addClient = new SVNWCClient(authManager,
// SVNWCUtil.createDefaultOptions(true));
// addClient.doAdd(projectFile, true, false, true,
// SVNDepth.INFINITY, true, true);
// commander.notify("Projectfile successfully added.");
// }
// commit
SVNCommitClient commitClient = new SVNCommitClient(authManager,
SVNWCUtil.createDefaultOptions(true));
commitClient.doCommit(paths, false, aComment, props, null, false,
true, SVNDepth.INFINITY);
commander.info("Projectfile successfully commited.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例6: downloadFile
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
public long downloadFile(String svn_path, String local_path) throws SVNException, IOException {
SVNNodeKind nodeKind = repository.checkPath(svn_path, version);
if ( nodeKind == SVNNodeKind.FILE ) {
SVNProperties props = new SVNProperties();
FileOutputStream fOS = new FileOutputStream(new File(local_path));
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
long updated = repository.getFile(svn_path, version, props, fOS);
buffer.flush();
buffer.close();
try {
updated = Long.parseLong(props.getStringValue(COMMIT_VERSION));
} catch (NumberFormatException e) {
logger.warn("Could not transform committed revision " + props.getStringValue("svn:entry:committed-rev") + " to a long value");
}
return updated;
} else {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.BAD_FILENAME, "requested file " + svn_path + " is not a file"));
}
}
示例7: getTextFile
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
public String getTextFile(String name, long version, SVNProperties props, ByteArrayOutputStream buffer) throws SVNException {
if ( logger.isDebugEnabled() ) {
logger.debug("Try to retreive file " + repository.getLocation().toString() + "/" + name + " in version " + version);
}
SVNNodeKind nodeKind = repository.checkPath(name, version );
if ( nodeKind == SVNNodeKind.FILE ) {
if ( buffer == null ) {
buffer = new ByteArrayOutputStream();
} else {
buffer.reset();
}
long revision = repository.getFile( name , version , props , buffer );
if ( logger.isDebugEnabled() ) {
logger.debug("got " + name + " in revision " + revision);
}
return buffer.toString();
} else {
logger.error("URL \"" + svn_url + "/" + name + "\" does not point to a file or does not exist");
return null;
}
}
示例8: copy
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
public static SVNCommitInfo copy( SVNClientManager clientManager, SVNURL srcURL, SVNURL dstURL, boolean isMove,
String commitMessage, String revision )
throws SVNException
{
SVNRevision svnRevision = null;
if ( StringUtils.isEmpty( revision ) )
{
svnRevision = SVNRevision.HEAD;
}
else
{
svnRevision = SVNRevision.create( Long.parseLong( revision ) );
}
/*
* SVNRevision.HEAD means the latest revision.
* Returns SVNCommitInfo containing information on the new revision committed
* (revision number, etc.)
*/
SVNCopySource[] svnCopySources = new SVNCopySource[1];
svnCopySources[0] = new SVNCopySource( svnRevision, svnRevision, srcURL );
return clientManager.getCopyClient().doCopy( svnCopySources, dstURL, false, true, true, commitMessage,
new SVNProperties() );
//return clientManager.getCopyClient().doCopy( srcURL, svnRevision, dstURL, isMove, commitMessage, new SVNProperties() );
}
示例9: listRecords
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
@Override
@Nonnull
public List<Record> listRecords(@Nonnull String path) throws IOException {
List<Record> records = new ArrayList<>();
if (getRecord(path).exists()) {
SVNRepository repository = svnProvider.getRepository();
try {
repository.getDir(path, revision, new SVNProperties(), entry -> records.add(getRecord(entry, path)));
} catch (SVNException e) {
throw new IOException("failed to get file records: " + getFullPath(path), e);
} finally {
svnProvider.releaseRepository(repository);
}
}
return records;
}
示例10: readFile
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的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());
}
示例11: importFiles
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的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;
}
}
示例12: test
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
@Test
public void test() throws SVNException
{
// check existence
svnRepository.checkPath(TestFilePath, 4);
// checkout file: revision 4 should be empty
SVNProperties svnProperties = new SVNProperties();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
svnRepository.getFile(TestFilePath, 4, svnProperties, baos);
Assert.assertTrue(baos.size() == 0);
// revision 5 should contain lines Subversion.TestFileExpectedFirstLineRev5 and
// Subversion.TestFileExpectedSecondLineRev5
svnRepository.getFile(TestFilePath, 5, svnProperties, baos);
Assert.assertTrue(baos.size() != 0);
String contentRev5 = baos.toString();
Assert.assertTrue((TestFileExpectedFirstLineRev5 + "\n" + TestFileExpectedSecondLineRev5).equals(contentRev5));
// newest revision ends with "newest"
svnRepository.getFile(TestFilePath, -1, svnProperties, baos);
Assert.assertTrue(baos.size() != 0);
Assert.assertTrue(baos.toString().endsWith("newest"));
}
示例13: copy
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
public void copy(SVNURL targetURL, SVNURL[] paths) throws SVNException {
SVNCopySource[] convert = convert(paths);
/*
doCopy( SVNCopySource[] sources,
SVNURL dst,
boolean isMove,
boolean makeParents,
boolean failWhenDstExists,
java.lang.String commitMessage,
SVNProperties revisionProperties )
Copies each source in sources to dst.
*/
SVNCopyClient copyClient = getSvnManager().getCopyClient();
copyClient.doCopy(convert, targetURL, false, false, false, "copy by IDU", new SVNProperties());
}
示例14: savePassword
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
@Override
public boolean savePassword(String realm, String password, SVNAuthentication auth, SVNProperties authParameters) throws SVNException {
final boolean saved = myDelegate.savePassword(realm, password, auth, authParameters);
if (saved) {
myListener.getMulticaster().actualSaveWillBeTried(ProviderType.persistent, auth.getURL(), realm, auth.getKind()
);
}
return saved;
}
示例15: savePassphrase
import org.tmatesoft.svn.core.SVNProperties; //导入依赖的package包/类
@Override
public boolean savePassphrase(String realm, String passphrase, SVNAuthentication auth, SVNProperties authParameters, boolean force)
throws SVNException {
final boolean saved = myDelegate.savePassphrase(realm, passphrase, auth, authParameters, force);
if (saved) {
myListener.getMulticaster().actualSaveWillBeTried(ProviderType.persistent, auth.getURL(), realm, auth.getKind()
);
}
return saved;
}