logic: refresh info generator fixes and tests

* fixed case where "to-index" state of a file has changed and thus the file needs to be re-indexed
* clear and re-index files that depend on changed non-indexed files
* clear and re-index files referenced by unchanged but cleared (due to referencing a changed file) files
* fixed: updated files with changed timestamp that do not have content in the db will now count as changed
* refined refresh info generator tests
* updated checklists for manual project setup tests
This commit is contained in:
mlangkabel
2018-09-14 16:02:01 +02:00
parent 5b7938eda6
commit 5517cd4ccf
10 changed files with 604 additions and 173 deletions
+17 -7
View File
@@ -344,18 +344,13 @@ void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths
}
}
std::vector<FileInfo> PersistentStorage::getFileInfoForAllIndexedFiles() const
std::vector<FileInfo> PersistentStorage::getFileInfoForAllFiles() const
{
TRACE();
std::vector<FileInfo> fileInfos;
for (StorageFile file : m_sqliteIndexStorage.getAll<StorageFile>())
{
if (!file.indexed)
{
continue;
}
boost::posix_time::ptime modificationTime = boost::posix_time::not_a_date_time;
if (file.modificationTime != "not-a-date-time")
{
@@ -1471,7 +1466,22 @@ std::shared_ptr<TextAccess> PersistentStorage::getFileContent(const FilePath& fi
{
TRACE();
return m_sqliteIndexStorage.getFileContentByPath(filePath.wstr());
std::shared_ptr<TextAccess> fileContent = m_sqliteIndexStorage.getFileContentByPath(filePath.wstr());
if (fileContent->getLineCount() > 0)
{
return fileContent;
}
return TextAccess::createFromFile(FilePath(filePath));
}
bool PersistentStorage::hasContentForFile(const FilePath& filePath) const
{
std::shared_ptr<TextAccess> fileContent = m_sqliteIndexStorage.getFileContentByPath(filePath.wstr());
if (fileContent->getLineCount() > 0)
{
return true;
}
return false;
}
FileInfo PersistentStorage::getFileInfoForFileId(Id id) const