IDEA-107677 Incorrect displaing branch in case of multi heads

*Branch storage collection changed to set to avoid storage multi branches with different hashes.
This commit is contained in:
Nadya Zabrodina
2013-06-10 16:04:10 +04:00
parent 90c6204348
commit 7dcc3adee1
2 changed files with 8 additions and 7 deletions
@@ -26,8 +26,8 @@ import org.jetbrains.annotations.NotNull;
import org.zmlx.hg4idea.HgVcs;
import org.zmlx.hg4idea.util.HgUtil;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
@@ -40,7 +40,7 @@ public class HgRepositoryImpl extends RepositoryImpl implements HgRepository {
@NotNull private final VirtualFile myHgDir;
@NotNull private volatile String myCurrentBranch = DEFAULT_BRANCH;
@NotNull private volatile List<String> myBranches = Collections.emptyList();
@NotNull private volatile Collection<String> myBranches = Collections.emptySet();
private boolean myIsFresh = true;
@@ -84,7 +84,7 @@ public class HgRepositoryImpl extends RepositoryImpl implements HgRepository {
@Override
@NotNull
public List<String> getBranches() {
public Collection<String> getBranches() {
return myBranches;
}
@@ -22,8 +22,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -77,8 +78,8 @@ public class HgRepositoryReader {
}
@NotNull
public List<String> readBranches() {
List<String> branches = new ArrayList<String>();
public Collection<String> readBranches() {
Set<String> branches = new HashSet<String>();
if (!checkIsFresh()) {
String[] branchesWithHeads = RepositoryUtil.tryLoadFile(myBranchHeadsFile).split("\n");
// first one - is a head revision: head hash + head number;