Search in sources :

Example 21 with FilePath

use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.

the class SvnTestDirtyScopeStateTest method testWhatIsDirty.

@Test
public void testWhatIsDirty() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VcsDirtyScopeManagerImpl vcsDirtyScopeManager = (VcsDirtyScopeManagerImpl) VcsDirtyScopeManager.getInstance(myProject);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final VirtualFile fileB = createFileInCommand("b.txt", "old content");
    final VirtualFile fileC = createFileInCommand("c.txt", "old content");
    final VirtualFile fileD = createFileInCommand("d.txt", "old content");
    final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
    vcsDirtyScopeManager.retrieveScopes();
    vcsDirtyScopeManager.changesProcessed();
    vcsDirtyScopeManager.fileDirty(file);
    vcsDirtyScopeManager.fileDirty(fileB);
    final Collection<FilePath> dirty1 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.retrieveScopes();
    final Collection<FilePath> dirty2 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.changesProcessed();
    final Collection<FilePath> dirty3 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileD)));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) VcsDirtyScopeManagerImpl(com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl) Test(org.junit.Test)

Example 22 with FilePath

use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.

the class AutoSvnUpdater method actionPerformed.

@Override
protected void actionPerformed(@NotNull VcsContext context) {
    final SvnConfiguration configuration17 = SvnConfiguration.getInstance(myProject);
    configuration17.setForceUpdate(false);
    configuration17.setUpdateLockOnDemand(false);
    configuration17.setUpdateDepth(Depth.INFINITY);
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    for (FilePath root : myRoots) {
        configureUpdateRootInfo(root, configuration17.getUpdateRootInfo(root.getIOFile(), vcs));
    }
    super.actionPerformed(context);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) SvnConfiguration(org.jetbrains.idea.svn.SvnConfiguration) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 23 with FilePath

use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.

the class UnversionedAndNotTouchedFilesGroupCollector method toFromTo.

private void toFromTo(VirtualFile file) {
    FilePath path = VcsUtil.getFilePath(file);
    final ThroughRenameInfo info = findToFile(path, null);
    if (info != null) {
        myFromTo.put(path.getIOFile(), info);
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath)

Example 24 with FilePath

use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.

the class UnversionedAndNotTouchedFilesGroupCollector method processChangeImpl.

private void processChangeImpl(final Change change) {
    if (change.getAfterRevision() != null) {
        final FilePath after = change.getAfterRevision().getFile();
        final ThroughRenameInfo info = findToFile(after, change.getBeforeRevision() == null ? null : change.getBeforeRevision().getFile().getIOFile());
        if (info != null) {
            myFromTo.put(after.getIOFile(), info);
        }
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath)

Example 25 with FilePath

use of com.intellij.openapi.vcs.FilePath 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

FilePath (com.intellij.openapi.vcs.FilePath)167 VirtualFile (com.intellij.openapi.vfs.VirtualFile)68 NotNull (org.jetbrains.annotations.NotNull)43 VcsException (com.intellij.openapi.vcs.VcsException)34 File (java.io.File)30 Change (com.intellij.openapi.vcs.changes.Change)26 Nullable (org.jetbrains.annotations.Nullable)22 Project (com.intellij.openapi.project.Project)20 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)15 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)13 FileStatus (com.intellij.openapi.vcs.FileStatus)10 AbstractVcs (com.intellij.openapi.vcs.AbstractVcs)8 GitRepository (git4idea.repo.GitRepository)7 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Test (org.junit.Test)6 StringUtil (com.intellij.openapi.util.text.StringUtil)5 Logger (com.intellij.openapi.diagnostic.Logger)4