diff --git a/plugins/hg4idea/hg4idea.iml b/plugins/hg4idea/hg4idea.iml index f7efe10c0e5f..1c036a8a3851 100644 --- a/plugins/hg4idea/hg4idea.iml +++ b/plugins/hg4idea/hg4idea.iml @@ -16,6 +16,7 @@ + diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java index 6a06a51af968..4b8d677c9267 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java @@ -13,8 +13,10 @@ package org.zmlx.hg4idea; import com.intellij.concurrency.JobScheduler; +import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diff.impl.patch.formove.FilePathComparator; +import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileEditor.FileEditorManagerAdapter; import com.intellij.openapi.fileEditor.FileEditorManagerEvent; import com.intellij.openapi.fileEditor.FileEditorManagerListener; @@ -46,6 +48,7 @@ import com.intellij.util.containers.ComparatorDelegate; import com.intellij.util.containers.Convertor; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.messages.Topic; +import org.jetbrains.annotations.NotNull; import org.zmlx.hg4idea.provider.*; import org.zmlx.hg4idea.provider.annotate.HgAnnotationProvider; import org.zmlx.hg4idea.provider.commit.HgCheckinEnvironment; @@ -101,16 +104,19 @@ public class HgVcs extends AbstractVcs { private ScheduledFuture changesUpdaterScheduledFuture; private final HgGlobalSettings globalSettings; private final HgProjectSettings projectSettings; + private final ProjectLevelVcsManager myVcsManager; private boolean started = false; private HgVFSListener myVFSListener; private VirtualFileListener myDirStateChangeListener; public HgVcs(Project project, - HgGlobalSettings globalSettings, HgProjectSettings projectSettings) { + HgGlobalSettings globalSettings, HgProjectSettings projectSettings, + ProjectLevelVcsManager vcsManager) { super(project, VCS_NAME); this.globalSettings = globalSettings; this.projectSettings = projectSettings; + myVcsManager = vcsManager; configurable = new HgProjectConfigurable(projectSettings); changeProvider = new HgChangeProvider(project, getKeyInstanceMethod()); rollbackEnvironment = new HgRollbackEnvironment(project); @@ -388,4 +394,10 @@ public class HgVcs extends AbstractVcs { public HgGlobalSettings getGlobalSettings() { return globalSettings; } + + public void showMessageInConsole(String message, final TextAttributes style) { + myVcsManager.addMessageToConsoleWindow(message, style); + } + + } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommandService.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommandService.java index 5efd3bba869c..aefb8fc54fa2 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommandService.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCommandService.java @@ -12,6 +12,7 @@ // limitations under the License. package org.zmlx.hg4idea.command; +import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.components.ServiceManager; @@ -19,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.vcsUtil.VcsUtil; +import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.*; @@ -40,7 +42,7 @@ public final class HgCommandService { static final Logger LOG = Logger.getInstance(HgCommandService.class.getName()); - private static final List DEFAULT_OPTIONS = Arrays.asList( + static final List DEFAULT_OPTIONS = Arrays.asList( "--config", "ui.merge=internal:merge" ); @@ -77,6 +79,11 @@ public final class HgCommandService { @Nullable HgCommandResult execute(VirtualFile repo, List hgOptions, String operation, List arguments, Charset charset) { + return execute(repo, hgOptions, operation, arguments, charset, false); + } + + HgCommandResult execute(VirtualFile repo, List hgOptions, + String operation, List arguments, Charset charset, boolean suppressCommandOutput) { if (!validator.check(mySettings)) { return null; @@ -134,6 +141,17 @@ public final class HgCommandService { } String warnings = warningReceiver.getWarnings(); result.setWarnings(warnings); + + // logging to the Version Control console (without extensions and configs) + final String cmdString = String.format("%s %s %s", HgVcs.HG_EXECUTABLE_FILE_NAME, operation, + StringUtils.join(arguments, " ")); + final HgVcs hgVcs = HgVcs.getInstance(myProject); + hgVcs.showMessageInConsole(cmdString, ConsoleViewContentType.USER_INPUT.getAttributes()); + if (!suppressCommandOutput) { + hgVcs.showMessageInConsole(result.getRawOutput(), ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes()); + } + hgVcs.showMessageInConsole(result.getRawError(), ConsoleViewContentType.ERROR_OUTPUT.getAttributes()); + return result; } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java index 210ac7de88e2..7c429d2d400e 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java @@ -22,6 +22,7 @@ import org.zmlx.hg4idea.HgFile; import org.zmlx.hg4idea.HgRevisionNumber; import java.io.File; +import java.nio.charset.Charset; import java.util.*; public class HgStatusCommand { @@ -135,7 +136,7 @@ public class HgStatusCommand { arguments.add(file); } - HgCommandResult result = service.execute(repo, "status", arguments); + HgCommandResult result = service.execute(repo, HgCommandService.DEFAULT_OPTIONS, "status", arguments, Charset.defaultCharset(), true); Set changes = new HashSet(); HgChange previous = null; if (result == null) {