| 233 | // } |
| 234 | |
| 235 | static bool nodeNeedsUpdate(uint index) |
| 236 | { |
| 237 | QMutexLocker lock(modificationRevisionSetMutex()); |
| 238 | |
| 239 | if (!index) |
| 240 | return false; |
| 241 | |
| 242 | const auto currentTime = QDateTime::currentDateTimeUtc(); |
| 243 | |
| 244 | auto cached = needsUpdateCache.constFind(index); |
| 245 | if (cached != needsUpdateCache.constEnd()) { |
| 246 | if ((*cached).first.secsTo(currentTime) < cacheModificationTimesForSeconds) { |
| 247 | return cached->second; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | bool result = false; |
| 252 | |
| 253 | const Utils::SetNodeData* nodeData = FileModificationSetRepositoryRepresenter::repository().nodeFromIndex(index); |
| 254 | if (nodeData->contiguous()) { |
| 255 | //Do the actual checking |
| 256 | for (unsigned int a = nodeData->start(); a < nodeData->end(); ++a) { |
| 257 | const FileModificationPair* data = fileModificationPairRepository().itemFromIndex(a); |
| 258 | ModificationRevision revision = KDevelop::ModificationRevision::revisionForFile(data->file); |
| 259 | if (revision != data->revision) { |
| 260 | result = true; |
| 261 | break; |
| 262 | } |
| 263 | } |
| 264 | } else { |
| 265 | result = nodeNeedsUpdate(nodeData->leftNode()) || nodeNeedsUpdate(nodeData->rightNode()); |
| 266 | } |
| 267 | |
| 268 | needsUpdateCache.insert(index, std::make_pair(currentTime, result)); |
| 269 | |
| 270 | return result; |
| 271 | } |
| 272 | |
| 273 | QString ModificationRevisionSet::toString() const |
| 274 | { |
no test coverage detected