Search in sources :

Example 21 with SvnTarget

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

the class SvnLogUtil method loadInterval.

public List<CommittedChangeList> loadInterval(final SVNRevision fromIncluding, final SVNRevision toIncluding, final int maxCount, final boolean includingYoungest, final boolean includeOldest) throws VcsException {
    final List<CommittedChangeList> result = new ArrayList<>();
    LogEntryConsumer handler = createLogHandler(fromIncluding, toIncluding, includingYoungest, includeOldest, result);
    SvnTarget target = SvnTarget.fromURL(myLocation.toSvnUrl());
    myVcs.getFactory(target).createHistoryClient().doLog(target, fromIncluding, toIncluding, true, true, false, maxCount, null, handler);
    return result;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) ArrayList(java.util.ArrayList)

Example 22 with SvnTarget

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

the class GatheringChangelistBuilder method mergeInfoChanged.

private boolean mergeInfoChanged(final File file) {
    SvnTarget target = SvnTarget.fromFile(file);
    try {
        PropertyValue current = myVcs.getFactory(target).createPropertyClient().getProperty(target, SvnPropertyKeys.MERGE_INFO, false, SVNRevision.WORKING);
        PropertyValue base = myVcs.getFactory(target).createPropertyClient().getProperty(target, SvnPropertyKeys.MERGE_INFO, false, SVNRevision.BASE);
        if (current != null) {
            return base == null || !Comparing.equal(current, base);
        }
    } catch (VcsException e) {
        LOG.info(e);
    }
    return false;
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) VcsException(com.intellij.openapi.vcs.VcsException) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue)

Example 23 with SvnTarget

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

the class BranchInfo method goUpInRepo.

@NotNull
private SvnMergeInfoCache.MergeCheckResult goUpInRepo(final long revisionAsked, final long targetRevision, final SVNURL branchUrl, final String trunkUrl) throws VcsException, SVNException {
    SvnMergeInfoCache.MergeCheckResult result;
    Set<Long> mergeInfo = myPathMergedMap.get(branchUrl.toString() + "@" + targetRevision);
    if (mergeInfo != null) {
        // take from self or first parent with info; do not go further
        result = SvnMergeInfoCache.MergeCheckResult.getInstance(mergeInfo.contains(revisionAsked));
    } else {
        SvnTarget target = SvnTarget.fromURL(branchUrl);
        PropertyValue mergeinfoProperty = myVcs.getFactory(target).createPropertyClient().getProperty(target, SvnPropertyKeys.MERGE_INFO, false, SVNRevision.create(targetRevision));
        if (mergeinfoProperty == null) {
            final String newTrunkUrl = SVNPathUtil.removeTail(trunkUrl).trim();
            final SVNURL newBranchUrl = branchUrl.removePathTail();
            final String absoluteTrunk = SVNPathUtil.append(myInfo.getRepoUrl(), newTrunkUrl);
            result = newTrunkUrl.length() <= 1 || newBranchUrl.toString().length() <= myInfo.getRepoUrl().length() || newBranchUrl.toString().equals(absoluteTrunk) ? SvnMergeInfoCache.MergeCheckResult.NOT_MERGED : goUpInRepo(revisionAsked, targetRevision, newBranchUrl, newTrunkUrl);
        } else {
            result = processMergeinfoProperty(branchUrl.toString() + "@" + targetRevision, revisionAsked, mergeinfoProperty, trunkUrl, false);
        }
    }
    return result;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget 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 25 with SvnTarget

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

the class PointMerger method merge.

private void merge(@NotNull SvnRepositoryContentRevision before, @NotNull SvnRepositoryContentRevision after) throws VcsException {
    MergeClient client = myVcs.getFactory(myTarget).createMergeClient();
    SvnTarget source1 = before.toTarget();
    SvnTarget source2 = after.toTarget();
    File localPath = getLocalPath(after.getFullPath());
    client.merge(source1, source2, localPath, Depth.FILES, true, mySvnConfig.isMergeDryRun(), false, false, mySvnConfig.getMergeOptions(), myHandler);
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) File(java.io.File)

Aggregations

SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)29 NotNull (org.jetbrains.annotations.NotNull)15 File (java.io.File)10 SVNURL (org.tmatesoft.svn.core.SVNURL)10 VcsException (com.intellij.openapi.vcs.VcsException)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 SvnVcs (org.jetbrains.idea.svn.SvnVcs)5 Logger (com.intellij.openapi.diagnostic.Logger)4 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)4 Pair (com.intellij.openapi.util.Pair)4 Ref (com.intellij.openapi.util.Ref)4 FilePath (com.intellij.openapi.vcs.FilePath)4 Nullable (org.jetbrains.annotations.Nullable)4 SVNException (org.tmatesoft.svn.core.SVNException)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 FileUtil (com.intellij.openapi.util.io.FileUtil)3 Registry (com.intellij.openapi.util.registry.Registry)3 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)3