mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Mercurial] IDEA-56034. Logging to the Version Control console.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
<orderEntry type="module" module-name="platform-api" />
|
||||
<orderEntry type="module" module-name="vcs-impl" />
|
||||
<orderEntry type="module" module-name="platform-impl" />
|
||||
<orderEntry type="module" module-name="lang-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -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<CommittedChangeList> {
|
||||
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<CommittedChangeList> {
|
||||
public HgGlobalSettings getGlobalSettings() {
|
||||
return globalSettings;
|
||||
}
|
||||
|
||||
public void showMessageInConsole(String message, final TextAttributes style) {
|
||||
myVcsManager.addMessageToConsoleWindow(message, style);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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<String> DEFAULT_OPTIONS = Arrays.asList(
|
||||
static final List<String> DEFAULT_OPTIONS = Arrays.asList(
|
||||
"--config", "ui.merge=internal:merge"
|
||||
);
|
||||
|
||||
@@ -77,6 +79,11 @@ public final class HgCommandService {
|
||||
@Nullable
|
||||
HgCommandResult execute(VirtualFile repo, List<String> hgOptions,
|
||||
String operation, List<String> arguments, Charset charset) {
|
||||
return execute(repo, hgOptions, operation, arguments, charset, false);
|
||||
}
|
||||
|
||||
HgCommandResult execute(VirtualFile repo, List<String> hgOptions,
|
||||
String operation, List<String> 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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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<HgChange> changes = new HashSet<HgChange>();
|
||||
HgChange previous = null;
|
||||
if (result == null) {
|
||||
|
||||
Reference in New Issue
Block a user