@Override @Nullable public VcsDirectoryMapping getDirectoryMappingFor(final FilePath path) { VirtualFile vFile = ChangesUtil.findValidParentAccurately(path); if (vFile != null) { return myMappings.getMappingFor(vFile); } return null; }
@Override @Nullable public VirtualFile getVcsRootFor(@Nullable final VirtualFile file) { final VcsDirectoryMapping mapping = myMappings.getMappingFor(file); if (mapping == null) { return null; } final String directory = mapping.getDirectory(); if (directory.isEmpty()) { return myDefaultVcsRootPolicy.getVcsRootFor(file); } return LocalFileSystem.getInstance().findFileByPath(directory); }
@Override @Nullable public VcsRoot getVcsRootObjectFor(final VirtualFile file) { final VcsDirectoryMapping mapping = myMappings.getMappingFor(file); if (mapping == null) { return null; } final String directory = mapping.getDirectory(); final AbstractVcs vcs = findVcsByName(mapping.getVcs()); if (directory.isEmpty()) { return new VcsRoot(vcs, myDefaultVcsRootPolicy.getVcsRootFor(file)); } return new VcsRoot(vcs, LocalFileSystem.getInstance().findFileByPath(directory)); }
public boolean hasExplicitMapping(final VirtualFile vFile) { final VcsDirectoryMapping mapping = myMappings.getMappingFor(vFile); return mapping != null && !mapping.isDefaultMapping(); }