use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgCommitCommand method commitChunkFiles.
private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit, boolean withSubrepos, boolean closeBranch) throws VcsException {
List<String> parameters = new LinkedList<>();
parameters.add("--logfile");
parameters.add(saveCommitMessage().getAbsolutePath());
// note: for now mercurial could not perform amend commit with -S option
if (withSubrepos) {
parameters.add("-S");
parameters.addAll(mySubrepos);
} else if (amendCommit) {
parameters.add("--amend");
}
if (closeBranch) {
if (chunk.isEmpty() && myRepository.getState() != Repository.State.MERGING) {
//if there are changed files but nothing selected -> need to exclude all; if merge commit then nothing excluded
parameters.add("-X");
parameters.add("\"**\"");
}
parameters.add("--close-branch");
}
parameters.addAll(chunk);
HgCommandExecutor executor = new HgCommandExecutor(myProject);
ensureSuccess(executor.executeInCurrentThread(myRepository.getRoot(), "commit", parameters));
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgInitCommand method executeAsynchronously.
public void executeAsynchronously(@NotNull VirtualFile repositoryRoot, final HgCommandResultHandler resultHandler) {
final List<String> args = new ArrayList<>(1);
args.add(repositoryRoot.getPath());
final HgCommandExecutor executor = new HgCommandExecutor(myProject, repositoryRoot.getPath());
executor.setShowOutput(true);
executor.execute(null, "init", args, new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
resultHandler.process(result);
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgCatCommand method execute.
@Nullable
public HgCommandResult execute(@NotNull HgFile hgFile, @Nullable HgRevisionNumber vcsRevisionNumber, @Nullable Charset charset) {
final List<String> arguments = createArguments(vcsRevisionNumber, hgFile.getRelativePath());
final HgCommandExecutor executor = new HgCommandExecutor(myProject);
executor.setSilent(true);
executor.setOutputAlwaysSuppressed(true);
executor.setCharset(charset);
executor.setBinary(true);
return executor.executeInCurrentThread(hgFile.getRepo(), "cat", arguments);
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgChangesetsCommand method executeCommandInCurrentThread.
@Nullable
protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List<String> args) {
final HgCommandExecutor executor = new HgCommandExecutor(project);
executor.setSilent(isSilentCommand());
return executor.executeInCurrentThread(repo, command, args);
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgRemoveCommand method executeInCurrentThread.
/**
* Removes given files from their Mercurial repositories.
* @param hgFiles files to be removed.
*/
public void executeInCurrentThread(@NotNull Collection<HgFile> hgFiles) {
for (Map.Entry<VirtualFile, List<String>> entry : HgUtil.getRelativePathsByRepository(hgFiles).entrySet()) {
List<String> filePaths = entry.getValue();
for (List<String> chunkFiles : VcsFileUtil.chunkArguments(filePaths)) {
List<String> parameters = new LinkedList<>();
parameters.addAll(chunkFiles);
parameters.add(0, "--after");
new HgCommandExecutor(myProject).executeInCurrentThread(entry.getKey(), "remove", parameters);
}
}
}
Aggregations