Commit 2498560e authored by Evgeniy Ivanov's avatar Evgeniy Ivanov
Browse files

Squashed commit of the following:

    Fixes for Krazy;
    All dvcs ui items moved to dvcs/ui;
    Branch manager UI implementation;
parent c9f0bf78
......@@ -120,6 +120,7 @@ DVCSjob* GitExecutor::commit(const QString& repository,
const QString &message, /*= "KDevelop didn't provide any message, it may be a bug"*/
const KUrl::List &args /*= QStringList("")*/)
{
Q_UNUSED(args)
DVCSjob* job = new DVCSjob(vcsplugin);
if (prepareJob(job, repository) ) {
*job << "git-commit";
......@@ -212,6 +213,80 @@ DVCSjob* GitExecutor::checkout(const QString &repository, const QString &branch)
return NULL;
}
DVCSjob* GitExecutor::branch(const QString &repository, const QString &basebranch, const QString &branch,
const QStringList &args)
{
DVCSjob* job = new DVCSjob(vcsplugin);
if (prepareJob(job, repository) ) {
*job << "git-branch";
//Empty branch has 'something' so it breaks the command
if (!args.isEmpty())
*job << args.join(" ");
if (!branch.isEmpty())
*job << branch;
if (!basebranch.isEmpty())
*job << basebranch;
return job;
}
if (job) delete job;
return NULL;
}
QString GitExecutor::curBranch(const QString &repository)
{
DVCSjob* job = branch(repository);
if (job)
{
kDebug() << "Getting branch list";
job->exec();
while (job->status() == KDevelop::VcsJob::JobRunning)
;
}
QString branch;
if (job->status() == KDevelop::VcsJob::JobSucceeded)
branch = job->output();
branch = branch.prepend('\n').section("\n*", 1);
branch = branch.section('\n', 0, 0).trimmed();
kDebug() << "Current branch is: " << branch;
return branch;
}
QStringList GitExecutor::branches(const QString &repository)
{
DVCSjob* job = branch(repository);
if (job)
{
kDebug() << "Getting branch list";
job->exec();
while (job->status() == KDevelop::VcsJob::JobRunning)
;
}
QStringList branchListDirty;
// branches<< "master" << "test" << "brrr" << "br2";
if (job->status() == KDevelop::VcsJob::JobSucceeded)
branchListDirty = job->output().split('\n');
else
return QStringList();
QStringList branchList;
foreach(QString branch, branchListDirty)
{
if (branch.contains("*"))
{
branch = branch.prepend('\n').section("\n*", 1);
branch = branch.trimmed();
}
else
{
branch = branch.prepend('\n').section("\n", 1);
branch = branch.trimmed();
}
branchList<<branch;
}
return branchList;
}
//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
{
......
......@@ -67,7 +67,7 @@ class GitExecutor : public QObject, public KDevelop::IDVCSexecutor
{
Q_OBJECT
public:
GitExecutor(KDevelop::IPlugin* parent = 0);
explicit GitExecutor(KDevelop::IPlugin* parent = 0);
~GitExecutor();
bool isValidDirectory(const KUrl &dirPath);
......@@ -77,7 +77,7 @@ public:
DVCSjob* clone(const KUrl &directory, const KUrl repository);
DVCSjob* add(const QString& repository, const KUrl::List &files);
DVCSjob* commit(const QString& repository,
const QString& message = "KDevelop didn't provide any message, it may be a bug",
const QString& message = "KDevelop did not provide any message, it may be a bug",
const KUrl::List& args = QStringList());
DVCSjob* remove(const QString& repository, const KUrl::List& files);
DVCSjob* status(const QString & repo, const KUrl::List & files,
......@@ -87,6 +87,11 @@ public:
DVCSjob* empty_cmd() const;
DVCSjob* checkout(const QString &repository, const QString &branch);
DVCSjob* branch(const QString &repository, const QString &basebranch = QString(), const QString &branch = QString(),
const QStringList &args = QStringList());
//parsers for branch:
QString curBranch(const QString &repository);
QStringList branches(const QString &repository);
void parseOutput(const QString& jobOutput, QList<DVCScommit>& commits) const;
......
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