Search in sources :

Example 26 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class PortableStatus method getRepositoryRootURL.

@Override
public SVNURL getRepositoryRootURL() {
    SVNURL url = super.getRepositoryRootURL();
    if (url == null) {
        Info info = initInfo();
        url = info != null ? info.getRepositoryRootURL() : url;
    }
    return url;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) Info(org.jetbrains.idea.svn.info.Info)

Example 27 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class PortableStatus method getCopyFromURL.

/**
   * Gets the URL (repository location) of the ancestor from which the item
   * was copied. That is when the item is added with history.
   *
   * @return the item ancestor's URL
   */
@Override
public String getCopyFromURL() {
    if (!isCopied())
        return null;
    final Info info = initInfo();
    if (info == null)
        return null;
    SVNURL url = initInfo().getCopyFromURL();
    return url == null ? null : url.toString();
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) Info(org.jetbrains.idea.svn.info.Info)

Example 28 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class CmdPropertyClient method resolveRevisionNumber.

private SVNRevision resolveRevisionNumber(@NotNull File path, @Nullable SVNRevision revision) throws VcsException {
    long result = revision != null ? revision.getNumber() : -1;
    // base should be resolved manually - could not set revision to BASE to get revision property
    if (SVNRevision.BASE.equals(revision)) {
        Info info = myVcs.getInfo(path, SVNRevision.BASE);
        result = info != null ? info.getRevision().getNumber() : -1;
    }
    if (result == -1) {
        throw new VcsException("Could not determine revision number for file " + path + " and revision " + revision);
    }
    return SVNRevision.create(result);
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) Info(org.jetbrains.idea.svn.info.Info)

Example 29 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class IntegratedSelectedOptionsDialog method realTargetUrl.

@Nullable
private static SVNURL realTargetUrl(final SvnVcs vcs, final WorkingCopyInfo info, final String targetBranchUrl) {
    final Info svnInfo = vcs.getInfo(info.getLocalPath());
    final SVNURL svnurl = svnInfo != null ? svnInfo.getURL() : null;
    return (svnurl != null) && (svnurl.toString().startsWith(targetBranchUrl)) ? svnurl : null;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) Info(org.jetbrains.idea.svn.info.Info) Nullable(org.jetbrains.annotations.Nullable)

Example 30 with Info

use of org.jetbrains.idea.svn.info.Info 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)

Aggregations

Info (org.jetbrains.idea.svn.info.Info)32 File (java.io.File)18 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 VcsException (com.intellij.openapi.vcs.VcsException)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNURL (org.tmatesoft.svn.core.SVNURL)6 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)6 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)5 RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)5 IOException (java.io.IOException)3 Nullable (org.jetbrains.annotations.Nullable)3 Test (org.junit.Test)3 SVNException (org.tmatesoft.svn.core.SVNException)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 FilePath (com.intellij.openapi.vcs.FilePath)2 ArrayList (java.util.ArrayList)2 SvnVcs (org.jetbrains.idea.svn.SvnVcs)2 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)2 WCInfo (org.jetbrains.idea.svn.dialogs.WCInfo)2 SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)2