ATBUpdateTool/git/git_client.h

51 lines
1.4 KiB
C
Raw Normal View History

#ifndef GIT_CLIENT_H_INCLUDED
#define GIT_CLIENT_H_INCLUDED
2023-07-14 13:10:55 +02:00
#include <QObject>
#include <optional>
#include "process/command.h"
2023-07-14 13:10:55 +02:00
class Worker;
class GitClient : public QObject {
Q_OBJECT
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-14 13:12:37 +02:00
bool copyGitConfigFromMaster();
public:
2023-07-14 13:12:37 +02:00
explicit GitClient(QString const &repositoryPath,
QString const &customerId,
QString const &workingDirectory = QCoreApplication::applicationDirPath(),
QString const &branchName = "master",
QObject *parent = 0);
2023-07-14 13:12:37 +02:00
bool gitCloneCustomerRepository();
bool gitCheckoutBranch();
2023-07-14 13:12:37 +02:00
QString const workingDirectory() const { return m_workingDirectory; }
QString workingDirectory() { return m_workingDirectory; }
QString const branchName() const { return m_branchName; }
QString branchName() { return m_branchName; }
QString repositoryPath() { return m_repositoryPath; }
QString const repositoryPath() const { return m_repositoryPath; }
bool gitCloneAndCheckoutBranch();
std::optional<QString> gitFetch();
bool gitFetchAndDiff();
bool gitPull();
std::optional<QStringList> gitDiff(QString const &commit);
std::optional<QStringList> gitMerge();
};
#endif // GIT_CLIENT_H_INCLUDED