Removed gitFetchAndDiff() and original version of gitPull().

This commit is contained in:
Gerhard Hoffmann 2023-10-18 11:38:26 +02:00
parent a32258a59e
commit 4589c4ca76

View File

@ -295,59 +295,38 @@ std::optional<QString> GitClient::gitPull() {
if (re.captureCount() == 3) { // start with full match (0), then the other 3 matches
return match.captured(2);
} else {
emit m_worker->showErrorMessage("git fetch",
emit m_worker->showErrorMessage("git pull",
QString("(wrong cap-count (%1)").arg(re.captureCount()));
}
} else {
emit m_worker->showErrorMessage("git fetch",
emit m_worker->showErrorMessage("git pull",
"no regex-match for commits");
Utils::printCriticalErrorMsg("NO REGEX MATCH FOR COMMITS");
}
}
}
if (!found) {
emit m_worker->showErrorMessage("git fetch",
emit m_worker->showErrorMessage("git pull",
QString("unkown branch name ") + m_branchName);
Utils::printCriticalErrorMsg("UNKNOWN BRANCH NAME " + m_branchName);
}
} else {
emit m_worker->showErrorMessage("git fetch",
QString("wrong format for result of 'git fetch' ") + s);
emit m_worker->showErrorMessage("git pull",
QString("wrong format for result of 'git pull' ") + s);
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
}
} else {
// emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT FETCH'");
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT PULL'");
}
}
} else {
emit m_worker->showErrorMessage("git fetch", QString("repository ") + m_customerRepository + " does not exist");
emit m_worker->showErrorMessage("git pull", QString("repository ") + m_customerRepository + " does not exist");
Utils::printCriticalErrorMsg(QString("REPOSITORY ") + m_customerRepository + " DOES NOT EXIST");
}
return std::nullopt;
}
bool GitClient::gitFetchAndDiff() {
if (gitFetch()) {
QString gitCommand("git diff --compact-summary HEAD..FETCH_HEAD");
Command c(gitCommand);
return c.execute(m_workingDirectory);
}
return false;
}
bool GitClient::gitPull() {
if (QDir(m_customerRepository).exists()) {
Command c("git pull");
if (c.execute(m_customerRepository)) {
qInfo() << "PULLED INTO" << m_customerRepository;
return true;
}
Utils::printCriticalErrorMsg(QString("PULL INTO " + m_customerRepository + " FAILED"));
}
return false;
}
std::optional<QStringList> GitClient::gitMerge() {
Command c("git merge");
if (c.execute(m_workingDirectory)) {