• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/vcs

  • KDevelop
  • DVcsJob
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KDevelop::DVcsJob Class Reference

#include <dvcsjob.h>

Inheritance diagram for KDevelop::DVcsJob:
Inheritance graph
[legend]

Public Slots

void cancel ()
 

Signals

void readyForParsing (KDevelop::DVcsJob *job)
 
- Signals inherited from KDevelop::VcsJob
void resultsReady (KDevelop::VcsJob *)
 

Public Member Functions

 DVcsJob (const QDir &workingDir, KDevelop::IPlugin *parent=nullptr, KDevelop::OutputJob::OutputJobVerbosity verbosity=KDevelop::OutputJob::Verbose)
 
 ~DVcsJob () override
 
QDir directory () const
 
void displayOutput (const QString &output)
 
QStringList dvcsCommand () const
 
QByteArray errorOutput () const
 
QVariant fetchResults () override
 
DVcsJob & operator<< (const char *arg)
 
DVcsJob & operator<< (const QList< QUrl > &args)
 
DVcsJob & operator<< (const QString &arg)
 
DVcsJob & operator<< (const QStringList &args)
 
virtual DVcsJob & operator<< (const QUrl &arg)
 
QString output () const
 
KProcess * process () const
 
QByteArray rawOutput () const
 
void setCommunicationMode (KProcess::OutputChannelMode comm)
 
void setIgnoreError (bool ignore)
 
virtual void setResults (const QVariant &res)
 
void start () override
 
KDevelop::VcsJob::JobStatus status () const override
 
KDevelop::IPlugin * vcsPlugin () const override
 
- Public Member Functions inherited from KDevelop::VcsJob
 VcsJob (QObject *parent=nullptr, OutputJobVerbosity verbosity=OutputJob::Verbose)
 
 ~VcsJob () override
 
void setType (JobType)
 
JobType type () const
 

Protected Slots

virtual void slotProcessError (QProcess::ProcessError)
 

Protected Member Functions

bool doKill () override
 

Additional Inherited Members

- Public Types inherited from KDevelop::VcsJob
enum  JobStatus {
  JobRunning = 0, JobSucceeded = 1, JobCanceled = 2, JobFailed = 3,
  JobNotStarted = 4
}
 
enum  JobType {
  Unknown = -1, Add = 0, Remove = 1, Copy = 2,
  Move = 3, Diff = 4, Commit = 5, Update = 6,
  Merge = 7, Resolve = 8, Import = 9, Checkout = 10,
  Log = 11, Push = 12, Pull = 13, Annotate = 14,
  Clone = 15, Status = 16, Revert = 17, Cat = 18,
  Reset = 19, Apply = 20, UserType = 1000
}
 

Detailed Description

This class is capable of running our dvcs commands.

Most of all DVcsJob are created in DVCS executors, but executed in DistributedVersionControlPlugin or any managers like BranchManager.

Note
Connect to KJob::result(KJob*) to be notified when the job finished.

How to create DVcsJob:

DVcsJob* job = new DVcsJob(vcsplugin);
job->setDirectory(workDir);
*job << "git-rev-parse";
foreach(const QString &arg, args) // *job << args can be used instead!
*job << arg;
return job;
return error_cmd(i18n("could not create the job"));

Usage example 1:

VcsJob* j = add(QList<QUrl>() << a << b << c, IBasicVersionControl::Recursive);
DVcsJob* job = qobject_cast<DVCSjob*>(j);
connect(job, SIGNAL(result(KJob*)),
this, SIGNAL(jobFinished(KJob*)));
ICore::self()->runController()->registerJob(job);

Usage example 2, asynchronous:

DVcsJob* branchJob = d->branch(repo, baseBranch, newBranch);
if (job->exec() && job->status() == KDevelop::VcsJob::JobSucceeded)
return true;
else
//something, maybe even just
return false
Author
Robert Gruber rgrub[email protected][email protected][email protected]sers.[email protected]sour[email protected]cefor[email protected]ge.n[email protected]et
Evgeniy Ivanov power[email protected][email protected][email protected]kde.r[email protected]u

Definition at line 86 of file dvcsjob.h.

Constructor & Destructor Documentation

◆ DVcsJob()

DVcsJob::DVcsJob ( const QDir &  workingDir,
KDevelop::IPlugin *  parent = nullptr,
KDevelop::OutputJob::OutputJobVerbosity  verbosity = KDevelop::OutputJob::Verbose 
)
explicit

Definition at line 66 of file dvcsjob.cpp.

◆ ~DVcsJob()

DVcsJob::~DVcsJob ( )
overridedefault

Member Function Documentation

◆ cancel

void DVcsJob::cancel ( )
slot

Cancel slot.

Definition at line 228 of file dvcsjob.cpp.

◆ directory()

QDir DVcsJob::directory ( ) const

Returns current working directory.

Definition at line 93 of file dvcsjob.cpp.

◆ displayOutput()

void DVcsJob::displayOutput ( const QString &  output)

Definition at line 303 of file dvcsjob.cpp.

◆ doKill()

bool DVcsJob::doKill ( )
overrideprotected

Definition at line 352 of file dvcsjob.cpp.

◆ dvcsCommand()

QStringList DVcsJob::dvcsCommand ( ) const
Returns
The command that is executed when calling start().

Definition at line 124 of file dvcsjob.cpp.

◆ errorOutput()

QByteArray DVcsJob::errorOutput ( ) const
Returns
The whole binary stderr output of the job.

Definition at line 151 of file dvcsjob.cpp.

◆ fetchResults()

QVariant DVcsJob::fetchResults ( )
overridevirtual

Returns execution results stored in QVariant.

Mostly used in vcscommitdialog.

See also
setResults(const QVariant &res)

Implements KDevelop::VcsJob.

Definition at line 172 of file dvcsjob.cpp.

◆ operator<<() [1/5]

DVcsJob & DVcsJob::operator<< ( const char *  arg)

Overloaded convenience function.

Parameters
argcommand or argument as utf8-encoded string
See also
operator<<(const QString& arg).

Definition at line 108 of file dvcsjob.cpp.

◆ operator<<() [2/5]

DVcsJob & DVcsJob::operator<< ( const QList< QUrl > &  args)
See also
operator<<(const QUrl& arg).

Definition at line 344 of file dvcsjob.cpp.

◆ operator<<() [3/5]

DVcsJob & DVcsJob::operator<< ( const QString &  arg)

Call this method to set command to execute and its arguments.

Note
Don't forget <<"one two"; is not the same as <<"one"<<"two"; Use one word(command, arg) per one QString!

Definition at line 100 of file dvcsjob.cpp.

◆ operator<<() [4/5]

DVcsJob & DVcsJob::operator<< ( const QStringList &  args)

Overloaded convenience function.

See also
operator<<(const QString& arg).

Definition at line 116 of file dvcsjob.cpp.

◆ operator<<() [5/5]

DVcsJob & DVcsJob::operator<< ( const QUrl &  arg)
virtual

Overloaded operator << for url's, can be used to pass files and makes arguments absolute to the process working directory.

Override if you need to treat paths before adding them as parameters.

Definition at line 336 of file dvcsjob.cpp.

◆ output()

QString DVcsJob::output ( ) const
Returns
The whole output of the job as a string. (Might fail on binary data)

Definition at line 131 of file dvcsjob.cpp.

◆ process()

KProcess * DVcsJob::process ( ) const

Definition at line 377 of file dvcsjob.cpp.

◆ rawOutput()

QByteArray DVcsJob::rawOutput ( ) const
Returns
The whole binary output of the job

Definition at line 144 of file dvcsjob.cpp.

◆ readyForParsing

void KDevelop::DVcsJob::readyForParsing ( KDevelop::DVcsJob *  job)
signal

◆ setCommunicationMode()

void DVcsJob::setCommunicationMode ( KProcess::OutputChannelMode  comm)

In some cases it's needed to specify the communication mode between the process and the job object.

This is for instance done for the "git status" command. If stdout and stderr are processed as separate streams, their signals do not always get emitted in correct order by KProcess, which will lead to a screwed up output.

Note
Default communication mode is KProcess::SeparateChannels.

Definition at line 221 of file dvcsjob.cpp.

◆ setIgnoreError()

void DVcsJob::setIgnoreError ( bool  ignore)

Ignore a non-zero exit code depending on ignore.

Definition at line 158 of file dvcsjob.cpp.

◆ setResults()

void DVcsJob::setResults ( const QVariant &  res)
virtual

Sets executions results.

In most cases this method is used by IDVCSexecutor

See also
fetchResults()

Definition at line 165 of file dvcsjob.cpp.

◆ slotProcessError

void DVcsJob::slotProcessError ( QProcess::ProcessError  err)
protectedvirtualslot

Definition at line 235 of file dvcsjob.cpp.

◆ start()

void DVcsJob::start ( )
override

Call this method to start this job.

Note
Default communication mode is KProcess::AllOutput.
See also
Use setCommunicationMode() to override the default communication mode.

Definition at line 179 of file dvcsjob.cpp.

◆ status()

VcsJob::JobStatus DVcsJob::status ( ) const
overridevirtual

Returns JobStatus.

See also
KDevelop::VcsJob::JobStatus

Implements KDevelop::VcsJob.

Definition at line 322 of file dvcsjob.cpp.

◆ vcsPlugin()

IPlugin * DVcsJob::vcsPlugin ( ) const
overridevirtual

Returns pointer to IPlugin (which was used to create a job).

Implements KDevelop::VcsJob.

Definition at line 329 of file dvcsjob.cpp.


The documentation for this class was generated from the following files:
  • dvcsjob.h
  • dvcsjob.cpp
KDevelop::VcsJob::VcsJob
VcsJob(QObject *parent=nullptr, OutputJobVerbosity verbosity=OutputJob::Verbose)
Definition: vcsjob.cpp:48
QList< QUrl >
KDevelop::IBasicVersionControl::Recursive
run recursively through subdirectories
Definition: ibasicversioncontrol.h:58
KDevelop::DVcsJob::DVcsJob
DVcsJob(const QDir &workingDir, KDevelop::IPlugin *parent=nullptr, KDevelop::OutputJob::OutputJobVerbosity verbosity=KDevelop::OutputJob::Verbose)
Definition: dvcsjob.cpp:66
QString
KJob
KDevelop::VcsJob::JobSucceeded
The job succeeded.
Definition: vcsjob.h:88
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Apr 22 2021 23:31:47 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/vcs

Skip menu "kdevplatform/vcs"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal