use of org.zmlx.hg4idea.command.HgOutgoingCommand in project intellij-community by JetBrains.
the class HgOutgoingCommitsProvider method getOutgoingCommits.
@NotNull
@Override
public OutgoingResult getOutgoingCommits(@NotNull final HgRepository repository, @NotNull final PushSpec<HgPushSource, HgTarget> pushSpec, boolean initial) {
final Project project = repository.getProject();
HgVcs hgvcs = HgVcs.getInstance(project);
assert hgvcs != null;
final HgVersion version = hgvcs.getVersion();
String[] templates = HgBaseLogParser.constructFullTemplateArgument(true, version);
HgOutgoingCommand hgOutgoingCommand = new HgOutgoingCommand(project);
HgTarget hgTarget = pushSpec.getTarget();
List<VcsError> errors = new ArrayList<>();
if (StringUtil.isEmptyOrSpaces(hgTarget.myTarget)) {
errors.add(new VcsError("Hg push path could not be empty."));
return new OutgoingResult(Collections.<VcsFullCommitDetails>emptyList(), errors);
}
HgCommandResult result = hgOutgoingCommand.execute(repository.getRoot(), HgChangesetUtil.makeTemplate(templates), pushSpec.getSource().getPresentation(), hgTarget.myTarget, initial);
if (result == null) {
errors.add(new VcsError("Couldn't execute hg outgoing command for " + repository));
return new OutgoingResult(Collections.<VcsFullCommitDetails>emptyList(), errors);
}
List<String> resultErrors = result.getErrorLines();
if (resultErrors != null && !resultErrors.isEmpty() && result.getExitValue() != 0) {
for (String error : resultErrors) {
if (HgErrorUtil.isAbortLine(error)) {
if (HgErrorUtil.isAuthorizationError(error)) {
VcsError authorizationError = new VcsError(error + "<a href='authenticate'>" + LOGIN_AND_REFRESH_LINK + "</a>", new VcsErrorHandler() {
public void handleError(@NotNull CommitLoader commitLoader) {
commitLoader.reloadCommits();
}
});
errors.add(authorizationError);
} else {
errors.add(new VcsError(error));
}
}
}
LOG.warn(resultErrors.toString());
}
return new OutgoingResult(HgHistoryUtil.createFullCommitsFromResult(project, repository.getRoot(), result, version, true), errors);
}
use of org.zmlx.hg4idea.command.HgOutgoingCommand in project intellij-community by JetBrains.
the class HgRemoteStatusUpdater method updateChangesStatusSynchronously.
private void updateChangesStatusSynchronously(Project project, VirtualFile[] roots, HgChangesetStatus status, boolean incoming) {
if (!myProjectSettings.isCheckIncomingOutgoing())
return;
final List<HgRevisionNumber> changesets = new LinkedList<>();
for (VirtualFile root : roots) {
if (incoming) {
changesets.addAll(new HgIncomingCommand(project).executeInCurrentThread(root));
} else {
changesets.addAll(new HgOutgoingCommand(project).executeInCurrentThread(root));
}
}
status.setChanges(changesets.size(), new ChangesetFormatter(status, changesets));
}
Aggregations