/** * Returns real working copies roots - if there is <Project Root> -> Subversion setting, and there * is one working copy, will return one root */ public List<WCInfo> getAllWcInfos() { final SvnFileUrlMapping urlMapping = getSvnFileUrlMapping(); final List<RootUrlInfo> infoList = urlMapping.getAllWcInfos(); final List<WCInfo> infos = new ArrayList<WCInfo>(); for (RootUrlInfo info : infoList) { final File file = info.getIoFile(); infos.add( new WCInfo( file.getAbsolutePath(), info.getAbsoluteUrlAsUrl(), info.getFormat(), info.getRepositoryUrl(), SvnUtil.isWorkingCopyRoot(file), info.getType(), SvnUtil.getDepth(this, file))); } return infos; }
@Override public <S> List<S> filterUniqueRoots( final List<S> in, final Convertor<S, VirtualFile> convertor) { if (in.size() <= 1) return in; final List<MyPair<S>> infos = new ArrayList<MyPair<S>>(in.size()); final SvnFileUrlMappingImpl mapping = (SvnFileUrlMappingImpl) getSvnFileUrlMapping(); final List<S> notMatched = new LinkedList<S>(); for (S s : in) { final VirtualFile vf = convertor.convert(s); if (vf == null) continue; final File ioFile = new File(vf.getPath()); SVNURL url = mapping.getUrlForFile(ioFile); if (url == null) { url = SvnUtil.getUrl(this, ioFile); if (url == null) { notMatched.add(s); continue; } } infos.add(new MyPair<S>(vf, url.toString(), s)); } final List<MyPair<S>> filtered = new ArrayList<MyPair<S>>(infos.size()); ForNestedRootChecker.filterOutSuperfluousChildren(this, infos, filtered); final List<S> converted = ObjectsConvertor.convert( filtered, new Convertor<MyPair<S>, S>() { @Override public S convert(final MyPair<S> o) { return o.getSrc(); } }); if (!notMatched.isEmpty()) { // potential bug is here: order is not kept. but seems it only occurs for cases where result // is sorted after filtering so ok converted.addAll(notMatched); } return converted; }
@Override public boolean isVersionedDirectory(final VirtualFile dir) { return SvnUtil.seemsLikeVersionedDir(dir); }