void (Map<HgRepository, Set<HgFile>> result, ContentRevision contentRevision) { FilePath filePath = contentRevision.getFile(); // try to find repository from hgFile from change: to be able commit sub repositories as expected HgRepository repo = HgUtil.getRepositoryForFile(myProject, contentRevision instanceof HgCurrentBinaryContentRevision ? ((HgCurrentBinaryContentRevision)contentRevision).getRepositoryRoot() : ChangesUtil.findValidParentAccurately(filePath)); if (repo == null) { return; } Set<HgFile> hgFiles = result.get(repo); if (hgFiles == null) { hgFiles = new HashSet<>(); result.put(repo, hgFiles); } hgFiles.add(new HgFile(repo.getRoot(), filePath)); }