Use some special output methods using ISMAS(), GUI() nad CONSOLE().

This commit is contained in:
Gerhard Hoffmann 2023-10-30 15:00:57 +01:00
parent 196f1a730e
commit c44c805238

View File

@ -302,6 +302,7 @@ std::optional<QString> GitClient::gitPull() {
QString const s = c.getCommandResult().trimmed(); QString const s = c.getCommandResult().trimmed();
if (!s.isEmpty()) { if (!s.isEmpty()) {
QStringList lines = Update::split(s, '\n'); QStringList lines = Update::split(s, '\n');
worker()->CONSOLE(lines) << Worker::UPDATE_STEP::UPDATE_REPOSITORY;
if (!lines.empty()) { if (!lines.empty()) {
static const QRegularExpression alreadyUpToDate("^\\s*Already\\s+up\\s+to\\s+date.*$"); static const QRegularExpression alreadyUpToDate("^\\s*Already\\s+up\\s+to\\s+date.*$");
if (std::none_of(lines.cbegin(), lines.cend(), if (std::none_of(lines.cbegin(), lines.cend(),
@ -332,34 +333,30 @@ std::optional<QString> GitClient::gitPull() {
worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE); worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
} }
} else { } else {
emit m_worker->showErrorMessage("git pull", QStringList lst("no regex-match for commits");
QString("(wrong cap-count (%1)").arg(re.captureCount())); worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
}
} else {
emit m_worker->showErrorMessage("git pull",
"no regex-match for commits");
Utils::printCriticalErrorMsg("NO REGEX MATCH FOR COMMITS");
} }
} }
} }
if (!found) { if (!found) {
emit m_worker->showErrorMessage("git pull", QStringList lst(QString("unknown branch name ") + m_branchName);
QString("unkown branch name ") + m_branchName); worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
Utils::printCriticalErrorMsg("UNKNOWN BRANCH NAME " + m_branchName);
} }
} else { } else {
emit m_worker->showErrorMessage("git pull", return "Already up to date";
QString("wrong format for result of 'git pull' ") + s);
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
} }
} else { } else {
// emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'"); QStringList lst(QString("WRONG FORMAT FOR RESULT OF 'GIT PULL' ") + s);
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT PULL'"); worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
}
} else {
QStringList lst("EMPTY RESULT FOR 'GIT PULL'");
worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
} }
} }
} else { } else {
emit m_worker->showErrorMessage("git pull", QString("repository ") + m_customerRepository + " does not exist"); QStringList lst(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST");
Utils::printCriticalErrorMsg(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST"); worker()->GUI(lst) << (worker()->CONSOLE(lst) << Worker::UPDATE_STEP::UPDATE_REPOSITORY_FAILURE);
} }
return std::nullopt; return std::nullopt;
} }