Introduce ExitCodeInterpreter, useful when exit code != 0 is valid

Task-number: QTCREATORBUG-10207

Change-Id: I3b440d40a968f09afc613b686ee50da6465ad88e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
jkobus
2013-09-24 16:40:10 +02:00
committed by Jarek Kobus
parent 005bef9295
commit 696b0a8b80
8 changed files with 106 additions and 25 deletions

View File

@@ -31,6 +31,7 @@
#include <vcsbase/vcsbaseplugin.h>
#include <vcsbase/vcsbaseeditorparameterwidget.h>
#include <utils/synchronousprocess.h>
#include <QDir>
#include <QFileInfo>
@@ -40,6 +41,22 @@
namespace Bazaar {
namespace Internal {
class BazaarDiffExitCodeInterpreter : public Utils::ExitCodeInterpreter
{
Q_OBJECT
public:
BazaarDiffExitCodeInterpreter(QObject *parent) : Utils::ExitCodeInterpreter(parent) {}
Utils::SynchronousProcessResponse::Result interpretExitCode(int code) const;
};
Utils::SynchronousProcessResponse::Result BazaarDiffExitCodeInterpreter::interpretExitCode(int code) const
{
if (code < 0 || code > 2)
return Utils::SynchronousProcessResponse::FinishedError;
return Utils::SynchronousProcessResponse::Finished;
}
BazaarClient::BazaarClient(BazaarSettings *settings) :
VcsBase::VcsBaseClient(settings)
{
@@ -142,6 +159,16 @@ QString BazaarClient::vcsCommandString(VcsCommand cmd) const
}
}
Utils::ExitCodeInterpreter *BazaarClient::exitCodeInterpreter(VcsCommand cmd, QObject *parent) const
{
switch (cmd) {
case DiffCommand:
return new BazaarDiffExitCodeInterpreter(parent);
default:
return 0;
}
}
QStringList BazaarClient::revisionSpec(const QString &revision) const
{
QStringList args;