mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-83024 Show all affected files failed at SVN History window
This commit is contained in:
@@ -64,4 +64,6 @@ public interface CommittedChangesProvider<T extends CommittedChangeList, U exten
|
||||
*/
|
||||
@Nullable
|
||||
Pair<T, FilePath> getOneList(final VirtualFile file, final VcsRevisionNumber number) throws VcsException;
|
||||
|
||||
RepositoryLocation getForNonLocal(final VirtualFile file);
|
||||
}
|
||||
|
||||
+34
-4
@@ -34,6 +34,8 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author irengrig
|
||||
* Date: 3/16/11
|
||||
@@ -60,6 +62,7 @@ public class ShowAllAffectedGenericAction extends AnAction {
|
||||
public static void showSubmittedFiles(final Project project, final VcsRevisionNumber revision, final VirtualFile virtualFile, final VcsKey vcsKey) {
|
||||
final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).findVcsByName(vcsKey.getName());
|
||||
if (vcs == null) return;
|
||||
if (! isInLocalFSHack(virtualFile) && ! canPresentNonLocal(project, vcsKey, virtualFile)) return;
|
||||
|
||||
final String title = VcsBundle.message("paths.affected.in.revision",
|
||||
revision instanceof ShortVcsRevisionNumber
|
||||
@@ -71,9 +74,20 @@ public class ShowAllAffectedGenericAction extends AnAction {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
try {
|
||||
final Pair<CommittedChangeList, FilePath> pair = vcs.getCommittedChangesProvider().getOneList(virtualFile, revision);
|
||||
if (pair != null) {
|
||||
list[0] = pair.getFirst();
|
||||
final CommittedChangesProvider provider = vcs.getCommittedChangesProvider();
|
||||
if (isInLocalFSHack(virtualFile)) {
|
||||
final Pair<CommittedChangeList, FilePath> pair = provider.getOneList(virtualFile, revision);
|
||||
if (pair != null) {
|
||||
list[0] = pair.getFirst();
|
||||
}
|
||||
} else {
|
||||
final RepositoryLocation local = provider.getForNonLocal(virtualFile);
|
||||
if (local != null) {
|
||||
final List<CommittedChangeList> changes = provider.getCommittedChanges(provider.createDefaultSettings(), local, 1);
|
||||
if (changes != null && changes.size() == 1) {
|
||||
list[0] = changes.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (VcsException e) {
|
||||
@@ -95,6 +109,12 @@ public class ShowAllAffectedGenericAction extends AnAction {
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean isInLocalFSHack(final VirtualFile vf) {
|
||||
if (vf.isInLocalFileSystem()) return true;
|
||||
final String url = vf.getPresentableUrl();
|
||||
return ! url.contains("://") && ! url.contains(":\\\\");
|
||||
}
|
||||
|
||||
private static String failedText(VirtualFile virtualFile, VcsRevisionNumber revision) {
|
||||
return "Show all affected files for " + virtualFile.getPath() + " at " + revision.asString() + " failed";
|
||||
}
|
||||
@@ -108,6 +128,16 @@ public class ShowAllAffectedGenericAction extends AnAction {
|
||||
return;
|
||||
}
|
||||
final VirtualFile revisionVirtualFile = e.getData(VcsDataKeys.VCS_VIRTUAL_FILE);
|
||||
e.getPresentation().setEnabled((e.getData(VcsDataKeys.VCS_FILE_REVISION) != null) && (revisionVirtualFile != null));
|
||||
boolean enabled = (e.getData(VcsDataKeys.VCS_FILE_REVISION) != null) && (revisionVirtualFile != null);
|
||||
enabled = enabled && (isInLocalFSHack(revisionVirtualFile) || canPresentNonLocal(project, vcsKey, revisionVirtualFile));
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
|
||||
private static boolean canPresentNonLocal(Project project, VcsKey key, final VirtualFile file) {
|
||||
final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).findVcsByName(key.getName());
|
||||
if (vcs == null) return false;
|
||||
final CommittedChangesProvider provider = vcs.getCommittedChangesProvider();
|
||||
if (provider == null) return false;
|
||||
return provider.getForNonLocal(file) != null;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -161,6 +161,11 @@ public class CompositeCommittedChangesProvider implements CommittedChangesProvid
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryLocation getForNonLocal(VirtualFile file) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static class CompositeChangeBrowserSettings extends ChangeBrowserSettings {
|
||||
private final Map<AbstractVcs, ChangeBrowserSettings> myMap;
|
||||
private final Set<AbstractVcs> myEnabledVcs = new HashSet<AbstractVcs>();
|
||||
|
||||
+5
@@ -207,6 +207,11 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
return new Pair<CvsChangeList, FilePath>(result.get(), filePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryLocation getForNonLocal(VirtualFile file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CvsChangeList> getCommittedChanges(ChangeBrowserSettings settings, RepositoryLocation location, final int maxCount)
|
||||
throws VcsException {
|
||||
final CvsRepositoryLocation cvsLocation = (CvsRepositoryLocation) location;
|
||||
|
||||
@@ -266,6 +266,11 @@ public class GitCommittedChangeListProvider implements CommittedChangesProvider<
|
||||
return new Pair<CommittedChangeList, FilePath>(commit, ((GitFileRevision) history.get(history.size() - 1)).getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryLocation getForNonLocal(VirtualFile file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getFormatVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -286,4 +286,9 @@ public class HgCachingCommitedChangesProvider
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryLocation getForNonLocal(VirtualFile file) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ContentRevision;
|
||||
@@ -33,6 +34,7 @@ import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings;
|
||||
import com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor;
|
||||
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.AsynchConsumer;
|
||||
import com.intellij.util.Consumer;
|
||||
@@ -563,6 +565,12 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
|
||||
return new Pair<SvnChangeList, FilePath>(result[0], new FilePathImpl(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepositoryLocation getForNonLocal(VirtualFile file) {
|
||||
final String url = file.getPresentableUrl();
|
||||
return new SvnRepositoryLocation(FileUtil.toSystemIndependentName(url));
|
||||
}
|
||||
|
||||
private static class RenameContext {
|
||||
@NotNull
|
||||
private String myCurrentPath;
|
||||
|
||||
@@ -619,10 +619,10 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto
|
||||
super(vcs, url, pegRevision, lastPath, result, repoRootURL, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
protected SvnFileRevision createRevision(final SVNLogEntry logEntry, final String copyPath) {
|
||||
return new SvnFileRevision(myVcs, SVNRevision.UNDEFINED, logEntry, myUrl, copyPath, null);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private class MergeSourceColumnInfo extends ColumnInfo<VcsFileRevision, VcsFileRevision> {
|
||||
|
||||
Reference in New Issue
Block a user