From 75ec80e569484dcd18e57ee0211314527451a967 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Mon, 16 Dec 2013 19:53:14 +0400 Subject: [PATCH] IDEA-118266 time measurements for all Mercurial commands added and log command debug output suppressed. --- .../zmlx/hg4idea/execution/HgCommandExecutor.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandExecutor.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandExecutor.java index 1591117ebf30..932e594388e6 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandExecutor.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandExecutor.java @@ -207,7 +207,10 @@ public final class HgCommandExecutor { try { String workingDir = repo != null ? repo.getPath() : null; ShellCommand shellCommand = new ShellCommand(cmdLine, workingDir, myCharset); + long startTime = System.currentTimeMillis(); + LOG.debug(String.format("hg %s.started", operation)); result = shellCommand.execute(operationsWithTextIndicator.contains(operation)); + LOG.debug(String.format("hg %s finished. Took %s ms", operation, System.currentTimeMillis() - startTime)); if (!HgErrorUtil.isAuthorizationError(result)) { passReceiver.saveCredentials(); } @@ -228,8 +231,7 @@ public final class HgCommandExecutor { } String warnings = warningReceiver.getWarnings(); result.setWarnings(warnings); - - logResult(result); + logResult(result, operation); return result; } @@ -262,7 +264,7 @@ public final class HgCommandExecutor { } @SuppressWarnings("UseOfSystemOutOrSystemErr") - private void logResult(@NotNull HgCommandResult result) { + private void logResult(@NotNull HgCommandResult result, @NotNull String operationName) { final boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode(); // log output if needed @@ -270,11 +272,12 @@ public final class HgCommandExecutor { if (unitTestMode) { System.out.print(result.getRawOutput() + "\n"); } - if (!myIsSilent && myShowOutput) { + else if (!myIsSilent && myShowOutput) { LOG.info(result.getRawOutput()); myVcs.showMessageInConsole(result.getRawOutput(), ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes()); } - else { + else if (!StringUtil.equalsIgnoreCase(operationName, "log")) { + //too big output for log command! LOG.debug(result.getRawOutput()); } }