private @NotNull Map<HgRepository, Set<HgFile>> getFilesByRepository(List<? extends Change> changes) {
    Map<HgRepository, Set<HgFile>> result = new HashMap<>();
    for (Change change : changes) {
      ContentRevision afterRevision = change.getAfterRevision();
      ContentRevision beforeRevision = change.getBeforeRevision();

      if (afterRevision != null) {
        addFile(result, afterRevision);
      }
      if (beforeRevision != null) {
        addFile(result, beforeRevision);
      }
    }
    return result;
  }
private @NotNull Map<HgRepository, Set<HgFile>> getFilesByRepository(List<? extends Change> changes)