mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
OutputSuppressed option added for HgCommandExecutor, style changed, unnecessary parameters removed
This commit is contained in:
@@ -39,6 +39,7 @@ public class HgCatCommand {
|
||||
final HgCommandExecutor executor = new HgCommandExecutor(myProject);
|
||||
executor.setOptions(Collections.<String>emptyList());
|
||||
executor.setSilent(true);
|
||||
executor.setOutputAlwaysSuppressed(true);
|
||||
executor.setCharset(charset);
|
||||
final HgCommandResult result = executor.executeInCurrentThread(hgFile.getRepo(), "cat", arguments);
|
||||
|
||||
|
||||
@@ -236,7 +236,9 @@ public class HgLogCommand {
|
||||
if (myLogFile && hgFile != null) {
|
||||
arguments.add(hgFile.getRelativePath());
|
||||
}
|
||||
return new HgCommandExecutor(myProject).executeInCurrentThread(repo, "log", arguments);
|
||||
HgCommandExecutor commandExecutor = new HgCommandExecutor(myProject);
|
||||
commandExecutor.setOutputAlwaysSuppressed(true);
|
||||
return commandExecutor.executeInCurrentThread(repo, "log", arguments);
|
||||
}
|
||||
|
||||
private static Set<String> parseFileList(String fileListString) {
|
||||
|
||||
@@ -65,6 +65,8 @@ public final class HgCommandExecutor {
|
||||
@NotNull private Charset myCharset;
|
||||
private boolean myIsSilent = false;
|
||||
private boolean myShowOutput = false;
|
||||
|
||||
private boolean myOutputAlwaysSuppressed = false; //for command with enormous output, like log or cat
|
||||
private List<String> myOptions = DEFAULT_OPTIONS;
|
||||
@Nullable private ModalityState myState;
|
||||
|
||||
@@ -102,6 +104,10 @@ public final class HgCommandExecutor {
|
||||
myShowOutput = showOutput;
|
||||
}
|
||||
|
||||
public void setOutputAlwaysSuppressed(boolean outputAlwaysSuppressed) {
|
||||
myOutputAlwaysSuppressed = outputAlwaysSuppressed;
|
||||
}
|
||||
|
||||
public void execute(@Nullable final VirtualFile repo, @NotNull final String operation, @Nullable final List<String> arguments,
|
||||
@Nullable final HgCommandResultHandler handler) {
|
||||
HgUtil.executeOnPooledThreadIfNeeded(new Runnable() {
|
||||
@@ -230,7 +236,7 @@ public final class HgCommandExecutor {
|
||||
}
|
||||
String warnings = warningReceiver.getWarnings();
|
||||
result.setWarnings(warnings);
|
||||
logResult(result, operation);
|
||||
logResult(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -263,7 +269,7 @@ public final class HgCommandExecutor {
|
||||
}
|
||||
|
||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||
private void logResult(@NotNull HgCommandResult result, @NotNull String operationName) {
|
||||
private void logResult(@NotNull HgCommandResult result) {
|
||||
final boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode();
|
||||
|
||||
// log output if needed
|
||||
@@ -271,13 +277,14 @@ public final class HgCommandExecutor {
|
||||
if (unitTestMode) {
|
||||
System.out.print(result.getRawOutput() + "\n");
|
||||
}
|
||||
else if (!myIsSilent && myShowOutput) {
|
||||
LOG.info(result.getRawOutput());
|
||||
myVcs.showMessageInConsole(result.getRawOutput(), ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes());
|
||||
}
|
||||
else if (!StringUtil.equalsIgnoreCase(operationName, "log")) {
|
||||
//too big output for log command!
|
||||
LOG.debug(result.getRawOutput());
|
||||
else if (!myOutputAlwaysSuppressed) {
|
||||
if (!myIsSilent && myShowOutput) {
|
||||
LOG.info(result.getRawOutput());
|
||||
myVcs.showMessageInConsole(result.getRawOutput(), ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes());
|
||||
}
|
||||
else {
|
||||
LOG.debug(result.getRawOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user