Compare commits
No commits in common. "cbe1fd387dd29f1cc1ee782ee70d41e86aa28239" and "4307fb96a605b5c3b68634efd030b57f0d75ca3b" have entirely different histories.
cbe1fd387d
...
4307fb96a6
@ -330,7 +330,7 @@ QString GitClient::gitBlob(QString fileName) {
|
|||||||
if (fi.exists()) {
|
if (fi.exists()) {
|
||||||
QString const gitCommand = QString("git hash-object %1").arg(fileName);
|
QString const gitCommand = QString("git hash-object %1").arg(fileName);
|
||||||
Command c(gitCommand);
|
Command c(gitCommand);
|
||||||
if (c.execute("/tmp")) {
|
if (c.execute(m_workingDirectory)) {
|
||||||
return c.getCommandResult().trimmed();
|
return c.getCommandResult().trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class GitClient : public QObject {
|
|||||||
|
|
||||||
QString gitLastCommit(QString fileName);
|
QString gitLastCommit(QString fileName);
|
||||||
QStringList gitShowReason();
|
QStringList gitShowReason();
|
||||||
static QString gitBlob(QString fileName);
|
QString gitBlob(QString fileName);
|
||||||
QString gitCommitForBlob(QString blob);
|
QString gitCommitForBlob(QString blob);
|
||||||
bool gitIsFileTracked(QString file2name);
|
bool gitIsFileTracked(QString file2name);
|
||||||
};
|
};
|
||||||
|
@ -224,7 +224,6 @@ void MainWindow::onReplaceLast(QString text, QString suffix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onShowErrorMessage(QString title, QString text) {
|
void MainWindow::onShowErrorMessage(QString title, QString text) {
|
||||||
this->statusBar()->clearMessage();
|
this->statusBar()->showMessage( // timeout: 5000
|
||||||
this->statusBar()->showMessage( // timeout: 10000
|
QString(title + ": " + text).leftJustified(80, ' '), 20000);
|
||||||
QString(title + ": " + text).leftJustified(80, ' '), 10000);
|
|
||||||
}
|
}
|
||||||
|
83
utils.cpp
83
utils.cpp
@ -1,6 +1,5 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "message_handler.h"
|
#include "message_handler.h"
|
||||||
#include "git/git_client.h"
|
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -87,85 +86,3 @@ QString Utils::rstrip(QString const &str) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::sameFilesInDirs(QDir const &dir1, QDir const &dir2,
|
|
||||||
QStringList const &nameFilters) {
|
|
||||||
if (!dir1.exists()) {
|
|
||||||
printCriticalErrorMsg(dir1.dirName() + " DOES NOT EXIST");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!dir2.exists()) {
|
|
||||||
printCriticalErrorMsg(dir2.dirName() + " DOES NOT EXIST");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (dir1.absolutePath() == dir2.absolutePath()) {
|
|
||||||
printCriticalErrorMsg(dir1.dirName() + " AND "+ dir2.dirName() + " HAVE SAME PATH");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// files, sorted by name
|
|
||||||
QFileInfoList const &lst1 = dir1.entryInfoList(nameFilters, QDir::Files, QDir::Name);
|
|
||||||
QFileInfoList const &lst2 = dir2.entryInfoList(nameFilters, QDir::Files, QDir::Name);
|
|
||||||
|
|
||||||
QStringList fileNameLst1{};
|
|
||||||
QStringList fileNameLst2{};
|
|
||||||
QListIterator<QFileInfo> i1(lst1);
|
|
||||||
while (i1.hasNext()) {
|
|
||||||
fileNameLst1 << i1.next().fileName();
|
|
||||||
}
|
|
||||||
QListIterator<QFileInfo> i2(lst2);
|
|
||||||
while (i2.hasNext()) {
|
|
||||||
fileNameLst2 << i2.next().fileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileNameLst1.isEmpty()) {
|
|
||||||
qCritical() << "DIR1" << dir1.dirName() << " DOES NOT CONTAIN EXPECTED FILES";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fileNameLst2.isEmpty()) {
|
|
||||||
qCritical() << "DIR1" << dir2.dirName() << " DOES NOT CONTAIN EXPECTED FILES";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fileNameLst1 != fileNameLst2) {
|
|
||||||
printCriticalErrorMsg(dir1.dirName() + " AND " + dir2.dirName()
|
|
||||||
+ " DIFFER: [" + fileNameLst1.join(',') + "],["
|
|
||||||
+ fileNameLst2.join(',') + "]");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
printInfoMsg(dir1.dirName() + " AND " + dir2.dirName()
|
|
||||||
+ " ARE EQUAL: [" + fileNameLst1.join(',') + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList gitBlobLst1{};
|
|
||||||
QStringList gitBlobLst2{};
|
|
||||||
QListIterator<QFileInfo> i3(lst1);
|
|
||||||
while (i3.hasNext()) {
|
|
||||||
gitBlobLst1 << GitClient::gitBlob(i3.next().fileName());
|
|
||||||
}
|
|
||||||
QListIterator<QFileInfo> i4(lst2);
|
|
||||||
while (i4.hasNext()) {
|
|
||||||
gitBlobLst2 << GitClient::gitBlob(i4.next().fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gitBlobLst1.isEmpty()) {
|
|
||||||
qCritical() << "DIR1" << dir1.dirName() << " DOES NOT CONTAIN EXPECTED FILES";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (gitBlobLst2.isEmpty()) {
|
|
||||||
qCritical() << "DIR1" << dir2.dirName() << " DOES NOT CONTAIN EXPECTED FILES";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gitBlobLst1 != gitBlobLst2) {
|
|
||||||
printCriticalErrorMsg(dir1.dirName() + " AND " + dir2.dirName()
|
|
||||||
+ " DIFFER: [" + gitBlobLst1.join(',') + "],["
|
|
||||||
+ gitBlobLst2.join(',') + "]");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
printInfoMsg(dir1.dirName() + " AND " + dir2.dirName()
|
|
||||||
+ " CONTAIN SAME GIT-BLOBS FOR FILES: [" + fileNameLst1.join(',') + "]");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
3
utils.h
3
utils.h
@ -7,7 +7,6 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
int read1stLineOfFile(QString fileName);
|
int read1stLineOfFile(QString fileName);
|
||||||
@ -17,8 +16,6 @@ namespace Utils {
|
|||||||
void printLineEditInfo(QStringList const &lines);
|
void printLineEditInfo(QStringList const &lines);
|
||||||
QString getTariffLoadTime(QString fileName);
|
QString getTariffLoadTime(QString fileName);
|
||||||
QString rstrip(QString const &str);
|
QString rstrip(QString const &str);
|
||||||
bool sameFilesInDirs(QDir const &dir1, QDir const &dir2,
|
|
||||||
QStringList const &nameFilters = {"*.json"});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UTILS_H_INCLUDED
|
#endif // UTILS_H_INCLUDED
|
||||||
|
13
worker.cpp
13
worker.cpp
@ -1001,16 +1001,9 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
progress += 5;
|
progress += 5;
|
||||||
setProgress(progress);
|
setProgress(progress);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
// now check tariff-files in etc and /etc/psa_tariff
|
setProgress(100);
|
||||||
QDir dir1(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/psa_tariff"));
|
emit replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
||||||
QDir dir2("/etc/psa_tariff");
|
return true;
|
||||||
if (Utils::sameFilesInDirs(dir1, dir2)) {
|
|
||||||
setProgress(100);
|
|
||||||
emit replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// TODO: send message to ISMAS
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user