This commit is contained in:
Nadya Zabrodina
2014-02-28 12:20:44 +04:00
parent 00e2508e86
commit e79dc61217
4 changed files with 18 additions and 14 deletions
@@ -175,7 +175,7 @@ public abstract class DvcsCommitAdditionalComponent implements RefreshableOnComp
}
@NotNull
protected abstract Set<VirtualFile> getVcsRoots(Collection<FilePath> files);
protected abstract Set<VirtualFile> getVcsRoots(@NotNull Collection<FilePath> files);
@Nullable
protected abstract String getLastCommitMessage(@NotNull VirtualFile repo) throws VcsException;
@@ -649,7 +649,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
@Override
@NotNull
protected Set<VirtualFile> getVcsRoots(Collection<FilePath> filePaths) {
protected Set<VirtualFile> getVcsRoots(@NotNull Collection<FilePath> filePaths) {
return GitUtil.gitRoots(filePaths);
}
@@ -675,12 +675,14 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
return NewGitUsersComponent.getInstance(project).get();
}
@Override
public void refresh() {
super.refresh();
myAuthor.setSelectedItem("");
reset();
}
@Override
public void saveState() {
String author = (String)myAuthor.getEditor().getItem();
myNextCommitAuthor = author.length() == 0 ? null : author;
@@ -695,6 +697,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
myNextCommitAuthorDate = myAuthorDate;
}
@Override
public void restoreState() {
refresh();
}
@@ -264,31 +264,33 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
public HgCommitAdditionalComponent(@NotNull Project project, @NotNull CheckinProjectPanel panel) {
super(project, panel);
HgVcs myVcs = HgVcs.getInstance(myProject);
if (myVcs != null && !myVcs.getVersion().isAmendSupported()) {
myAmend.setEnabled(false);
}
myAmend.setEnabled(myVcs != null && myVcs.getVersion().isAmendSupported());
}
@Override
public void refresh() {
super.refresh();
myNextCommitAmend = false;
}
@Override
public void saveState() {
myNextCommitAmend = myAmend.isSelected();
}
@Override
public void restoreState() {
myNextCommitAmend = false;
}
@NotNull
@Override
protected Set<VirtualFile> getVcsRoots(Collection<FilePath> filePaths) {
protected Set<VirtualFile> getVcsRoots(@NotNull Collection<FilePath> filePaths) {
return HgUtil.hgRoots(myProject, filePaths);
}
@Nullable
@Override
protected String getLastCommitMessage(@NotNull VirtualFile repo) throws VcsException {
HgCommandExecutor commandExecutor = new HgCommandExecutor(myProject);
List<String> args = new ArrayList<String>();
@@ -40,6 +40,7 @@ import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.impl.status.StatusBarUtil;
import com.intellij.ui.GuiUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -244,17 +245,15 @@ public abstract class HgUtil {
* Get hg roots for paths
*
* @param filePaths the context paths
* @return a set of git roots
* @return a set of hg roots
*/
public static Set<VirtualFile> hgRoots(@NotNull Project project, final Collection<FilePath> filePaths) {
HashSet<VirtualFile> rc = new HashSet<VirtualFile>();
@NotNull
public static Set<VirtualFile> hgRoots(@NotNull Project project, @NotNull Collection<FilePath> filePaths) {
HashSet<VirtualFile> roots = new HashSet<VirtualFile>();
for (FilePath path : filePaths) {
final VirtualFile root = getHgRootOrNull(project, path);
if (root != null) {
rc.add(root);
}
ContainerUtil.addIfNotNull(roots, getHgRootOrNull(project, path));
}
return rc;
return roots;
}
/**