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