mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 736 B |
+20
-15
@@ -91,17 +91,29 @@ public class TestsLocationProviderUtil {
|
||||
fileName = pathComponent;
|
||||
}
|
||||
}
|
||||
if (fileName == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return findFilesClosestToTarget(folders, collectCandidates(project, fileName));
|
||||
}
|
||||
|
||||
//otherwise let's find all files with the same name and similar relative path
|
||||
final List<FileInfo> filesInfo = collectCandidates(project, fileName);
|
||||
/**
|
||||
* Looks for files with given name which are close to given path
|
||||
* @param targetParentFolders folders path
|
||||
* @param candidates
|
||||
* @return
|
||||
*/
|
||||
public static List<VirtualFile> findFilesClosestToTarget(@NotNull final List<String> targetParentFolders,
|
||||
final List<FileInfo> candidates) {
|
||||
// let's find all files with similar relative path
|
||||
|
||||
if (filesInfo.isEmpty()) {
|
||||
if (candidates.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// let's iterate relative path components and determine which files are closer to our relative path
|
||||
for (String folderName : folders) {
|
||||
for (FileInfo info : filesInfo) {
|
||||
for (String folderName : targetParentFolders) {
|
||||
for (FileInfo info : candidates) {
|
||||
info.processRelativePathComponent(folderName);
|
||||
}
|
||||
}
|
||||
@@ -110,7 +122,7 @@ public class TestsLocationProviderUtil {
|
||||
// we also assume that relative files and folders should have at least one common parent folder - just
|
||||
// to remove false positives on some cases
|
||||
int maxProximity = 0;
|
||||
for (FileInfo fileInfo : filesInfo) {
|
||||
for (FileInfo fileInfo : candidates) {
|
||||
final int proximity = fileInfo.getProximity();
|
||||
if (proximity > maxProximity) {
|
||||
maxProximity = proximity;
|
||||
@@ -119,7 +131,7 @@ public class TestsLocationProviderUtil {
|
||||
|
||||
if (maxProximity >= MIN_PROXIMITY_TRESHOLD) {
|
||||
final List<VirtualFile> files = new ArrayList<VirtualFile>();
|
||||
for (FileInfo info : filesInfo) {
|
||||
for (FileInfo info : candidates) {
|
||||
if (info.getProximity() == maxProximity) {
|
||||
files.add(info.getFile());
|
||||
}
|
||||
@@ -130,14 +142,7 @@ public class TestsLocationProviderUtil {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//private static int compare(final FileInfo info1, final FileInfo info2) {
|
||||
// final int proximity1 = info1.getProximity();
|
||||
// final int proximity2 = info2.getProximity();
|
||||
//
|
||||
// return proximity2 - proximity1;
|
||||
//}
|
||||
|
||||
private static List<FileInfo> collectCandidates(Project project, String fileName) {
|
||||
public static List<FileInfo> collectCandidates(Project project, String fileName) {
|
||||
final List<FileInfo> filesInfo = new ArrayList<FileInfo>();
|
||||
final ChooseByNameContributor[] contributors = Extensions.getExtensions(ChooseByNameContributor.FILE_EP_NAME);
|
||||
for (ChooseByNameContributor contributor : contributors) {
|
||||
|
||||
@@ -371,7 +371,7 @@ public class ChangeListWorker implements ChangeListsWriteOperations {
|
||||
|
||||
for (String name : myListsToDisappear) {
|
||||
final LocalChangeList changeList = myMap.get(name);
|
||||
if (changeList.getChanges().isEmpty()) {
|
||||
if (changeList.getChanges().isEmpty() && (! changeList.isReadOnly()) && (! changeList.isDefault())) {
|
||||
removeChangeList(name);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -529,7 +529,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
private final NewBaseSelector myNewBaseSelector;
|
||||
|
||||
private MapDirectory() {
|
||||
super("Map base directory", "Map base directory", IconLoader.getIcon("/actions/browser-externalJavaDoc.png"));
|
||||
super("Map base directory", "Map base directory", IconLoader.getIcon("/vcs/mapBase.png"));
|
||||
myNewBaseSelector = new NewBaseSelector();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,16 +24,14 @@ import com.intellij.openapi.vcs.annotate.AnnotationProvider;
|
||||
import com.intellij.openapi.vcs.annotate.FileAnnotation;
|
||||
import com.intellij.openapi.vcs.history.VcsFileRevision;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.svn.SvnBundle;
|
||||
import org.jetbrains.idea.svn.SvnVcs;
|
||||
import org.jetbrains.idea.svn.SvnConfiguration;
|
||||
import org.jetbrains.idea.svn.SvnUtil;
|
||||
import org.jetbrains.idea.svn.*;
|
||||
import org.jetbrains.idea.svn.history.SvnFileRevision;
|
||||
import org.tmatesoft.svn.core.*;
|
||||
import org.tmatesoft.svn.core.wc.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
public class SvnAnnotationProvider implements AnnotationProvider {
|
||||
@@ -44,15 +42,19 @@ public class SvnAnnotationProvider implements AnnotationProvider {
|
||||
}
|
||||
|
||||
public FileAnnotation annotate(final VirtualFile file) throws VcsException {
|
||||
return annotate(file, new SvnFileRevision(myVcs, SVNRevision.WORKING, SVNRevision.WORKING, null, null, null, null, null));
|
||||
return annotate(file, new SvnFileRevision(myVcs, SVNRevision.WORKING, SVNRevision.WORKING, null, null, null, null, null), true);
|
||||
}
|
||||
|
||||
public FileAnnotation annotate(final VirtualFile file, final VcsFileRevision revision) throws VcsException {
|
||||
return annotate(file, revision, false);
|
||||
}
|
||||
|
||||
private FileAnnotation annotate(final VirtualFile file, final VcsFileRevision revision, final boolean loadExternally) throws VcsException {
|
||||
if (file.isDirectory()) {
|
||||
throw new VcsException(SvnBundle.message("exception.text.cannot.annotate.directory"));
|
||||
}
|
||||
final FileAnnotation[] annotation = new FileAnnotation[1];
|
||||
final SVNException[] exception = new SVNException[1];
|
||||
final VcsException[] exception = new VcsException[1];
|
||||
|
||||
Runnable command = new Runnable() {
|
||||
public void run() {
|
||||
@@ -60,16 +62,22 @@ public class SvnAnnotationProvider implements AnnotationProvider {
|
||||
try {
|
||||
final File ioFile = new File(file.getPath()).getAbsoluteFile();
|
||||
|
||||
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
myVcs.createWCClient().doGetFileContents(ioFile, SVNRevision.UNDEFINED, SVNRevision.BASE, true, buffer);
|
||||
final String contents = LoadTextUtil.getTextByBinaryPresentation(buffer.toByteArray(), file, false).toString();
|
||||
final String contents;
|
||||
if (loadExternally) {
|
||||
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
myVcs.createWCClient().doGetFileContents(ioFile, SVNRevision.UNDEFINED, SVNRevision.BASE, true, buffer);
|
||||
contents = LoadTextUtil.getTextByBinaryPresentation(buffer.toByteArray(), file, false).toString();
|
||||
} else {
|
||||
revision.loadContent();
|
||||
contents = LoadTextUtil.getTextByBinaryPresentation(revision.getContent(), file, false).toString();
|
||||
}
|
||||
|
||||
final SvnFileAnnotation result = new SvnFileAnnotation(myVcs, file, contents);
|
||||
|
||||
SVNWCClient wcClient = myVcs.createWCClient();
|
||||
SVNInfo info = wcClient.doInfo(ioFile, SVNRevision.WORKING);
|
||||
if (info == null) {
|
||||
exception[0] = new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "File ''{0}'' is not under version control", ioFile));
|
||||
exception[0] = new VcsException(new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "File ''{0}'' is not under version control", ioFile)));
|
||||
return;
|
||||
}
|
||||
final String url = info.getURL() == null ? null : info.getURL().toString();
|
||||
@@ -129,7 +137,8 @@ public class SvnAnnotationProvider implements AnnotationProvider {
|
||||
};
|
||||
|
||||
final boolean supportsMergeinfo = SvnUtil.checkRepositoryVersion15(myVcs, url);
|
||||
client.doAnnotate(ioFile, SVNRevision.UNDEFINED, SVNRevision.create(0), endRevision, true, supportsMergeinfo, annotateHandler, null);
|
||||
final SVNRevision svnRevision = ((SvnRevisionNumber)revision.getRevisionNumber()).getRevision();
|
||||
client.doAnnotate(ioFile, svnRevision, SVNRevision.create(0), endRevision, true, supportsMergeinfo, annotateHandler, null);
|
||||
|
||||
client.doLog(new File[]{ioFile}, endRevision, SVNRevision.create(1), SVNRevision.UNDEFINED, false, false, supportsMergeinfo, 0, null,
|
||||
new ISVNLogEntryHandler() {
|
||||
@@ -145,6 +154,10 @@ public class SvnAnnotationProvider implements AnnotationProvider {
|
||||
annotation[0] = result;
|
||||
}
|
||||
catch (SVNException e) {
|
||||
exception[0] = new VcsException(e);
|
||||
} catch (IOException e) {
|
||||
exception[0] = new VcsException(e);
|
||||
} catch (VcsException e) {
|
||||
exception[0] = e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user