Parse the workspace active tags and revision

FossilOrigin-Name: 2bf8e2a8aba307659c07044e1e6d155d287ac6b6
This commit is contained in:
kostas
2015-05-02 18:22:31 +00:00
parent 4cd2e6e5b4
commit cc029b674f
4 changed files with 42 additions and 8 deletions

View File

@ -50,6 +50,21 @@ RepoStatus Fossil::getRepoStatus()
projectName = value;
else if(key=="repository")
repositoryFile = value;
else if(key=="checkout")
{
// f2121dad5e4565f55ed9ef882484dd5934af565f 2015-04-26 17:27:39 UTC
QStringList tokens = value.split(' ', QString::SkipEmptyParts);
Q_ASSERT(tokens.length()>0);
currentRevision = tokens[0].trimmed();
}
else if(key=="tags")
{
currentTags.clear();
QStringList tokens = value.split(',', QString::SkipEmptyParts);
foreach(const QString &tag, tokens)
currentTags.append(tag);
currentTags.sort();
}
}
}
@ -444,6 +459,16 @@ bool Fossil::tagList(QStringList& tags)
return true;
}
//------------------------------------------------------------------------------
bool Fossil::tagNew(const QString& name, const QString& revision)
{
QStringList res;
if(!runFossil(QStringList() << "tag" << "add" << name << revision, &res, RUNFLAGS_SILENT_ALL))
return false;
return true;
}
//------------------------------------------------------------------------------
bool Fossil::branchList(QStringList& branches, QStringList& activeBranches)
{

View File

@ -3,6 +3,7 @@
class QStringList;
#include <QString>
#include <QStringList>
#include <QObject>
#include <QProcess>
#include "Utils.h"
@ -111,8 +112,14 @@ public:
void abortOperation() { operationAborted = true; }
bool tagList(QStringList& tags);
bool tagNew(const QString& name, const QString& revision);
bool tagDelete(const QString& name);
bool branchList(QStringList& branches, QStringList& activeBranches);
const QString &getCurrentRevision() const { return currentRevision; }
const QStringList &getCurrentTags() const { return currentTags; }
private:
void log(const QString &text, bool isHTML=false)
{
@ -128,6 +135,8 @@ private:
QString fossilPath; // The value from the settings
QString repositoryFile;
QString projectName;
QString currentRevision;
QStringList currentTags;
QProcess fossilUI;
};