[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdev-mercurial] /: Implement tag function.
From: Andrey Batyiev <batyiev () gmail ! com>
Date: 2011-07-16 16:08:56
Message-ID: 20110716160856.64C17A60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 7d8103ebad781ada40e8295abddff345f0e8934a by Andrey Batyiev.
Committed on 16/07/2011 at 17:30.
Pushed by abatyiev into branch 'master'.
Implement tag function.
Some fixes to branch handling, more after mq implementation.
M +9 -0 python/kdevmercurial.py
M +3 -1 mercurialplugin.h
M +32 -16 mercurialplugin.cpp
http://commits.kde.org/kdev-mercurial/7d8103ebad781ada40e8295abddff345f0e8934a
diff --git a/mercurialplugin.cpp b/mercurialplugin.cpp
index 0435109..5e5c7b5 100644
--- a/mercurialplugin.cpp
+++ b/mercurialplugin.cpp
@@ -398,7 +398,7 @@ VcsJob* MercurialPlugin::status(const KUrl::List& localLocations, \
IBasicVersionC }
DVcsJob *job = new DVcsJob(findWorkingDir(locations.first()), this);
- *job << "hg" << "--config" << "extensions.kdevmercurial=" EXTENSION_FILE << \
"resolveandstatus" << "--" << locations; + callExtension(*job) << \
"resolveandstatus" << "--" << locations;
connect(job, SIGNAL(readyForParsing(KDevelop::DVcsJob*)), \
SLOT(parseStatus(KDevelop::DVcsJob*)));
@@ -575,50 +575,60 @@ VcsJob* MercurialPlugin::mergeWith(const KUrl &localLocation, \
const KDevelop::Vc return job;
}
-VcsJob* MercurialPlugin::branch(const KUrl& repository, const VcsRevision& rev, \
const QString& branchName) +VcsJob* MercurialPlugin::branch(const KUrl &repository, \
const VcsRevision &rev, const QString &branchName) {
- return 0;
+ DVcsJob *job = new DVcsJob(findWorkingDir(repository), this);
+ *job << "hg" << "branch" << "--" << branchName;
+ return job;
}
-VcsJob* MercurialPlugin::branches(const KUrl& repository)
+VcsJob* MercurialPlugin::branches(const KUrl &repository)
{
- return 0;
+ DVcsJob *job = new DVcsJob(findWorkingDir(repository), this);
+ callExtension(*job) << "allbranches" << "--" << repository;
+ connect(job, SIGNAL(readyForParsing(KDevelop::DVcsJob*)), this, \
SLOT(parseBranchesOutput(KDevelop::DVcsJob*))); + return job;
}
VcsJob* MercurialPlugin::currentBranch(const KUrl& repository)
{
- return 0;
+ DVcsJob *job = new DVcsJob(findWorkingDir(repository), this);
+ *job << "hg" << "branch";
+ connect(job, SIGNAL(readyForParsing(KDevelop::DVcsJob*)), this, \
SLOT(parseBranchesOutput(KDevelop::DVcsJob*))); + return job;
}
-VcsJob* MercurialPlugin::deleteBranch(const KUrl& repository, const QString& \
branchName) +void MercurialPlugin::parseBranchesOutput(DVcsJob *job) const
{
- return 0;
+ job->setResults(job->output().split('\n', QString::SkipEmptyParts));
}
-VcsJob* MercurialPlugin::renameBranch(const KUrl& repository, const QString& \
oldBranchName, const QString& newBranchName) +VcsJob* \
MercurialPlugin::deleteBranch(const KUrl &repository, const QString &branchName) {
return 0;
}
-VcsJob* MercurialPlugin::switchBranch(const KUrl& repository, const QString& \
branchName) +VcsJob* MercurialPlugin::renameBranch(const KUrl &repository, const \
QString &oldBranchName, const QString &newBranchName) {
return 0;
}
-VcsJob* MercurialPlugin::tag(const KUrl& repository, const QString& commitMessage, \
const VcsRevision& rev, const QString& tagName) +VcsJob* \
MercurialPlugin::switchBranch(const KUrl &repository, const QString &branchName) {
- return 0;
+ DVcsJob *job = new DVcsJob(findWorkingDir(repository), this);
+ *job << "hg" << "update" << "--" << branchName;
+ return job;
}
-
-#if 0
-DVcsJob* MercurialPlugin::switchBranch(const QString &repository, const QString \
&branch) +VcsJob* MercurialPlugin::tag(const KUrl &repository, const QString \
&commitMessage, const VcsRevision &rev, const QString &tagName) {
DVcsJob *job = new DVcsJob(findWorkingDir(repository), this);
- *job << "hg" << "update" << "--" << branch;
+ *job << "hg" << "tag" << "-m" << commitMessage << "-r" << \
toMercurialRevision(rev) << "--" << tagName; return job;
}
+
+#if 0
DVcsJob* MercurialPlugin::branch(const QString &repository, const QString \
&basebranch, const QString &branch, const QStringList &args)
{
@@ -1083,5 +1093,11 @@ void MercurialPlugin::showHeads()
headsWidget->show();
}
+DVcsJob& MercurialPlugin::callExtension(DVcsJob &job)
+{
+ job << "hg" << "--config" << "extensions.kdevmercurial=" EXTENSION_FILE;
+ return job;
+}
+
// #include "mercurialplugin.moc"
diff --git a/mercurialplugin.h b/mercurialplugin.h
index 9b4710f..9b62d93 100644
--- a/mercurialplugin.h
+++ b/mercurialplugin.h
@@ -151,7 +151,8 @@ protected slots:
bool parseStatus(KDevelop::DVcsJob *job) const;
bool parseAnnotations(KDevelop::DVcsJob *job) const;
void parseDiff(KDevelop::DVcsJob *job);
-
+ void parseBranchesOutput(KDevelop::DVcsJob *job) const;
+
/*
* mercurial specific stuff
*/
@@ -167,6 +168,7 @@ protected:
void parseLogOutput(const KDevelop::DVcsJob *job, QList<DVcsEvent>& commits) \
const;
static QString toMercurialRevision(const KDevelop::VcsRevision & vcsrev);
+ static KDevelop::DVcsJob& callExtension(KDevelop::DVcsJob &job);
/**
* Remove directories from @p locations.
diff --git a/python/kdevmercurial.py b/python/kdevmercurial.py
index 5265b16..9863586 100644
--- a/python/kdevmercurial.py
+++ b/python/kdevmercurial.py
@@ -28,6 +28,15 @@ def resolve_and_status(ui, repo, *pats, **opts):
ui.write('%\n') # separator
commands.status(ui, repo, *pats, all=True)
+def allbranches(ui, repo, *pats, **opts):
+ branches = repo.branchtags().keys()
+ current_branch = repo.dirstate.branch()
+ if current_branch not in branches:
+ branches.append(current_branch)
+ for branch in branches:
+ ui.write("%s\n" % branch)
+
cmdtable = {
"resolveandstatus" : (resolve_and_status, [], 'Print all status info \
(including resolution state)'), + "allbranches" : (allbranches, [], \
'Print all branches (including uncommited new one)'), }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic