ATBUpdateTool/UpdatePTUDevCtrl/git/git_client.h

68 lines
2.0 KiB
C++

#ifndef GIT_CLIENT_H_INCLUDED
#define GIT_CLIENT_H_INCLUDED
#include <QObject>
#include <QStringList>
#include <optional>
#include "process/command.h"
#include "ismas/ismas_client.h"
class Worker;
class GitClient : public QObject {
Q_OBJECT
Worker *m_worker;
QString const m_repositoryPath;
QString const m_customerNr;
QString const m_workingDirectory;
QString m_branchName;
QString const m_customerRepository;
bool copyGitConfigFromMaster();
public:
explicit GitClient(QString const &customerRepositoryUrl,
QString const &customerNrStr,
QString const &repositoryPath,
QString const &workingDirectory = QCoreApplication::applicationDirPath(),
QString const &branchName = "master",
QObject *parent = 0);
bool gitCloneCustomerRepository();
bool gitCheckoutBranch();
QStringList gitBranchNames();
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();
Worker *worker() { return m_worker; }
Worker const *worker() const { return m_worker; }
std::optional<QString> gitPull();
std::optional<QStringList> gitDiff(QString const &commit);
std::optional<QStringList> gitMerge();
bool gitFsck();
QString gitLastCommit(QString fileName);
QStringList gitShowReason(QString branchName);
static QString gitBlob(QString fileName);
QString gitCommitForBlob(QString blob);
bool gitIsFileTracked(QString file2name);
bool branchExistsRemotely();
bool branchExistsLocally();
bool gitPullNewBranches();
};
#endif // GIT_CLIENT_H_INCLUDED