2023-07-10 15:57:17 +02:00
|
|
|
#ifndef GIT_CLIENT_H_INCLUDED
|
|
|
|
#define GIT_CLIENT_H_INCLUDED
|
|
|
|
|
2023-07-14 13:10:55 +02:00
|
|
|
#include <QObject>
|
2023-07-10 15:57:17 +02:00
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "process/command.h"
|
|
|
|
|
2023-07-14 13:10:55 +02:00
|
|
|
class Worker;
|
|
|
|
class GitClient : public QObject {
|
|
|
|
Q_OBJECT
|
2023-07-10 15:57:17 +02:00
|
|
|
|
2023-07-14 13:10:55 +02:00
|
|
|
Worker *m_worker;
|
|
|
|
QString const m_repositoryPath;
|
|
|
|
QString const m_customerId;
|
|
|
|
QString const m_workingDirectory;
|
|
|
|
QString const m_branchName;
|
|
|
|
QString const m_customerRepository;
|
2023-07-10 15:57:17 +02:00
|
|
|
|
|
|
|
std::optional<QString> gitCloneRepository(QString const &repPath);
|
|
|
|
bool gitCheckout(QString const &branchName);
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit GitClient(QString const &workingDirectory = QCoreApplication::applicationDirPath(),
|
|
|
|
QString const &branchName = "master");
|
|
|
|
|
|
|
|
void setWorkingDirectory(QString const &workingDirectory);
|
|
|
|
QString workingDirectory() const;
|
|
|
|
void setBranchName(QString const &branchName);
|
|
|
|
QString branchName() const;
|
|
|
|
|
|
|
|
std::optional<QString> gitCloneBranch(QString const &repPath, QString const &branchName);
|
|
|
|
|
|
|
|
std::optional<QString> gitFetch();
|
|
|
|
bool gitFetchAndDiff();
|
|
|
|
bool gitPull();
|
|
|
|
std::optional<QStringList> gitDiff(QString const &commit);
|
|
|
|
std::optional<QStringList> gitMerge();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GIT_CLIENT_H_INCLUDED
|