Search in sources :

Example 31 with SVNException

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

the class SvnKitMergeClient method merge.

@Override
public void merge(@NotNull SvnTarget source1, @NotNull SvnTarget source2, @NotNull File destination, @Nullable Depth depth, boolean useAncestry, boolean dryRun, boolean recordOnly, boolean force, @Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) throws VcsException {
    assertUrl(source1);
    assertUrl(source2);
    try {
        createClient(diffOptions, handler).doMerge(source1.getURL(), source1.getPegRevision(), source2.getURL(), source2.getPegRevision(), destination, toDepth(depth), useAncestry, force, dryRun, recordOnly);
    } catch (SVNException e) {
        throw new VcsException(e);
    }
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException)

Example 32 with SVNException

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

the class BranchInfo method checkPaths.

@NotNull
private MultiMap<SvnMergeInfoCache.MergeCheckResult, String> checkPaths(@NotNull SvnChangeList list, @NotNull String branchPath, final String subPathUnderBranch) {
    MultiMap<SvnMergeInfoCache.MergeCheckResult, String> result = MultiMap.create();
    String myTrunkPathCorrespondingToLocalBranchPath = SVNPathUtil.append(myInfo.getCurrentBranch().getUrl(), subPathUnderBranch);
    for (String path : list.getAffectedPaths()) {
        String absoluteInTrunkPath = SVNPathUtil.append(myInfo.getRepoUrl(), path);
        SvnMergeInfoCache.MergeCheckResult mergeCheckResult;
        if (!absoluteInTrunkPath.startsWith(myTrunkPathCorrespondingToLocalBranchPath)) {
            mergeCheckResult = SvnMergeInfoCache.MergeCheckResult.NOT_EXISTS;
        } else {
            String relativeToTrunkPath = absoluteInTrunkPath.substring(myTrunkPathCorrespondingToLocalBranchPath.length());
            String localPathInBranch = new File(branchPath, relativeToTrunkPath).getAbsolutePath();
            try {
                mergeCheckResult = checkPathGoingUp(list.getNumber(), -1, branchPath, localPathInBranch, path, true);
            } catch (VcsException | SVNException e) {
                LOG.info(e);
                mergeCheckResult = SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
            }
        }
        result.putValue(mergeCheckResult, path);
        // NOT_EXISTS. And currently we're only interested in not merged paths for change lists with NOT_MERGED status.
        if (SvnMergeInfoCache.MergeCheckResult.NOT_EXISTS.equals(mergeCheckResult)) {
            break;
        }
    }
    return result;
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 33 with SVNException

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

the class SvnHistoryProvider method reportAppendableHistory.

public void reportAppendableHistory(FilePath path, final VcsAppendableHistorySessionPartner partner, @Nullable final SVNRevision from, @Nullable final SVNRevision to, final int limit, SVNRevision peg, final boolean forceBackwards) throws VcsException {
    FilePath committedPath = path;
    Change change = ChangeListManager.getInstance(myVcs.getProject()).getChange(path);
    if (change != null) {
        final ContentRevision beforeRevision = change.getBeforeRevision();
        final ContentRevision afterRevision = change.getAfterRevision();
        if (beforeRevision != null && afterRevision != null && !beforeRevision.getFile().equals(afterRevision.getFile()) && afterRevision.getFile().equals(path)) {
            committedPath = beforeRevision.getFile();
        }
        // revision can be VcsRevisionNumber.NULL
        if (peg == null && change.getBeforeRevision() != null && change.getBeforeRevision().getRevisionNumber() instanceof SvnRevisionNumber) {
            peg = ((SvnRevisionNumber) change.getBeforeRevision().getRevisionNumber()).getRevision();
        }
    }
    boolean showMergeSources = myVcs.getSvnConfiguration().isShowMergeSourcesInAnnotate();
    final LogLoader logLoader;
    if (path.isNonLocal()) {
        logLoader = new RepositoryLoader(myVcs, committedPath, from, to, limit, peg, forceBackwards, showMergeSources);
    } else {
        logLoader = new LocalLoader(myVcs, committedPath, from, to, limit, peg, showMergeSources);
    }
    try {
        logLoader.preliminary();
    } catch (SVNException e) {
        throw new VcsException(e);
    }
    logLoader.check();
    if (showMergeSources) {
        logLoader.initSupports15();
    }
    final SvnHistorySession historySession = new SvnHistorySession(myVcs, Collections.emptyList(), committedPath, showMergeSources && Boolean.TRUE.equals(logLoader.mySupport15), null, false, !path.isNonLocal());
    final Ref<Boolean> sessionReported = new Ref<>();
    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator != null) {
        indicator.setText(SvnBundle.message("progress.text2.collecting.history", path.getName()));
    }
    final Consumer<VcsFileRevision> consumer = vcsFileRevision -> {
        if (!Boolean.TRUE.equals(sessionReported.get())) {
            partner.reportCreatedEmptySession(historySession);
            sessionReported.set(true);
        }
        partner.acceptRevision(vcsFileRevision);
    };
    logLoader.setConsumer(consumer);
    logLoader.load();
    logLoader.check();
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) UIUtil(com.intellij.util.ui.UIUtil) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SvnRevisionNumber(org.jetbrains.idea.svn.SvnRevisionNumber) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Date(java.util.Date) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) ThrowableConsumer(com.intellij.util.ThrowableConsumer) ColumnInfo(com.intellij.util.ui.ColumnInfo) TableCellRenderer(javax.swing.table.TableCellRenderer) ActionManager(com.intellij.openapi.actionSystem.ActionManager) ShowAllAffectedGenericAction(com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction) SVNErrorManager(org.tmatesoft.svn.core.internal.wc.SVNErrorManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) SvnUtil(org.jetbrains.idea.svn.SvnUtil) Charset(java.nio.charset.Charset) StatusText(com.intellij.util.ui.StatusText) SvnVcs(org.jetbrains.idea.svn.SvnVcs) VcsException(com.intellij.openapi.vcs.VcsException) FilePath(com.intellij.openapi.vcs.FilePath) PlatformIcons(com.intellij.util.PlatformIcons) ProgressManager(com.intellij.openapi.progress.ProgressManager) SVNCancelException(org.tmatesoft.svn.core.SVNCancelException) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) SVNException(org.tmatesoft.svn.core.SVNException) StringUtil(com.intellij.openapi.util.text.StringUtil) AnAction(com.intellij.openapi.actionSystem.AnAction) Info(org.jetbrains.idea.svn.info.Info) com.intellij.openapi.vcs.history(com.intellij.openapi.vcs.history) com.intellij.ui(com.intellij.ui) MouseEvent(java.awt.event.MouseEvent) SvnBundle(org.jetbrains.idea.svn.SvnBundle) java.awt(java.awt) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) VcsActions(com.intellij.openapi.vcs.VcsActions) List(java.util.List) TableLinkMouseListener(com.intellij.openapi.vcs.changes.issueLinks.TableLinkMouseListener) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNLogType(org.tmatesoft.svn.util.SVNLogType) SVNURL(org.tmatesoft.svn.core.SVNURL) SVNPathUtil(org.tmatesoft.svn.core.internal.util.SVNPathUtil) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) Collections(java.util.Collections) Consumer(com.intellij.util.Consumer) javax.swing(javax.swing) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) SVNException(org.tmatesoft.svn.core.SVNException) SvnRevisionNumber(org.jetbrains.idea.svn.SvnRevisionNumber) Ref(com.intellij.openapi.util.Ref) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) VcsException(com.intellij.openapi.vcs.VcsException)

Example 34 with SVNException

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

the class SvnChangeList method patchChange.

private void patchChange(Change change, final String path) {
    final SVNURL becameUrl;
    SVNURL wasUrl;
    try {
        becameUrl = SVNURL.parseURIEncoded(SVNPathUtil.append(myRepositoryRoot, path));
        wasUrl = becameUrl;
        if (change instanceof ExternallyRenamedChange && change.getBeforeRevision() != null) {
            String originUrl = ((ExternallyRenamedChange) change).getOriginUrl();
            if (originUrl != null) {
                // use another url for origin
                wasUrl = SVNURL.parseURIEncoded(SVNPathUtil.append(myRepositoryRoot, originUrl));
            }
        }
    } catch (SVNException e) {
        // nothing to do
        LOG.info(e);
        return;
    }
    final FilePath filePath = ChangesUtil.getFilePath(change);
    final Change additional = new Change(createPropertyRevision(filePath, change.getBeforeRevision(), wasUrl), createPropertyRevision(filePath, change.getAfterRevision(), becameUrl));
    change.addAdditionalLayerElement(SvnChangeProvider.PROPERTY_LAYER, additional);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) SVNURL(org.tmatesoft.svn.core.SVNURL) SVNException(org.tmatesoft.svn.core.SVNException)

Example 35 with SVNException

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

the class SvnInfoHandler method switchPending.

private void switchPending() throws SAXException {
    final org.jetbrains.idea.svn.info.Info info;
    try {
        info = myPending.convert();
    } catch (SVNException e) {
        throw new SAXException(e);
    }
    if (myInfoConsumer != null) {
        myInfoConsumer.consume(info);
    }
    myResultsMap.put(info.getFile(), info);
    myPending = createPending();
}
Also used : SVNException(org.tmatesoft.svn.core.SVNException) SAXException(org.xml.sax.SAXException)

Aggregations

SVNException (org.tmatesoft.svn.core.SVNException)95 File (java.io.File)37 SVNURL (org.tmatesoft.svn.core.SVNURL)37 VcsException (com.intellij.openapi.vcs.VcsException)18 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)14 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)14 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)8 Collection (java.util.Collection)8 List (java.util.List)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 DefaultSVNOptions (org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions)7 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 Date (java.util.Date)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNCancelException (org.tmatesoft.svn.core.SVNCancelException)6 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)6 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5