Hash (@NotNull HgRepository repository, @NotNull String branchName) { // null for new branch or not heavy ref final LinkedHashSet<Hash> branchHashes = repository.getBranches().get(branchName); return branchHashes != null ? Objects.requireNonNull(Iterables.getLast(branchHashes)) : null; }