File indexing completed on 2025-01-19 05:11:31

0001 /*
0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com>
0003 
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include "libkommit_export.h"
0009 #include <QList>
0010 #include <QMap>
0011 
0012 namespace Git
0013 {
0014 
0015 class Manager;
0016 class Commit;
0017 class LIBKOMMIT_EXPORT LogList : public QList<Commit *>
0018 {
0019 public:
0020     LogList();
0021     explicit LogList(QString branch);
0022 
0023     void load(Git::Manager *git);
0024     void initGraph();
0025 
0026     Q_REQUIRED_RESULT const QString &branch() const;
0027     void setBranch(const QString &newBranch);
0028 
0029     Commit *findByHash(const QString &hash, int *index = nullptr) const;
0030 
0031 private:
0032     Q_REQUIRED_RESULT QString branchName(const QString &refLog);
0033     void initChilds();
0034     QString mBranch;
0035     QStringList mBranches;
0036     QMap<QString, Commit *> mDataByCommitHashLong;
0037 };
0038 } // namespace Git