use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgCopyCommand method executeInCurrentThread.
public void executeInCurrentThread(VirtualFile source, VirtualFile target) {
VirtualFile sourceRepo = VcsUtil.getVcsRootFor(myProject, source);
VirtualFile targetRepo = VcsUtil.getVcsRootFor(myProject, target);
HgCommandExecutor executor = new HgCommandExecutor(myProject, VcsFileUtil.relativeOrFullPath(sourceRepo, source));
if (sourceRepo != null && targetRepo != null && sourceRepo.equals(targetRepo)) {
executor.executeInCurrentThread(sourceRepo, "copy", Arrays.asList("--after", VcsFileUtil.relativeOrFullPath(sourceRepo, source), VcsFileUtil.relativeOrFullPath(targetRepo, target)));
} else {
// copying from one repository to another => 'hg add' in new repo
if (targetRepo != null) {
new HgAddCommand(myProject).executeInCurrentThread(Collections.singleton(target));
}
}
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgGraftCommand method graft.
@Nullable
private HgCommandResult graft(@NotNull List<String> params) {
List<String> args = new ArrayList<>();
args.add("--log");
args.addAll(params);
AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(myRepository.getRoot(), "graft", args);
myRepository.update();
return result;
} finally {
token.finish();
}
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgLogCommand method execute.
@Nullable
public HgCommandResult execute(@NotNull VirtualFile repo, @NotNull String template, int limit, @Nullable HgFile hgFile, @Nullable List<String> argsForCmd) {
List<String> arguments = new LinkedList<>();
if (myIncludeRemoved) {
// for now, preferring to use --follow over --removed.
if (!(myFollowCopies && myLogFile)) {
arguments.add("--removed");
}
}
if (myFollowCopies) {
arguments.add("--follow");
//see http://selenic.com/pipermail/mercurial-devel/2013-May/051209.html fixed since 2.7
if (!myLargeFilesWithFollowSupported) {
arguments.add("--config");
arguments.add("extensions.largefiles=!");
}
}
arguments.add("--template");
arguments.add(template);
if (limit != -1) {
arguments.add("--limit");
arguments.add(String.valueOf(limit));
}
if (argsForCmd != null) {
arguments.addAll(argsForCmd);
}
if (myLogFile && hgFile != null) {
arguments.add(hgFile.getRelativePath());
}
HgCommandExecutor commandExecutor = new HgCommandExecutor(myProject);
commandExecutor.setOutputAlwaysSuppressed(true);
return commandExecutor.executeInCurrentThread(repo, "log", arguments);
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgRebaseCommand method performRebase.
@Nullable
private HgCommandResult performRebase(@NotNull String... args) {
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
final List<String> list = ContainerUtil.newArrayList(args);
list.add("--config");
list.add("extensions.rebase=");
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repo.getRoot(), "rebase", list);
repo.update();
return result;
} finally {
token.finish();
}
}
use of org.zmlx.hg4idea.execution.HgCommandExecutor in project intellij-community by JetBrains.
the class HgResolveCommand method getListSynchronously.
public Map<HgFile, HgResolveStatusEnum> getListSynchronously(VirtualFile repo) {
if (repo == null) {
return Collections.emptyMap();
}
final HgCommandExecutor executor = new HgCommandExecutor(myProject);
executor.setSilent(true);
final HgCommandResult result = executor.executeInCurrentThread(repo, "resolve", Collections.singletonList("--list"));
if (result == null) {
return Collections.emptyMap();
}
return handleResult(repo, result);
}
Aggregations