Use print-utis from utils.h.

This commit is contained in:
Gerhard Hoffmann 2023-08-11 11:11:14 +02:00
parent 853787cd4b
commit 34334676fc

View File

@ -48,9 +48,7 @@ bool GitClient::gitCloneCustomerRepository() {
}
}
}
qCritical() << QString(80, '*');
qCritical() << "ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT=" << result;
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg(QString("ERROR CLONE RESULT HAS WRONG FORMAT. CLONE_RESULT=") + result);
}
return false;
}
@ -97,9 +95,7 @@ bool GitClient::gitCheckoutBranch() {
Command c(gitCommand);
return c.execute(m_customerRepository); // execute command in customerRepo
}
qCritical() << QString(80, '*');
qCritical() << "ERROR" << m_customerRepository << "DOES NOT EXIST";
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg(QString("ERROR ") + m_customerRepository + " DOES NOT EXIST");
return false;
}
@ -113,11 +109,8 @@ bool GitClient::gitCloneAndCheckoutBranch() {
// TODO
}
//}
} else {
qCritical() << QString(80, '*');
qInfo() << "CLONE" << m_repositoryPath << "AND CHECKOUT FAILED";
qCritical() << QString(80, '*');
}
Utils::printCriticalErrorMsg(QString("CLONE ") + m_repositoryPath + " AND CHECKOUT FAILED");
return false;
}
@ -134,11 +127,7 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
Command c(gitCommand);
if (c.execute(m_customerRepository)) { // execute command in local customerRepo
QString s = c.getCommandResult().trimmed();
QStringList lines = Update::split(s, '\n');
qInfo() << QString(80, '*');
qInfo() << "GIT DIFF RESULT" << lines;
qInfo() << QString(80, '*');
Utils::printInfoMsg("GIT DIFF RESULT " + s);
QStringList fileNames;
// each line has the format "etc/psa_config/DC2C_print01.json | 1 +
@ -185,9 +174,7 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
*/
std::optional<QString> GitClient::gitFetch() {
if (QDir(m_customerRepository).exists()) {
qCritical() << QString(80, '*');
qInfo() << "BRANCH NAME" << m_branchName;
qCritical() << QString(80, '*');
Command c("git fetch");
if (c.execute(m_customerRepository)) {
@ -221,38 +208,28 @@ std::optional<QString> GitClient::gitFetch() {
} else {
emit m_worker->showErrorMessage("git fetch",
"no regex-match for commits");
qCritical() << QString(80, '*');
qCritical() << "NO REGEX MATCH FOR COMMITS";
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg("NO REGEX MATCH FOR COMMITS");
}
}
}
if (!found) {
emit m_worker->showErrorMessage("git fetch",
QString("unkown branch name ") + m_branchName);
qCritical() << QString(80, '*');
qCritical() << "UNKNOWN BRANCH NAME" << m_branchName;
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg("UNKNOWN BRANCH NAME " + m_branchName);
}
} else {
emit m_worker->showErrorMessage("git fetch",
QString("wrong format for result of 'git fetch' ") + s);
qCritical() << QString(80, '*');
qCritical() << "WRONG FORMAT FOR RESULT OF 'GIT FETCH'" << s;
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
}
} else {
emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
qCritical() << QString(80, '*');
qCritical() << "EMPTY RESULT FOR 'GIT FETCH'";
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg("EMPTY RESULT FOR 'GIT FETCH'");
}
}
} else {
emit m_worker->showErrorMessage("git fetch", QString("repository ") + m_customerRepository + " does not exist");
qCritical() << QString(80, '*');
qCritical() << "REPOSITORY" << m_customerRepository << "DOES NOT EXIST";
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST");
}
return std::nullopt;
}
@ -273,9 +250,7 @@ bool GitClient::gitPull() {
qInfo() << "PULLED INTO" << m_customerRepository;
return true;
}
qCritical() << QString(80, '*');
qCritical() << "PULL INTO" << m_customerRepository << "FAILED";
qCritical() << QString(80, '*');
Utils::printCriticalErrorMsg(QString("PULL INTO " + m_customerRepository + " FAILED"));
}
return false;
}