File indexing completed on 2024-04-14 04:29:53

0001 /*
0002     This file is part of KDevelop
0003 
0004     Copyright 2017 Sergey Kalinichev <kalinichev.so.0@gmail.com>
0005 
0006     This library is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU Library General Public
0008     License as published by the Free Software Foundation; either
0009     version 2 of the License, or (at your option) any later version.
0010 
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Library General Public License for more details.
0015 
0016     You should have received a copy of the GNU Library General Public License
0017     along with this library; see the file COPYING.LIB.  If not, write to
0018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019     Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #include "mercurialjob.h"
0023 
0024 #include "mercurialplugin.h"
0025 
0026 using namespace KDevelop;
0027 
0028 MercurialJob::MercurialJob(const QDir& workingDir, MercurialPlugin* parent, JobType jobType)
0029     : VcsJob(parent, OutputJob::Silent),
0030     m_status(JobNotStarted),
0031     m_workingDir(workingDir)
0032 {
0033     setType(jobType);
0034     setCapabilities(Killable);
0035 }
0036 
0037 QVariant MercurialJob::fetchResults()
0038 {
0039     return {};
0040 }
0041 
0042 VcsJob::JobStatus MercurialJob::status() const
0043 {
0044     return m_status;
0045 }
0046 
0047 KDevelop::IPlugin* MercurialJob::vcsPlugin() const
0048 {
0049     return static_cast<IPlugin *>(parent());
0050 }
0051 
0052 bool MercurialJob::doKill()
0053 {
0054     m_status = JobCanceled;
0055     if (m_job) {
0056         return m_job->kill(KJob::Quietly);
0057     }
0058     return true;
0059 }
0060 
0061 
0062 void MercurialJob::setFail()
0063 {
0064     m_status = JobFailed;
0065     emitResult();
0066     emit resultsReady(this);
0067 }
0068 
0069 
0070 void MercurialJob::setSuccess()
0071 {
0072     m_status = JobSucceeded;
0073     emitResult();
0074     emit resultsReady(this);
0075 }