#include "process/check_and_fetch_customer_repository_command.h" #include "worker.h" #include "utils_internal.h" CheckAndFetchCustomerRepositoryCommand::CheckAndFetchCustomerRepositoryCommand( QString const &command, Worker *worker, int nextCommandIndex, int start_timeout, int finish_timeout) : UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) { } void CheckAndFetchCustomerRepositoryCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) { qCritical() << __func__ << ":" << __LINE__ << command() << exitCode << exitStatus; Worker *w = worker(); if (w) { switch (exitCode) { case internal::GIT_CHECKOUT_ERROR_CODE: emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_CHECKOUT_ERROR); break; case internal::GIT_PULL_ERROR_CODE: emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_PULL_ERROR); break; case internal::GIT_NOT_NECESSARY_CODE: emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY); exitCode = 0; break; case internal::GIT_UPDATED_CODE: emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UPDATED); exitCode = 0; break; case 0: emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UP_TO_DATE); default:; } } return UpdateCommand::finished(exitCode, exitStatus); } void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() { QProcess *p = (QProcess *)sender(); if (p) { Worker *w = worker(); if (w) { QString s = p->readAllStandardOutput().trimmed(); m_commandResult += s; if (m_commandResult.contains(internal::GIT_CUSTOMER_REPO_NO_UPDATE_NECESSARY)) { //emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY); m_commandResult.clear(); } else if (m_commandResult.contains(internal::GIT_CUSTOMER_REPO_UPDATED)) { //emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UPDATED); } } } // static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"}; // emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE); // } //} }