diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java index e06c149fac70..530f2f2f7cff 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java @@ -281,18 +281,12 @@ public class PushController implements Disposable { } private boolean isPushAllowed(@NotNull PushSupport pushSupport) { - if (mySingleRepoProject) { - MyRepoModel repoModel = ContainerUtil.getFirstItem(myView2Model.values()); - assert repoModel != null; - return hasSomethingToPush(myView2Model.keySet()) || - !repoModel.getLoadedCommits().isEmpty() || - myDialog.getAdditionalOptionValue(pushSupport) != null; - } Collection nodes = getNodesForSupport(pushSupport); - if (pushSupport.getRepositoryManager().isSyncEnabled()) { - return hasSomethingToPush(nodes) || (hasCheckedNode(nodes) && allNodesAreLoaded(nodes)); + if (hasSomethingToPush(nodes)) return true; + if (hasCheckedNodesWithContent(nodes, myDialog.getAdditionalOptionValue(pushSupport) != null)) { + return !pushSupport.getRepositoryManager().isSyncEnabled() || allNodesAreLoaded(nodes); } - return hasSomethingToPush(nodes) || (hasCheckedNode(nodes)); + return false; } private boolean hasSomethingToPush(Collection nodes) { @@ -306,11 +300,11 @@ public class PushController implements Disposable { }); } - private static boolean hasCheckedNode(@NotNull Collection nodes) { + private boolean hasCheckedNodesWithContent(@NotNull Collection nodes, final boolean withRefs) { return ContainerUtil.exists(nodes, new Condition() { @Override public boolean value(@NotNull RepositoryNode node) { - return node.isChecked(); + return node.isChecked() && (withRefs || !myView2Model.get(node).getLoadedCommits().isEmpty()); } }); } @@ -362,7 +356,7 @@ public class PushController implements Disposable { boolean shouldBeSelected; if (!errors.isEmpty()) { shouldBeSelected = false; - model.setLoadedCommits(outgoing.getCommits()); + model.setLoadedCommits(ContainerUtil.emptyList()); myPushLog.setChildren(node, ContainerUtil.map(errors, new Function() { @Override public DefaultMutableTreeNode fun(final VcsError error) {