public void invalidate(final UpdatedFiles updatedFiles) { final Map<String, RemoteDifferenceStrategy> strategyMap; synchronized (myLock) { strategyMap = new HashMap<String, RemoteDifferenceStrategy>(myKinds); } final Collection<String> newForTree = new LinkedList<String>(); final Collection<String> newForUsual = new LinkedList<String>(); UpdateFilesHelper.iterateAffectedFiles( updatedFiles, new Consumer<Pair<String, String>>() { public void consume(final Pair<String, String> pair) { final String vcsName = pair.getSecond(); RemoteDifferenceStrategy strategy = strategyMap.get(vcsName); if (strategy == null) { final AbstractVcs vcs = myVcsManager.findVcsByName(vcsName); if (vcs == null) return; strategy = vcs.getRemoteDifferenceStrategy(); } if (RemoteDifferenceStrategy.ASK_TREE_PROVIDER.equals(strategy)) { newForTree.add(pair.getFirst()); } else { newForUsual.add(pair.getFirst()); } } }); myRemoteRevisionsStateCache.invalidate(newForTree); myRemoteRevisionsNumbersCache.invalidate(newForUsual); }
public void minus(Pair<String, AbstractVcs> pair) { final AbstractVcs vcs = pair.getSecond(); if (RemoteDifferenceStrategy.ASK_TREE_PROVIDER.equals(vcs.getRemoteDifferenceStrategy())) { myRemoteRevisionsStateCache.minus(pair); } else { myRemoteRevisionsNumbersCache.minus(pair); } }
/** @return false if not up to date */ public boolean isUpToDate(final Change change) { final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, myProject); if (vcs == null) return true; final RemoteDifferenceStrategy strategy = vcs.getRemoteDifferenceStrategy(); if (RemoteDifferenceStrategy.ASK_TREE_PROVIDER.equals(strategy)) { return myRemoteRevisionsStateCache.isUpToDate(change); } else { return myRemoteRevisionsNumbersCache.isUpToDate(change); } }