File indexing completed on 2024-05-05 04:39:01

0001 /*
0002     SPDX-FileCopyrightText: 2013-2014 Maciej Poleski
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef BAZAAR_BZRANNOTATEJOB_H
0008 #define BAZAAR_BZRANNOTATEJOB_H
0009 
0010 #include <QStringList>
0011 #include <QHash>
0012 #include <QDir>
0013 #include <QUrl>
0014 #include <QPointer>
0015 
0016 #include <vcs/vcsevent.h>
0017 #include <vcs/vcsjob.h>
0018 
0019 class QDir;
0020 namespace KDevelop
0021 {
0022 class DVcsJob;
0023 }
0024 
0025 class BzrAnnotateJob : public KDevelop::VcsJob
0026 {
0027     Q_OBJECT
0028 public:
0029 
0030     explicit BzrAnnotateJob(const QDir& workingDir, const QString& revisionSpec, const QUrl& localLocation, KDevelop::IPlugin* parent = nullptr, OutputJobVerbosity verbosity = OutputJob::Verbose);
0031 
0032     QVariant fetchResults() override;
0033     void start() override;
0034     JobStatus status() const override;
0035     KDevelop::IPlugin* vcsPlugin() const override;
0036 
0037 protected:
0038     bool doKill() override;
0039 
0040 private Q_SLOTS:
0041     void parseBzrAnnotateOutput(KDevelop::DVcsJob* job);
0042     void parseNextLine();
0043     void prepareCommitInfo(std::size_t revision);
0044     void parseBzrLog(KDevelop::DVcsJob* job);
0045 
0046 private:
0047     QDir m_workingDir;
0048     QString m_revisionSpec;
0049     QUrl m_localLocation;
0050     KDevelop::IPlugin* m_vcsPlugin;
0051 
0052     JobStatus m_status;
0053     QPointer<KJob> m_job;
0054 
0055     QStringList m_outputLines;
0056     int m_currentLine;
0057     QHash<int, KDevelop::VcsEvent> m_commits;
0058     QVariantList m_results;
0059 };
0060 
0061 #endif // BAZAAR_BZRANNOTATEJOB_H