Reformat m_versionInfo in case a version is included in the commit-message.
This commit is contained in:
parent
f15cc636c6
commit
8402fde6b5
@ -1256,15 +1256,48 @@ PSAInstalled Worker::getPSAInstalled() {
|
|||||||
psaInstalled.versionInfo.created = "N/A";
|
psaInstalled.versionInfo.created = "N/A";
|
||||||
|
|
||||||
if (m_versionInfo.size() == 3) {
|
if (m_versionInfo.size() == 3) {
|
||||||
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
|
QString const &lastCommit = m_versionInfo.at(0);
|
||||||
<< "m_versionInfo" << m_versionInfo << "*****";
|
QString reason = m_versionInfo.at(1);
|
||||||
psaInstalled.versionInfo.lastCommit = QString("%1-%2")
|
QDateTime const dt = QDateTime::fromString(m_versionInfo.at(2), Qt::ISODate);
|
||||||
.arg(QCoreApplication::applicationPid())
|
QString version{""};
|
||||||
.arg(m_versionInfo.at(0));
|
QString date{""};
|
||||||
psaInstalled.versionInfo.reason = m_versionInfo.at(1);
|
if (dt.isValid()) {
|
||||||
|
date += " ";
|
||||||
|
date += dt.date().toString(Qt::ISODate);
|
||||||
|
}
|
||||||
|
static const QRegularExpression re("^\\s*(\\d+)\\.(\\d+)\\.(\\d+)(.*$)");
|
||||||
|
QRegularExpressionMatch match = re.match(reason);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
int const lastCapturedIndex = match.lastCapturedIndex();
|
||||||
|
if (lastCapturedIndex >= 1) {
|
||||||
|
version += " v";
|
||||||
|
version += match.captured(1); // major
|
||||||
|
}
|
||||||
|
if (lastCapturedIndex >= 2) {
|
||||||
|
version += ".";
|
||||||
|
version += match.captured(2); // minor
|
||||||
|
}
|
||||||
|
if (lastCapturedIndex >= 3) {
|
||||||
|
version += ".";
|
||||||
|
version += match.captured(3); // patch
|
||||||
|
}
|
||||||
|
if (lastCapturedIndex >= 4) { // rest after version
|
||||||
|
reason = match.captured(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
psaInstalled.versionInfo.lastCommit = QString("%1%2").arg(lastCommit).arg(version);
|
||||||
|
psaInstalled.versionInfo.reason = reason;
|
||||||
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
psaInstalled.versionInfo.created = m_versionInfo.at(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//qCritical() << "";
|
||||||
|
//qCritical() << "VERSION-INFO";
|
||||||
|
//qCritical() << "LAST-COMMIT" << psaInstalled.versionInfo.lastCommit;
|
||||||
|
//qCritical() << "REASON" << psaInstalled.versionInfo.reason;
|
||||||
|
//qCritical() << "CREATED" << psaInstalled.versionInfo.created;
|
||||||
|
//qCritical() << "";
|
||||||
|
|
||||||
if (m_zoneNr != 0) {
|
if (m_zoneNr != 0) {
|
||||||
QString const &n = QString("%1").arg(m_zoneNr).rightJustified(2, '0');
|
QString const &n = QString("%1").arg(m_zoneNr).rightJustified(2, '0');
|
||||||
psaInstalled.tariff.name = QString("tariff%1.json").arg(n);
|
psaInstalled.tariff.name = QString("tariff%1.json").arg(n);
|
||||||
|
Loading…
Reference in New Issue
Block a user