@NotNull
 @Override
 public Set<CommitId> getContainingBranches(@NotNull CommitId commit) {
   int commitIndex = myPermanentCommitsInfo.getNodeId(commit);
   return myPermanentCommitsInfo.convertToCommitIdSet(
       myReachableNodes.getContainingBranches(commitIndex, myBranchNodeIds));
 }
 @NotNull
 @Override
 public Condition<CommitId> getContainedInBranchCondition(
     @NotNull final Collection<CommitId> heads) {
   List<Integer> headIds =
       ContainerUtil.map(
           heads,
           new Function<CommitId, Integer>() {
             @Override
             public Integer fun(CommitId head) {
               return myPermanentCommitsInfo.getNodeId(head);
             }
           });
   if (!heads.isEmpty() && ContainerUtil.getFirstItem(heads) instanceof Integer) {
     final TIntHashSet branchNodes = new TIntHashSet();
     myReachableNodes.walk(
         headIds,
         new Consumer<Integer>() {
           @Override
           public void consume(Integer node) {
             branchNodes.add((Integer) myPermanentCommitsInfo.getCommitId(node));
           }
         });
     return new Condition<CommitId>() {
       @Override
       public boolean value(CommitId commitId) {
         return branchNodes.contains((Integer) commitId);
       }
     };
   } else {
     final Set<CommitId> branchNodes = ContainerUtil.newHashSet();
     myReachableNodes.walk(
         headIds,
         new Consumer<Integer>() {
           @Override
           public void consume(Integer node) {
             branchNodes.add(myPermanentCommitsInfo.getCommitId(node));
           }
         });
     return new Condition<CommitId>() {
       @Override
       public boolean value(CommitId commitId) {
         return branchNodes.contains(commitId);
       }
     };
   }
 }