style, rename

This commit is contained in:
Nadya Zabrodina
2014-08-18 19:21:29 +04:00
parent e77f77c416
commit be3ba0754a
6 changed files with 26 additions and 18 deletions
@@ -38,8 +38,4 @@ public class OutgoingResult {
public List<? extends VcsFullCommitDetails> getCommits() {
return myCommits;
}
public boolean hasErrors() {
return !myErrors.isEmpty();
}
}
@@ -15,9 +15,12 @@
*/
package com.intellij.dvcs.push;
import org.jetbrains.annotations.NotNull;
/**
* Source to push from. For example, local branch for git or branch/bookmark for mercurial.
*/
public interface PushSource {
@NotNull
String getPresentation();
}
@@ -198,14 +198,15 @@ public class PushController implements Disposable {
@Override
public void onSuccess() {
OutgoingResult outgoing = result.get();
if (outgoing.hasErrors()) {
List<VcsError> errors = outgoing.getErrors();
if (errors.isEmpty()) {
final CommitLoader loader = new CommitLoader() {
@Override
public void reloadCommits() {
loadCommits(model, node, false);
}
};
myPushLog.setChildren(node, ContainerUtil.map(outgoing.getErrors(), new Function<VcsError, DefaultMutableTreeNode>() {
myPushLog.setChildren(node, ContainerUtil.map(errors, new Function<VcsError, DefaultMutableTreeNode>() {
@Override
public DefaultMutableTreeNode fun(final VcsError error) {
VcsLinkedText errorLinkText = new VcsLinkedText(error.getText(), new VcsLinkListener() {
@@ -16,16 +16,23 @@
package org.zmlx.hg4idea.push;
import com.intellij.dvcs.push.PushSource;
import org.jetbrains.annotations.NotNull;
public class HgSource implements PushSource {
String mySource;
public class HgPushSource implements PushSource {
@NotNull private String myBranch;
public HgSource(String branch) {
mySource = branch;
public HgPushSource(@NotNull String branch) {
myBranch = branch;
}
@NotNull
@Override
public String getPresentation() {
return mySource;
return myBranch;
}
@NotNull
public String getBranch() {
return myBranch; // presentation may differ from branch
}
}
@@ -80,9 +80,9 @@ public class HgPushSupport extends PushSupport<HgRepository> {
@NotNull
@Override
public HgSource getSource(@NotNull HgRepository repository) {
public HgPushSource getSource(@NotNull HgRepository repository) {
String localBranch = HgUtil.getActiveBranchName(repository);
return new HgSource(localBranch);
return new HgPushSource(localBranch);
}
@Override
@@ -57,21 +57,22 @@ public class HgPusher extends Pusher {
if (destination == null) {
continue;
}
HgSource source = (HgSource)hgSpec.getSource();
HgPushSource source = (HgPushSource)hgSpec.getSource();
Project project = repository.getProject();
final HgPushCommand pushCommand = new HgPushCommand(project, repository.getRoot(), destination.myTarget);
pushCommand.setIsNewBranch(true); // set always true, because it just allow mercurial to create a new one if needed
pushCommand.setForce(force);
if (source.mySource.equals(hgRepository.getCurrentBookmark())) {
String branchName = source.getBranch();
if (branchName.equals(hgRepository.getCurrentBookmark())) {
if (vcsPushOptionValue == HgVcsPushOptionValue.Current) {
pushCommand.setBookmarkName(source.mySource);
pushCommand.setBookmarkName(branchName);
}
else {
pushCommand.setRevision(source.mySource);
pushCommand.setRevision(branchName);
}
}
else {
pushCommand.setBranchName(source.mySource);
pushCommand.setBranchName(branchName);
}
push(project, pushCommand);
}