Added: #1440 Additional sanity checks on removed file listing

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 959d43bb1c
commit fffba58a57

@ -194,7 +194,7 @@ bool CDatabaseStatus::getFileStatus(std::map<std::string, CFileStatus> &fileStat
return true;
}
void CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveMap, const std::vector<std::string> &paths)
bool CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveMap, const std::vector<std::string> &paths)
{
for (std::vector<std::string>::const_iterator it = paths.begin(), end = paths.end(); it != end; ++it)
{
@ -249,9 +249,15 @@ void CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveM
nldebug("Found remove meta for file '%s'!", subPathOrig.c_str());
// Read the removed tag.
std::string removedTagFile = dirPathMeta + subPathFilename + PIPELINE_DATABASE_REMOVE_SUFFIX;
std::string removeTagFile = dirPathMeta + subPathFilename + PIPELINE_DATABASE_REMOVE_SUFFIX;
std::string statusTagFile = dirPathMeta + subPathFilename + PIPELINE_DATABASE_STATUS_SUFFIX;
if (CFile::isExists(statusTagFile))
{
nlwarning("Removed file has status");
return false;
}
CFileRemove fr;
CIFile ifr(removedTagFile, false);
CIFile ifr(removeTagFile, false);
fr.serial(ifr);
ifr.close();
@ -260,7 +266,7 @@ void CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveM
// TODO_PROCESS_ERROR_EXIT
if (g_IsExiting)
return;
return false;
}
}
}
@ -269,11 +275,17 @@ void CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveM
// TODO_PROCESS_WARNING
nlwarning("Requesting information on file or directory '%s' that does not exist!", path.c_str());
CFileRemove fr;
std::string removedTagFile = CWorkspaceStorage::getMetaFilePath(path, PIPELINE_DATABASE_REMOVE_SUFFIX);
if (CFile::isExists(removedTagFile))
std::string removeTagFile = CWorkspaceStorage::getMetaFilePath(path, PIPELINE_DATABASE_REMOVE_SUFFIX);
std::string statusTagFile = CWorkspaceStorage::getMetaFilePath(path, PIPELINE_DATABASE_RESULT_SUFFIX);
if (CFile::isExists(statusTagFile))
{
nlwarning("Not existing file has status");
return false;
}
if (CFile::isExists(removeTagFile))
{
// file existed before
CIFile ifr(removedTagFile, false);
CIFile ifr(removeTagFile, false);
fr.serial(ifr);
ifr.close();
}
@ -287,8 +299,10 @@ void CDatabaseStatus::getRemoved(std::map<std::string, CFileRemove> &fileRemoveM
// TODO_PROCESS_ERROR_EXIT
if (g_IsExiting)
return;
return false;
}
return true;
}
namespace {

@ -78,7 +78,7 @@ public:
/// Gets the last file statuses of given paths in a map. Directories are scanned for files, non recursively. Returns false if one of the statuses is bad (not updated; file changed inbetween). Considered as build error.
bool getFileStatus(std::map<std::string, CFileStatus> &fileStatusMap, std::map<std::string, CFileRemove> &fileRemoveMap, const std::vector<std::string> &paths);
/// Gets all removed files
void getRemoved(std::map<std::string, CFileRemove> &fileRemoveMap, const std::vector<std::string> &paths);
bool getRemoved(std::map<std::string, CFileRemove> &fileRemoveMap, const std::vector<std::string> &paths);
void getFileErrors(CFileErrors &fileErrors, const std::string &filePath, uint32 newerThan = 0) const;
void addFileError(const std::string &filePath, const CFileError &fileError);

Loading…
Cancel
Save