Merge remote-tracking branch 'origin/master'

This commit is contained in:
anna
2012-07-27 13:55:36 +02:00
6 changed files with 23 additions and 11 deletions
@@ -32,8 +32,6 @@ public class PsiParameterListStubImpl extends StubBase<PsiParameterList> impleme
@SuppressWarnings({"HardCodedStringLiteral"})
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("PsiParameterListStub");
return builder.toString();
return "PsiParameterListStub";
}
}
@@ -45,11 +45,18 @@ public abstract class ReferenceProvidersRegistry {
public abstract PsiReferenceRegistrar getRegistrar(Language language);
/**
* @see #getReferencesFromProviders(com.intellij.psi.PsiElement)
*/
@Deprecated
public static PsiReference[] getReferencesFromProviders(PsiElement context, @NotNull Class clazz) {
return getReferencesFromProviders(context, PsiReferenceService.Hints.NO_HINTS);
}
public static PsiReference[] getReferencesFromProviders(PsiElement context) {
return getReferencesFromProviders(context, PsiReferenceService.Hints.NO_HINTS);
}
public static PsiReference[] getReferencesFromProviders(PsiElement context, @NotNull PsiReferenceService.Hints hints) {
ProgressIndicatorProvider.checkCanceled();
assert context.isValid() : "Invalid context: " + context;
@@ -405,7 +405,7 @@ public final class GitBranchOperationsProcessor {
@NotNull
private static Collection<Change> loadTotalDiff(@NotNull GitRepository repository, @NotNull String branchName) {
try {
return GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), "HEAD", branchName);
return GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), "HEAD", branchName, null);
}
catch (VcsException e) {
// we treat it as critical and report an error
@@ -413,7 +413,8 @@ public class GitChangeUtils {
@NotNull
public static Collection<Change> getDiff(@NotNull Project project, @NotNull VirtualFile root,
@NotNull String oldRevision, @Nullable String newRevision) throws VcsException {
@NotNull String oldRevision, @Nullable String newRevision,
@Nullable Collection<FilePath> dirtyPaths) throws VcsException {
String range;
GitRevisionNumber newRev;
if (newRevision == null) {
@@ -425,7 +426,7 @@ public class GitChangeUtils {
range = oldRevision + ".." + newRevision;
newRev = loadRevision(project, root, newRevision);
}
String output = getDiffOutput(project, root, range, null);
String output = getDiffOutput(project, root, range, dirtyPaths);
Collection<Change> changes = new ArrayList<Change>();
parseChanges(project, root, newRev, loadRevision(project, root, oldRevision), output, changes, Collections.<String>emptySet());
@@ -32,7 +32,10 @@ import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ui.ChangesBrowser;
import com.intellij.openapi.vcs.history.*;
import com.intellij.openapi.vcs.history.CurrentRevision;
import com.intellij.openapi.vcs.history.DiffFromHistoryHandler;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsHistoryUtil;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.awt.RelativePoint;
@@ -52,6 +55,7 @@ import org.jetbrains.annotations.Nullable;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -118,7 +122,7 @@ public class GitDiffFromHistoryHandler implements DiffFromHistoryHandler {
private void showDiffForDirectory(@NotNull final FilePath path, @NotNull final String hash1, @Nullable final String hash2) {
GitRepository repository = getRepository(path);
calculateDiffInBackground(repository, hash1, hash2, new Consumer<List<Change>>() {
calculateDiffInBackground(repository, path, hash1, hash2, new Consumer<List<Change>>() {
@Override
public void consume(List<Change> changes) {
showDirDiffDialog(path, hash1, hash2, changes);
@@ -135,14 +139,16 @@ public class GitDiffFromHistoryHandler implements DiffFromHistoryHandler {
return repository;
}
private void calculateDiffInBackground(@NotNull final GitRepository repository, final String hash1, @Nullable final String hash2,
private void calculateDiffInBackground(@NotNull final GitRepository repository, @NotNull final FilePath path,
@NotNull final String hash1, @Nullable final String hash2,
final Consumer<List<Change>> successHandler) {
new Task.Backgroundable(myProject, "Comparing revisions...") {
private List<Change> myChanges;
@Override
public void run(@NotNull ProgressIndicator indicator) {
try {
myChanges = new ArrayList<Change>(GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), hash1, hash2));
myChanges = new ArrayList<Change>(GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), hash1, hash2,
Collections.singletonList(path)));
}
catch (VcsException e) {
showError(e, "Error during requesting diff for directory");
@@ -238,7 +238,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype {
};
}
final PsiReference[] referencesFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlDoctype.class);
final PsiReference[] referencesFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this);
return ArrayUtil.mergeArrays(
uriRefs != null? uriRefs: PsiReference.EMPTY_ARRAY,