2022-02-10 12:03:56 +08:00
|
|
|
#ifndef GITREPOSITORY_H
|
|
|
|
#define GITREPOSITORY_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
enum class GitResetStrategy {
|
|
|
|
Soft,
|
|
|
|
Hard,
|
|
|
|
Merge,
|
|
|
|
Mixed,
|
|
|
|
Keep
|
|
|
|
};
|
|
|
|
|
|
|
|
class GitManager;
|
|
|
|
class GitRepository : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit GitRepository(const QString& folder, GitManager* manager, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
const QString &folder() const;
|
|
|
|
|
|
|
|
void createRepository();
|
2022-02-14 00:13:00 +08:00
|
|
|
bool hasRepository(QString& currentBranch);
|
2022-02-10 12:03:56 +08:00
|
|
|
|
|
|
|
void add(const QString& path);
|
|
|
|
void remove(const QString& path);
|
|
|
|
void rename(const QString& oldName, const QString& newName);
|
|
|
|
void restore(const QString& path);
|
|
|
|
QStringList listFiles(bool refresh);
|
|
|
|
|
|
|
|
void clone(const QString& url);
|
|
|
|
void commit(const QString& message);
|
|
|
|
void revert();
|
|
|
|
void reset(const QString& commit, GitResetStrategy strategy);
|
|
|
|
|
|
|
|
GitManager *manager() const;
|
|
|
|
void setManager(GitManager *newManager);
|
|
|
|
|
2022-02-14 00:13:00 +08:00
|
|
|
void setFolder(const QString &newFolder);
|
|
|
|
|
2022-02-10 12:03:56 +08:00
|
|
|
signals:
|
|
|
|
private:
|
|
|
|
QString mFolder;
|
|
|
|
GitManager* mManager;
|
|
|
|
QStringList mFiles;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GITREPOSITORY_H
|