use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgQRenameCommand method performPatchRename.
public static void performPatchRename(@NotNull final HgRepository repository, @NotNull final String oldName, @NotNull final String newName) {
if (oldName.equals(newName))
return;
final Project project = repository.getProject();
new HgCommandExecutor(project).execute(repository.getRoot(), "qrename", Arrays.asList(oldName, newName), new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Qrename command failed", "Could not rename patch " + oldName + " to " + newName);
}
repository.update();
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgRevertTest method testRevertToCurrentRevision.
@Test
public void testRevertToCurrentRevision() throws Exception {
fillFile(myProjectDir, new String[] { "file.txt" }, "initial contents");
runHgOnProjectRepo("add", ".");
runHgOnProjectRepo("commit", "-m", "initial contents");
fillFile(myProjectDir, new String[] { "file.txt" }, "new contents");
HgRevertCommand revertCommand = new HgRevertCommand(myProject);
revertCommand.execute(myRepo.getDir(), Collections.singleton(new File(myProjectDir, "file.txt").getPath()), null, false);
HgCatCommand catCommand = new HgCatCommand(myProject);
HgCommandResult result = catCommand.execute(getHgFile("file.txt"), null, Charset.defaultCharset());
assertNotNull(result);
assertEquals(result.getRawOutput(), "initial contents");
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgRevertTest method testRevertToGivenRevision.
@Test
public void testRevertToGivenRevision() throws Exception {
fillFile(myProjectDir, new String[] { "file.txt" }, "initial contents");
runHgOnProjectRepo("add", ".");
runHgOnProjectRepo("commit", "-m", "initial contents");
fillFile(myProjectDir, new String[] { "file.txt" }, "new contents");
runHgOnProjectRepo("commit", "-m", "new contents");
HgRevertCommand revertCommand = new HgRevertCommand(myProject);
revertCommand.execute(myRepo.getDir(), Collections.singleton(new File(myProjectDir, "file.txt").getPath()), HgRevisionNumber.getLocalInstance("0"), false);
HgCatCommand catCommand = new HgCatCommand(myProject);
HgCommandResult result = catCommand.execute(getHgFile("file.txt"), HgRevisionNumber.getLocalInstance("0"), Charset.defaultCharset());
assertNotNull(result);
assertEquals(result.getRawOutput(), "initial contents");
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgAnnotateCommand method execute.
public List<HgAnnotationLine> execute(@NotNull HgFile hgFile, @Nullable HgRevisionNumber revision) {
final List<String> arguments = new ArrayList<>();
arguments.add("-cvnudl");
HgVcs vcs = HgVcs.getInstance(myProject);
if (vcs != null && vcs.getProjectSettings().isWhitespacesIgnoredInAnnotations() && vcs.getVersion().isIgnoreWhitespaceDiffInAnnotationsSupported()) {
arguments.add("-w");
}
if (revision != null) {
arguments.add("-r");
arguments.add(revision.getChangeset());
}
arguments.add(hgFile.getRelativePath());
final HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(hgFile.getRepo(), "annotate", arguments);
if (result == null) {
return Collections.emptyList();
}
List<String> outputLines = result.getOutputLines();
return parse(outputLines);
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgBookmarkCommand method executeBookmarkCommandSynchronously.
private static void executeBookmarkCommandSynchronously(@NotNull Project project, @NotNull VirtualFile repositoryRoot, @NotNull String name, @NotNull List<String> args) {
ArrayList<String> arguments = ContainerUtil.newArrayList(args);
arguments.add(name);
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repositoryRoot, "bookmark", arguments);
getRepositoryManager(project).updateRepository(repositoryRoot);
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", String.format("Hg bookmark command failed for repository %s with name %s ", repositoryRoot.getName(), name));
}
}
Aggregations