Search in sources :

Example 46 with ProcessOutput

use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.

the class SvnExecutableChecker method validateLocale.

@Nullable
private Notification validateLocale() throws SvnBindException {
    ProcessOutput versionOutput = getVersionClient().runCommand(false);
    Notification result = null;
    Matcher matcher = INVALID_LOCALE_WARNING_PATTERN.matcher(versionOutput.getStderr());
    if (matcher.find()) {
        LOG.info(matcher.group());
        result = new ExecutableNotValidNotification(prepareDescription(UIUtil.getHtmlBody(matcher.group()), false), NotificationType.WARNING);
    } else if (!isEnglishOutput(versionOutput.getStdout())) {
        LOG.info("\"svn --version\" command contains non-English output " + versionOutput.getStdout());
        result = new ExecutableNotValidNotification(prepareDescription(SvnBundle.message("non.english.locale.detected.warning"), false), NotificationType.WARNING);
    }
    return result;
}
Also used : Matcher(java.util.regex.Matcher) ProcessOutput(com.intellij.execution.process.ProcessOutput) Notification(com.intellij.notification.Notification) Nullable(org.jetbrains.annotations.Nullable)

Example 47 with ProcessOutput

use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.

the class HgTestRepository method create.

/**
   * Creates a new Mercurial repository in a new temporary test directory.
   * @param test reference to the test case instance.
   * @return created repository.
   */
public static HgTestRepository create(HgTest test) throws Exception {
    final TempDirTestFixture dirFixture = createFixtureDir();
    final File repo = new File(dirFixture.getTempDirPath());
    final ProcessOutput processOutput = test.runHg(repo, "init");
    AbstractVcsTestCase.verify(processOutput);
    return new HgTestRepository(test, dirFixture);
}
Also used : TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) ProcessOutput(com.intellij.execution.process.ProcessOutput) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 48 with ProcessOutput

use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.

the class SvnRenameTest method testCommitAfterRenameDir.

// IDEADEV-19065
@Test
public void testCommitAfterRenameDir() throws Exception {
    final VirtualFile child = prepareDirectoriesForRename();
    renameFileInCommand(child, "newchild");
    checkin();
    final ProcessOutput runResult = runSvn("log", "-q", "newchild/a.txt");
    verify(runResult);
    final List<String> lines = StringUtil.split(runResult.getStdout(), "\n");
    for (Iterator<String> iterator = lines.iterator(); iterator.hasNext(); ) {
        final String next = iterator.next();
        if (next.startsWith(LOG_SEPARATOR_START)) {
            iterator.remove();
        }
    }
    Assert.assertEquals(2, lines.size());
    Assert.assertTrue(lines.get(0).startsWith("r2 |"));
    Assert.assertTrue(lines.get(1).startsWith("r1 |"));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProcessOutput(com.intellij.execution.process.ProcessOutput) Test(org.junit.Test)

Example 49 with ProcessOutput

use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.

the class SvnRenameTest method testRenameReplace.

// IDEADEV-18844
@Test
public void testRenameReplace() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VirtualFile a = createFileInCommand("a.txt", "old");
    final VirtualFile aNew = createFileInCommand("aNew.txt", "new");
    checkin();
    renameFileInCommand(a, "aOld.txt");
    renameFileInCommand(aNew, "a.txt");
    final ProcessOutput result = runSvn("status");
    verifySorted(result, "A + aOld.txt", "D aNew.txt", "R + a.txt");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProcessOutput(com.intellij.execution.process.ProcessOutput) Test(org.junit.Test)

Example 50 with ProcessOutput

use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.

the class SvnRenameTest method testRenamePackageWithChildren.

// IDEADEV-15876
@Test
public void testRenamePackageWithChildren() throws Exception {
    final VirtualFile child = prepareDirectoriesForRename();
    renameFileInCommand(child, "childnew");
    final ProcessOutput result = runSvn("status");
    verifySorted(result, "A + childnew", "D child", "D child" + File.separatorChar + "a.txt", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt");
    // wait for end of refresh operations initiated from SvnFileSystemListener
    refreshVfs();
    final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    changeListManager.ensureUpToDate(false);
    List<Change> changes = new ArrayList<>(changeListManager.getDefaultChangeList().getChanges());
    Assert.assertEquals(4, changes.size());
    sortChanges(changes);
    verifyChange(changes.get(0), "child", "childnew");
    verifyChange(changes.get(1), "child" + File.separatorChar + "a.txt", "childnew" + File.separatorChar + "a.txt");
    verifyChange(changes.get(2), "child" + File.separatorChar + "grandChild", "childnew" + File.separatorChar + "grandChild");
    verifyChange(changes.get(3), "child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "childnew" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt");
    VirtualFile oldChild = myWorkingCopyDir.findChild("child");
    Assert.assertEquals(FileStatus.DELETED, changeListManager.getStatus(oldChild));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProcessOutput(com.intellij.execution.process.ProcessOutput) ArrayList(java.util.ArrayList) Change(com.intellij.openapi.vcs.changes.Change) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Aggregations

ProcessOutput (com.intellij.execution.process.ProcessOutput)66 ExecutionException (com.intellij.execution.ExecutionException)25 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 File (java.io.File)23 CapturingProcessHandler (com.intellij.execution.process.CapturingProcessHandler)16 Nullable (org.jetbrains.annotations.Nullable)13 NotNull (org.jetbrains.annotations.NotNull)9 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 Project (com.intellij.openapi.project.Project)5 PsiFile (com.intellij.psi.PsiFile)5 IOException (java.io.IOException)5 OutputStream (java.io.OutputStream)4 CapturingAnsiEscapesAwareProcessHandler (com.intellij.execution.process.CapturingAnsiEscapesAwareProcessHandler)3 Notification (com.intellij.notification.Notification)3 Document (com.intellij.openapi.editor.Document)3 Task (com.intellij.openapi.progress.Task)3 Sdk (com.intellij.openapi.projectRoots.Sdk)3