Search in sources :

Example 6 with SVNRevision

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

the class RepositoryBrowserDialog method doCheckout.

protected void doCheckout(@Nullable final CheckoutProvider.Listener listener, final RepositoryTreeNode selectedNode) {
    if (selectedNode == null) {
        return;
    }
    SVNURL url = selectedNode.getURL();
    String relativePath = "";
    final DirectoryEntry entry = selectedNode.getSVNDirEntry();
    if (entry != null) {
        if (entry.getRepositoryRoot() != null) {
            if (!entry.getRepositoryRoot().equals(url)) {
                relativePath = SVNPathUtil.getRelativePath(entry.getRepositoryRoot().toString(), url.toDecodedString());
            }
        } else {
            relativePath = entry.getRelativePath();
        }
    } else {
        relativePath = url.getPath();
    }
    File dir = selectFile(SvnBundle.message("svn.checkout.destination.directory.title"), SvnBundle.message("svn.checkout.destination.directory.description"));
    if (dir == null) {
        return;
    }
    Project p = myProject;
    CheckoutOptionsDialog dialog = new CheckoutOptionsDialog(p, url, dir, SvnUtil.getVirtualFile(dir.getAbsolutePath()), relativePath);
    dialog.show();
    dir = dialog.getTarget();
    if (dialog.isOK() && dir != null) {
        final SVNRevision revision;
        try {
            revision = dialog.getRevision();
        } catch (ConfigurationException e) {
            Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", e.getMessage()), SvnBundle.message("message.title.check.out"));
            return;
        }
        SvnCheckoutProvider.doCheckout(myProject, dir, url.toString(), revision, dialog.getDepth(), dialog.isIgnoreExternals(), listener);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ConfigurationException(com.intellij.openapi.options.ConfigurationException) SVNURL(org.tmatesoft.svn.core.SVNURL) DirectoryEntry(org.jetbrains.idea.svn.browse.DirectoryEntry) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) VirtualFile(com.intellij.openapi.vfs.VirtualFile)

Example 7 with SVNRevision

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

the class TreeConflictRefreshablePanel method getPegRevisionFromLeftSide.

@Nullable
private SVNRevision getPegRevisionFromLeftSide(@NotNull TreeConflictDescription description) {
    SVNRevision result = null;
    if (description.getSourceLeftVersion() != null) {
        long committed = description.getSourceLeftVersion().getPegRevision();
        if (myCommittedRevision != null && myCommittedRevision.getRevision().getNumber() < committed && myCommittedRevision.getRevision().isValid()) {
            committed = myCommittedRevision.getRevision().getNumber();
        }
        result = SVNRevision.create(committed);
    }
    return result;
}
Also used : SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) Nullable(org.jetbrains.annotations.Nullable)

Example 8 with SVNRevision

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

the class SvnUpdateRootOptionsPanel method apply.

public void apply(final SvnConfiguration configuration) throws ConfigurationException {
    final UpdateRootInfo rootInfo = configuration.getUpdateRootInfo(myRoot.getIOFile(), myVcs);
    if (myUpdateToSpecificUrl.isSelected()) {
        try {
            rootInfo.setUrl(SvnUtil.createUrl(myURLText.getText(), false));
        } catch (SvnBindException e) {
            throw new ConfigurationException("Invalid url: " + myURLText.getText());
        }
    }
    rootInfo.setUpdateToRevision(myRevisionBox.isSelected());
    final SVNRevision revision = SVNRevision.parse(myRevisionText.getText());
    if (!revision.isValid()) {
        throw new ConfigurationException(SvnBundle.message("invalid.svn.revision.error.message", myRevisionText.getText()));
    }
    rootInfo.setRevision(revision);
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ConfigurationException(com.intellij.openapi.options.ConfigurationException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision)

Example 9 with SVNRevision

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

the class PortableStatus method getRevision.

@NotNull
@Override
public SVNRevision getRevision() {
    final SVNRevision revision = super.getRevision();
    if (revision.isValid())
        return revision;
    final StatusType status = getContentsStatus();
    if (StatusType.STATUS_NONE.equals(status) || StatusType.STATUS_UNVERSIONED.equals(status) || StatusType.STATUS_ADDED.equals(status))
        return revision;
    final Info info = initInfo();
    return info == null ? revision : info.getRevision();
}
Also used : SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) Info(org.jetbrains.idea.svn.info.Info) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with SVNRevision

use of org.tmatesoft.svn.core.wc.SVNRevision 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)

Aggregations

SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)19 VcsException (com.intellij.openapi.vcs.VcsException)7 Info (org.jetbrains.idea.svn.info.Info)7 SVNURL (org.tmatesoft.svn.core.SVNURL)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)4 Ref (com.intellij.openapi.util.Ref)4 File (java.io.File)4 NotNull (org.jetbrains.annotations.NotNull)4 Nullable (org.jetbrains.annotations.Nullable)4 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)4 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)4 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 FilePath (com.intellij.openapi.vcs.FilePath)3 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)3 List (java.util.List)2 SVNException (org.tmatesoft.svn.core.SVNException)2 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Application (com.intellij.openapi.application.Application)1