forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user