use of org.tmatesoft.svn.core.wc2.SvnGetInfo in project GMM by Katharsas.
the class SVNTest method latestRevision.
/**
* Find out at which revision number the repo is at.
* Can also be used on single files to find out in which revision the last changed occured to them.
*/
public void latestRevision() throws SVNException {
final SvnGetInfo operation = svnOperationFactory.createGetInfo();
operation.setSingleTarget(workingCopy);
final SvnInfo info = operation.run();
final long revision = info.getRevision();
}
use of org.tmatesoft.svn.core.wc2.SvnGetInfo in project GMM by Katharsas.
the class SvnPlugin method checkRepoAvailable.
/**
* @return Root URL of the SVN repo as opposed to the checked out URL.
*/
private SVNURL checkRepoAvailable() {
final SvnGetInfo operation = svnOperationFactory.createGetInfo();
operation.setSingleTarget(repository);
try {
final SvnInfo info = operation.run();
logger.info("Successfully reached SVN repository at uri '" + repository.getPathOrUrlDecodedString() + "'.");
return info.getRepositoryRootUrl();
} catch (final SVNException e) {
logger.error("Could not reach SVN repository at uri '" + repository.getPathOrUrlDecodedString() + "'!", e);
throw new UncheckedSVNExeption(e);
}
}
use of org.tmatesoft.svn.core.wc2.SvnGetInfo in project omegat by omegat-org.
the class ConvertProject26to37team method getSVNTmxVersion.
/**
* Get version of "omegat/project_save.tmx" in SVN.
*/
private static String getSVNTmxVersion(File wc) throws Exception {
final SvnOperationFactory of = new SvnOperationFactory();
final SvnGetInfo infoOp = of.createGetInfo();
infoOp.setSingleTarget(SvnTarget.fromFile(new File(wc, "omegat/project_save.tmx")));
infoOp.setDepth(SVNDepth.EMPTY);
SvnInfo info = infoOp.run();
long r = info.getRevision();
return Long.toString(r);
}
use of org.tmatesoft.svn.core.wc2.SvnGetInfo in project GMM by Katharsas.
the class SvnPlugin method initializeWorkingCopy.
/**
* @return Current revision of local working copy.
*/
private void initializeWorkingCopy(File workingCopyFile) {
final String workingCopyString = workingCopyFile.toString();
if (workingCopyFile.exists()) {
if (workingCopyFile.isDirectory()) {
final SvnGetInfo operation = svnOperationFactory.createGetInfo();
operation.setSingleTarget(workingCopy);
SvnInfo info = null;
try {
info = operation.run();
} catch (final SVNException e) {
}
if (info != null) {
logger.info("Located existing working copy at path '" + workingCopyString + "'.");
verifyExistingWorkingCopy();
} else {
logger.warn("Could not locate working copy at path '" + workingCopyString + "'! Creating new one.");
if (workingCopyFile.list().length > 0) {
throw new ConfigurationException("Cannot create new working copy because directory is not empty! Path: '" + workingCopyString + "'");
}
createNewWorkingCopy();
}
} else {
throw new ConfigurationException("Path to working copy is not a directory! Path:'" + workingCopyString + "'");
}
} else {
logger.warn("Could not locate SVN working copy at path '" + workingCopyString + "'! Creating new one.");
fileService.createDirectory(workingCopyFile.toPath());
createNewWorkingCopy();
}
}
use of org.tmatesoft.svn.core.wc2.SvnGetInfo in project GMM by Katharsas.
the class SvnPlugin method retrieveRevision.
/**
* @return Current revision of remote repository or working copy.
*/
private long retrieveRevision(SvnTarget target) {
final SvnGetInfo operation = svnOperationFactory.createGetInfo();
operation.setSingleTarget(target);
final SvnInfo info = tryRun(operation);
return info.getRevision();
}
Aggregations