Search in sources :

Example 1 with SvnInfo

use of org.tmatesoft.svn.core.wc2.SvnInfo 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();
}
Also used : SvnInfo(org.tmatesoft.svn.core.wc2.SvnInfo) SvnGetInfo(org.tmatesoft.svn.core.wc2.SvnGetInfo)

Example 2 with SvnInfo

use of org.tmatesoft.svn.core.wc2.SvnInfo 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);
    }
}
Also used : SvnInfo(org.tmatesoft.svn.core.wc2.SvnInfo) SVNException(org.tmatesoft.svn.core.SVNException) SvnGetInfo(org.tmatesoft.svn.core.wc2.SvnGetInfo)

Example 3 with SvnInfo

use of org.tmatesoft.svn.core.wc2.SvnInfo 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);
}
Also used : SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) SvnInfo(org.tmatesoft.svn.core.wc2.SvnInfo) SvnGetInfo(org.tmatesoft.svn.core.wc2.SvnGetInfo) File(java.io.File)

Example 4 with SvnInfo

use of org.tmatesoft.svn.core.wc2.SvnInfo in project intellij-community by JetBrains.

the class BranchInfo method checkPathGoingUp.

@NotNull
private SvnMergeInfoCache.MergeCheckResult checkPathGoingUp(final long revisionAsked, final long targetRevision, @NotNull String branchRootPath, @NotNull String path, final String trunkUrl, final boolean self) throws VcsException, SVNException {
    SvnMergeInfoCache.MergeCheckResult result;
    final File pathFile = new File(path);
    // check whether we locally have path
    if (targetRevision == -1 && !pathFile.exists()) {
        result = goUp(revisionAsked, targetRevision, branchRootPath, path, trunkUrl);
    } else {
        final Info svnInfo = myVcs.getInfo(pathFile);
        if (svnInfo == null || svnInfo.getURL() == null) {
            LOG.info("Svninfo for " + pathFile + " is null or not full.");
            result = SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
        } else {
            final long actualRevision = svnInfo.getRevision().getNumber();
            final long targetRevisionCorrected = (targetRevision == -1) ? actualRevision : targetRevision;
            // here we know local URL and revision
            // check existing info
            final String keyString = path + "@" + targetRevisionCorrected;
            final Set<Long> selfInfo = self ? myNonInheritablePathMergedMap.get(keyString) : null;
            final Set<Long> mergeInfo = myPathMergedMap.get(keyString);
            if (mergeInfo != null || selfInfo != null) {
                boolean merged = mergeInfo != null && mergeInfo.contains(revisionAsked) || selfInfo != null && selfInfo.contains(revisionAsked);
                // take from self or first parent with info; do not go further
                result = SvnMergeInfoCache.MergeCheckResult.getInstance(merged);
            } else {
                if (actualRevision != targetRevisionCorrected) {
                    myMixedRevisionsFound = true;
                }
                SvnTarget target;
                SVNRevision revision;
                if (actualRevision == targetRevisionCorrected) {
                    // look in WC
                    target = SvnTarget.fromFile(pathFile, SVNRevision.WORKING);
                    revision = SVNRevision.WORKING;
                } else {
                    // in repo
                    target = SvnTarget.fromURL(svnInfo.getURL());
                    revision = SVNRevision.create(targetRevisionCorrected);
                }
                PropertyValue mergeinfoProperty = myVcs.getFactory(target).createPropertyClient().getProperty(target, SvnPropertyKeys.MERGE_INFO, false, revision);
                result = mergeinfoProperty == null ? goUp(revisionAsked, targetRevisionCorrected, branchRootPath, path, trunkUrl) : processMergeinfoProperty(keyString, revisionAsked, mergeinfoProperty, trunkUrl, self);
            }
        }
    }
    return result;
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue) Info(org.jetbrains.idea.svn.info.Info) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with SvnInfo

use of org.tmatesoft.svn.core.wc2.SvnInfo in project omegat by omegat-org.

the class ConvertProject26to37team method getSVNUrl.

/**
 * Get repository URL for SVN.
 */
private static String getSVNUrl(File wc) throws Exception {
    final SvnOperationFactory of = new SvnOperationFactory();
    final SvnGetInfo infoOp = of.createGetInfo();
    infoOp.setSingleTarget(SvnTarget.fromFile(wc));
    infoOp.setDepth(SVNDepth.EMPTY);
    infoOp.setRevision(SVNRevision.WORKING);
    final SvnInfo info = infoOp.run();
    SVNURL svn = info.getUrl();
    return svn.toString();
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) SvnInfo(org.tmatesoft.svn.core.wc2.SvnInfo) SvnGetInfo(org.tmatesoft.svn.core.wc2.SvnGetInfo)

Aggregations

SvnGetInfo (org.tmatesoft.svn.core.wc2.SvnGetInfo)6 SvnInfo (org.tmatesoft.svn.core.wc2.SvnInfo)6 File (java.io.File)2 SVNException (org.tmatesoft.svn.core.SVNException)2 SvnOperationFactory (org.tmatesoft.svn.core.wc2.SvnOperationFactory)2 ConfigurationException (gmm.ConfigurationException)1 NotNull (org.jetbrains.annotations.NotNull)1 Info (org.jetbrains.idea.svn.info.Info)1 PropertyValue (org.jetbrains.idea.svn.properties.PropertyValue)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)1 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)1