boolean (@Nullable String name) { Collection<String> branches = myRepository.getBranches().keySet(); String currentBranch = myRepository.getCurrentBranch(); // branches set doesn't contain uncommitted branch -> need an addition check myErrorText = currentBranch.equals(name) || branches.contains(name) ? HgBundle.message("hg4idea.branch.duplicated.name.error", name) : null; return myErrorText != null; }