Commit ed9b4412 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Adapt to changes in kdevplatform.

Add implementation for ::copy and ::move.
parent e5265555
......@@ -39,6 +39,7 @@
#include <vcs/dvcs/dvcsjob.h>
#include <vcs/vcsannotation.h>
#include <QDateTime>
#include <KIO/CopyJob>
K_PLUGIN_FACTORY(KDevGitFactory, registerPlugin<GitPlugin>(); )
K_EXPORT_PLUGIN(KDevGitFactory(KAboutData("kdevgit","kdevgit",ki18n("Git"),"0.1",ki18n("A plugin to support git version control systems"), KAboutData::License_GPL)))
......@@ -970,9 +971,9 @@ DVcsJob* GitPlugin::gitRevList(const QString &repository, const QStringList &arg
*job << arg;
return job;
}
if (job)
delete job;
return NULL;
delete job;
return 0;
}
KDevelop::VcsStatusInfo::State GitPlugin::charToState(char ch)
......@@ -991,4 +992,71 @@ KDevelop::VcsStatusInfo::State GitPlugin::charToState(char ch)
return VcsStatusInfo::ItemUnknown;
}
// #include "gitplugin.moc"
StandardCopyJob::StandardCopyJob(IPlugin* parent, const KUrl& source, const KUrl& dest,
OutputJob::OutputJobVerbosity verbosity)
: VcsJob(parent, verbosity)
, m_source(source), m_dest(dest)
, m_plugin(parent)
, m_status(JobNotStarted)
{}
void StandardCopyJob::start()
{
KIO::CopyJob* job=KIO::copy(m_source, m_dest);
connect(job, SIGNAL(result(KJob*)), SLOT(result(KJob*)));
job->start();
m_status=JobRunning;
}
void StandardCopyJob::result(KJob* job)
{
m_status=job->error() == 0? JobSucceeded : JobFailed; emitResult();
}
VcsJob* GitPlugin::copy(const KUrl& localLocationSrc, const KUrl& localLocationDstn)
{
//TODO: Probably we should "git add" after
return new StandardCopyJob(this, localLocationSrc, localLocationDstn, KDevelop::OutputJob::Silent);
}
VcsJob* GitPlugin::move(const KUrl& source, const KUrl& destination)
{
DVcsJob* job = new DVcsJob(this);
if (prepareJob(job, source.toLocalFile())) {
*job << "git" << "mv" << source.toLocalFile() << destination.toLocalFile();
return job;
}
delete job;
return 0;
}
VcsJob* GitPlugin::pull(const KDevelop::VcsLocation& localOrRepoLocationSrc, const KUrl& localRepositoryLocation)
{
empty_cmd();
return 0;
}
VcsJob* GitPlugin::push(const KUrl& localRepositoryLocation, const KDevelop::VcsLocation& localOrRepoLocationDst)
{
empty_cmd();
return 0;
}
VcsJob* GitPlugin::resolve(const KUrl::List& localLocations, IBasicVersionControl::RecursionMode recursion)
{
empty_cmd();
return 0;
}
VcsJob* GitPlugin::update(const KUrl::List& localLocations, const KDevelop::VcsRevision& rev, IBasicVersionControl::RecursionMode recursion)
{
empty_cmd();
return 0;
}
VcsJob* GitPlugin::repositoryLocation(const KUrl& localLocation)
{
empty_cmd();
return 0;
}
......@@ -27,6 +27,7 @@
#include <QObject>
#include <vcs/vcsstatusinfo.h>
#include <outputview/outputjob.h>
#include <vcs/vcsjob.h>
namespace KDevelop
......@@ -35,6 +36,27 @@ namespace KDevelop
class VcsRevision;
}
class StandardCopyJob : public KDevelop::VcsJob
{
Q_OBJECT
public:
StandardCopyJob(KDevelop::IPlugin* parent, const KUrl& source,
const KUrl& dest, OutputJobVerbosity verbosity);
virtual QVariant fetchResults() { return QVariant(); }
virtual void start();
virtual JobStatus status() const { return m_status; }
virtual KDevelop::IPlugin* vcsPlugin() const { return m_plugin; }
public slots:
void result(KJob*);
private:
const KUrl m_source, m_dest;
KDevelop::IPlugin* m_plugin;
JobStatus m_status;
};
/**
* This is the main class of KDevelop's Git plugin.
*
......@@ -55,6 +77,17 @@ public:
QString name() const;
bool isVersionControlled(const KUrl &path);
virtual KDevelop::VcsJob* copy(const KUrl& localLocationSrc, const KUrl& localLocationDstn);
virtual KDevelop::VcsJob* move(const KUrl& localLocationSrc, const KUrl& localLocationDst);
//TODO
virtual KDevelop::VcsJob* pull(const KDevelop::VcsLocation& localOrRepoLocationSrc, const KUrl& localRepositoryLocation);
virtual KDevelop::VcsJob* push(const KUrl& localRepositoryLocation, const KDevelop::VcsLocation& localOrRepoLocationDst);
virtual KDevelop::VcsJob* repositoryLocation(const KUrl& localLocation);
virtual KDevelop::VcsJob* resolve(const KUrl::List& localLocations, RecursionMode recursion);
virtual KDevelop::VcsJob* update(const KUrl::List& localLocations, const KDevelop::VcsRevision& rev, RecursionMode recursion);
//End of
KDevelop::VcsJob* add(const KUrl::List& localLocations,
KDevelop::IBasicVersionControl::RecursionMode recursion = KDevelop::IBasicVersionControl::Recursive);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment