Commit aa5ebb3c authored by Evgeniy Ivanov's avatar Evgeniy Ivanov
Browse files

Log and Status for gitThe same changes in DVCSplugin (but no changes in Bazaar or Mercurial

parent f1cbd396
......@@ -21,6 +21,7 @@ set(kdevgit_PART_SRCS
${CMAKE_SOURCE_DIR}/vcs/dvcs/dvcsgenericoutputview.cpp
${CMAKE_SOURCE_DIR}/vcs/dvcs/importdialog.cpp
${CMAKE_SOURCE_DIR}/vcs/dvcs/importmetadatawidget.cpp
${CMAKE_SOURCE_DIR}/vcs/dvcs/logview.cpp
gitplugin.cpp
gitexecutor.cpp
)
......@@ -30,6 +31,7 @@ set(kdevgit_PART_UI
${CMAKE_SOURCE_DIR}/vcs/dvcs/cvsgenericoutputview.ui
${CMAKE_SOURCE_DIR}/vcs/dvcs/cvsmainview.ui
${CMAKE_SOURCE_DIR}/vcs/dvcs/importmetadatawidget.ui
${CMAKE_SOURCE_DIR}/vcs/dvcs/logview.ui
)
kde4_add_ui_files(kdevgit_PART_SRCS ${kdevgit_PART_UI})
......
......@@ -215,11 +215,13 @@ DVCSjob* GitExecutor::remove(const QString& repository, const KUrl::List &files)
DVCSjob* GitExecutor::status(const QString & repository, const KUrl::List & files, bool recursive, bool taginfo)
{
Q_UNUSED(files)
Q_UNUSED(recursive)
Q_UNUSED(taginfo)
DVCSjob* job = new DVCSjob(vcsplugin);
if (prepareJob(job, repository) ) {
*job << "git";
*job << "status";
addFileList(job, repository, files);
return job;
}
......@@ -227,6 +229,23 @@ DVCSjob* GitExecutor::status(const QString & repository, const KUrl::List & file
return NULL;
}
DVCSjob* GitExecutor::log(const KUrl& url)
{
QFileInfo info(url.toLocalFile());
if (!info.isFile())
return false;
DVCSjob* job = new DVCSjob(vcsplugin);
if (prepareJob(job, info.absolutePath()) ) {
*job << "git";
*job << "log";
*job << info.fileName();
return job;
}
if (job) delete job;
return NULL;
}
// DVCSjob* GitExecutor::is_inside_work_tree(const QString& repository)
// {
//
......@@ -254,4 +273,36 @@ DVCSjob* GitExecutor::empty_cmd() const
return job;
}
//Actually we can just copy the outpuc without parsing. So it's a kind of draft for future
void GitExecutor::parseOutput(const QString& jobOutput, QList<DVCScommit>& commits) const
{
// static QRegExp rx_sep( "[-=]+" );
// static QRegExp rx_date( "date:\\s+([^;]*);\\s+author:\\s+([^;]*).*" );
static QRegExp rx_com( "commit \\w{1,40}" );
QStringList lines = jobOutput.split("\n");
DVCScommit item;
for (int i=0; i<lines.count(); ++i) {
QString s = lines[i];
kDebug(9500) << "line:" << s ;
if (rx_com.exactMatch(s)) {
kDebug(9500) << "MATCH COMMIT";
item.commit = s;
s = lines[++i];
item.author = s;
s = lines[++i];
item.date = s;
commits.append(item);
}
else
{
item.log += s+'\n';
}
}
}
// #include "hgexetor.moc"
......@@ -82,10 +82,13 @@ class GitExecutor : public QObject, public KDevelop::IDVCSexecutor
DVCSjob* remove(const QString& repository, const KUrl::List& files);
DVCSjob* status(const QString & repo, const KUrl::List & files,
bool recursive=false, bool taginfo=false);
DVCSjob* log(const KUrl& url);
/* DVCSjob* is_inside_work_tree(const QString& repository);*/
DVCSjob* var(const QString &directory);
DVCSjob* empty_cmd() const;
void parseOutput(const QString& jobOutput, QList<DVCScommit>& commits) const;
private:
bool addFileList(DVCSjob* job, const QString& repository, const KUrl::List& urls);
// QString convertVcsRevisionToString(const KDevelop::VcsRevision& rev);
......
......@@ -26,6 +26,8 @@
#include <icore.h>
#include "vcsjob.h"
#include "vcsrevision.h"
#include <dvcsjob.h>
#include "gitexecutor.h"
......@@ -52,4 +54,24 @@ GitPlugin::~GitPlugin()
delete DistributedVersionControlPlugin::d;
}
KDevelop::VcsJob*
GitPlugin::log(const KUrl& localLocation,
const KDevelop::VcsRevision& rev,
unsigned long limit)
{
Q_UNUSED(limit)
DVCSjob* job = d->m_exec->log(localLocation);
return job;
}
KDevelop::VcsJob*
GitPlugin::log(const KUrl& localLocation,
const KDevelop::VcsRevision& rev,
const KDevelop::VcsRevision& limit)
{
Q_UNUSED(limit)
return log(localLocation, rev, 0);
}
// #include "gitplugin.moc"
......@@ -25,6 +25,12 @@
#include <dvcs/dvcsplugin.h>
#include <qobject.h>
namespace KDevelop
{
class VcsJob;
class VcsRevision;
}
class GitExecutor;
/**
......@@ -43,6 +49,14 @@ friend class GitExecutor;
public:
GitPlugin(QObject *parent, const QVariantList & args = QVariantList() );
~GitPlugin();
//TODO:Things to be moved to DVCSplugin, but not moved because require executor changes in all implemented DVCS
KDevelop::VcsJob* log(const KUrl& localLocation,
const KDevelop::VcsRevision& rev,
unsigned long limit);
KDevelop::VcsJob* log(const KUrl& localLocation,
const KDevelop::VcsRevision& rev,
const KDevelop::VcsRevision& limit);
};
......
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