use of org.jetbrains.idea.svn.properties.PropertyClient in project intellij-community by JetBrains.
the class SvnVcs method getPropertyWithCaching.
@Nullable
public PropertyValue getPropertyWithCaching(final VirtualFile file, final String propName) throws VcsException {
Map<String, Pair<PropertyValue, Trinity<Long, Long, Long>>> cachedMap = myPropertyCache.get(keyForVf(file));
final Pair<PropertyValue, Trinity<Long, Long, Long>> cachedValue = cachedMap == null ? null : cachedMap.get(propName);
final File ioFile = virtualToIoFile(file);
final Trinity<Long, Long, Long> tsTrinity = getTimestampForPropertiesChange(ioFile, file.isDirectory());
if (cachedValue != null) {
// zero means that a file was not found
if (trinitiesEqual(cachedValue.getSecond(), tsTrinity)) {
return cachedValue.getFirst();
}
}
PropertyClient client = getFactory(ioFile).createPropertyClient();
final PropertyValue value = client.getProperty(SvnTarget.fromFile(ioFile, SVNRevision.WORKING), propName, false, SVNRevision.WORKING);
if (cachedMap == null) {
cachedMap = new HashMap<>();
myPropertyCache.put(keyForVf(file), cachedMap);
}
cachedMap.put(propName, Pair.create(value, tsTrinity));
return value;
}
Aggregations