From b3b079fbe218fcc3f75f4926e908ca19ef2773e8 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 11 Jul 2013 15:16:39 +0400 Subject: [PATCH] Revert "[git] Fix equals & hashcode for GitRepoInfo" This reverts commit b612a915b063e8c70069f9d38b2acf05c34399f7. Better fix will follow --- .../src/git4idea/repo/GitRepoInfo.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/plugins/git4idea/src/git4idea/repo/GitRepoInfo.java b/plugins/git4idea/src/git4idea/repo/GitRepoInfo.java index 489d895e32ed..5e71115b5aa3 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepoInfo.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepoInfo.java @@ -16,7 +16,6 @@ package git4idea.repo; import com.intellij.dvcs.repo.Repository; -import com.intellij.openapi.util.Comparing; import git4idea.GitLocalBranch; import git4idea.GitRemoteBranch; import org.jetbrains.annotations.NotNull; @@ -94,10 +93,10 @@ public class GitRepoInfo { if (myState != info.myState) return false; if (myCurrentRevision != null ? !myCurrentRevision.equals(info.myCurrentRevision) : info.myCurrentRevision != null) return false; if (myCurrentBranch != null ? !myCurrentBranch.equals(info.myCurrentBranch) : info.myCurrentBranch != null) return false; - if (!Comparing.haveEqualElements(myRemotes, info.myRemotes)) return false; - if (!Comparing.haveEqualElements(myBranchTrackInfos, info.myBranchTrackInfos)) return false; - if (!Comparing.haveEqualElements(myLocalBranches, info.myLocalBranches)) return false; - if (!Comparing.haveEqualElements(myRemoteBranches, info.myRemoteBranches)) return false; + if (!myRemotes.equals(info.myRemotes)) return false; + if (!myBranchTrackInfos.equals(info.myBranchTrackInfos)) return false; + if (!myLocalBranches.equals(info.myLocalBranches)) return false; + if (!myRemoteBranches.equals(info.myRemoteBranches)) return false; return true; } @@ -107,21 +106,13 @@ public class GitRepoInfo { int result = myCurrentBranch != null ? myCurrentBranch.hashCode() : 0; result = 31 * result + (myCurrentRevision != null ? myCurrentRevision.hashCode() : 0); result = 31 * result + myState.hashCode(); - result = 31 * result + hashCodeForCollectionComparison(myRemotes); - result = 31 * result + hashCodeForCollectionComparison(myLocalBranches); - result = 31 * result + hashCodeForCollectionComparison(myRemoteBranches); - result = 31 * result + hashCodeForCollectionComparison(myBranchTrackInfos); + result = 31 * result + myRemotes.hashCode(); + result = 31 * result + myLocalBranches.hashCode(); + result = 31 * result + myRemoteBranches.hashCode(); + result = 31 * result + myBranchTrackInfos.hashCode(); return result; } - private static int hashCodeForCollectionComparison(@NotNull Collection collection) { - int i = 0; - for (T element : collection) { - i += element.hashCode(); - } - return i; - } - @Override public String toString() { return String.format("GitRepoInfo{current=%s, remotes=%s, localBranches=%s, remoteBranches=%s, trackInfos=%s}",