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);
insideInitializedChangeListManager(changeListManager, () -> {
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");
});
// there is no such directory any more
/*VirtualFile oldChild = myWorkingCopyDir.findChild("child");
if (oldChild == null) {
myWorkingCopyDir.refresh(false, true);
oldChild = myWorkingCopyDir.findChild("child");
}
Assert.assertEquals(FileStatus.DELETED, changeListManager.getStatus(oldChild));*/
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class GenerateBinaryStubsFix method generateSkeletonsForList.
private boolean generateSkeletonsForList(@NotNull final PySkeletonRefresher refresher, ProgressIndicator indicator, @Nullable final String currentBinaryFilesPath) throws InvalidSdkException {
final PySkeletonGenerator generator = new PySkeletonGenerator(refresher.getSkeletonsPath(), mySdk, currentBinaryFilesPath);
indicator.setIndeterminate(false);
final String homePath = mySdk.getHomePath();
if (homePath == null)
return false;
GeneralCommandLine cmd = PythonHelper.EXTRA_SYSPATH.newCommandLine(homePath, Lists.newArrayList(myQualifiedName));
final ProcessOutput runResult = PySdkUtil.getProcessOutput(cmd, new File(homePath).getParent(), PythonSdkType.getVirtualEnvExtraEnv(homePath), 5000);
if (runResult.getExitCode() == 0 && !runResult.isTimeout()) {
final String extraPath = runResult.getStdout();
final PySkeletonGenerator.ListBinariesResult binaries = generator.listBinaries(mySdk, extraPath);
final List<String> names = Lists.newArrayList(binaries.modules.keySet());
Collections.sort(names);
final int size = names.size();
for (int i = 0; i != size; ++i) {
final String name = names.get(i);
indicator.setFraction((double) i / size);
if (needBinaryList(name)) {
indicator.setText2(name);
final PySkeletonRefresher.PyBinaryItem item = binaries.modules.get(name);
final String modulePath = item != null ? item.getPath() : "";
//noinspection unchecked
refresher.generateSkeleton(name, modulePath, new ArrayList<>(), Consumer.EMPTY_CONSUMER);
}
}
}
return true;
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class Pep8ExternalAnnotator method doAnnotate.
@Nullable
@Override
public Results doAnnotate(State collectedInfo) {
if (collectedInfo == null)
return null;
ArrayList<String> options = Lists.newArrayList();
if (!collectedInfo.ignoredErrors.isEmpty()) {
options.add("--ignore=" + DEFAULT_IGNORED_ERRORS + "," + StringUtil.join(collectedInfo.ignoredErrors, ","));
}
if (collectedInfo.hangClosingBrackets) {
options.add("--hang-closing");
}
options.add("--max-line-length=" + collectedInfo.margin);
options.add("-");
GeneralCommandLine cmd = PythonHelper.PYCODESTYLE.newCommandLine(collectedInfo.interpreterPath, options);
ProcessOutput output = PySdkUtil.getProcessOutput(cmd, new File(collectedInfo.interpreterPath).getParent(), ImmutableMap.of("PYTHONBUFFERED", "1"), 10000, collectedInfo.fileText.getBytes(), false);
Results results = new Results(collectedInfo.level);
if (output.isTimeout()) {
LOG.info("Timeout running pycodestyle.py");
} else if (output.getStderrLines().isEmpty()) {
for (String line : output.getStdoutLines()) {
final Problem problem = parseProblem(line);
if (problem != null) {
results.problems.add(problem);
}
}
} else if (((ApplicationInfoImpl) ApplicationInfo.getInstance()).isEAP()) {
LOG.info("Error running pycodestyle.py: " + output.getStderr());
}
return results;
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class HgTestRepository method cloneRepository.
/**
* Clones a repository from this one. New repository is located in a new temporary test directory.
* @return New repository cloned from this one.
*/
public HgTestRepository cloneRepository() throws Exception {
final TempDirTestFixture dirFixture = createFixtureDir();
final ProcessOutput processOutput = myTest.runHg(null, "clone", getDirFixture().getTempDirPath(), dirFixture.getTempDirPath());
AbstractVcsTestCase.verify(processOutput);
return new HgTestRepository(myTest, dirFixture);
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class HgUpdateTest method determineNumberOfIncomingChanges.
private int determineNumberOfIncomingChanges(File repo) throws IOException {
ProcessOutput result = runHg(repo, "-q", "incoming", "--template", "{rev} ");
String output = result.getStdout();
return output.length() == 0 ? 0 : output.split(" ").length;
}
Aggregations