# HG changeset patch # User Chris Cannam # Date 1290783010 0 # Node ID 0f039d3cc38ecfa96e8af5abab11f1651f575d52 # Parent 1721c580c10eb9801216df5f8c763f86c98d5c9c * Separate out the hgrunner output into stdout and stderr again (merging them was a failed experiment) diff -r 1721c580c10e -r 0f039d3cc38e hgaction.h --- a/hgaction.h Fri Nov 26 12:48:29 2010 +0000 +++ b/hgaction.h Fri Nov 26 14:50:10 2010 +0000 @@ -65,21 +65,7 @@ HgAction(HGACTIONS _action, QString _wd, QStringList _params) : action(_action), workingDir(_wd), params(_params) { } -/* - HgAction(const HgAction &a) : - action(a.action), workingDir(a.workingDir), - params(a.params), executable(a.executable) { } - HgAction &operator=(const HgAction &a) { - if (&a != this) { - action = a.action; - workingDir = a.workingDir; - params = a.params; - executable = a.executable; - } - return *this; - } -*/ bool operator==(const HgAction &a) { return (a.action == action && a.workingDir == workingDir && a.params == params && a.executable == executable); @@ -91,6 +77,10 @@ case ACT_PUSH: case ACT_PULL: case ACT_CLONEFROMREMOTE: + case ACT_FILEDIFF: + case ACT_FOLDERDIFF: + case ACT_CHGSETDIFF: + case ACT_SERVE: return true; default: return false; diff -r 1721c580c10e -r 0f039d3cc38e hgrunner.cpp --- a/hgrunner.cpp Fri Nov 26 12:48:29 2010 +0000 +++ b/hgrunner.cpp Fri Nov 26 14:50:10 2010 +0000 @@ -50,18 +50,17 @@ env.insert("HGPLAIN", "1"); m_proc->setProcessEnvironment(env); - m_proc->setProcessChannelMode(QProcess::MergedChannels); - setTextVisible(false); setVisible(false); m_isRunning = false; - m_output.clear(); - connect(m_proc, SIGNAL(started()), this, SLOT(started())); connect(m_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finished(int, QProcess::ExitStatus))); - connect(m_proc, SIGNAL(readyRead()), this, SLOT(dataReady())); + connect(m_proc, SIGNAL(readyReadStandardOutput()), + this, SLOT(dataReadyStdout())); + connect(m_proc, SIGNAL(readyReadStandardError()), + this, SLOT(dataReadyStderr())); } HgRunner::~HgRunner() @@ -202,11 +201,19 @@ } } -void HgRunner::dataReady() +void HgRunner::dataReadyStdout() { - DEBUG << "dataReady" << endl; - QString chunk = QString::fromUtf8(m_proc->readAll()); - m_output += chunk; + DEBUG << "dataReadyStdout" << endl; + QString chunk = QString::fromUtf8(m_proc->readAllStandardOutput()); + m_stdout += chunk; + checkPrompts(chunk); +} + +void HgRunner::dataReadyStderr() +{ + DEBUG << "dataReadyStderr" << endl; + QString chunk = QString::fromUtf8(m_proc->readAllStandardError()); + m_stderr += chunk; checkPrompts(chunk); } @@ -230,12 +237,10 @@ if (procExitCode == 0 && procExitStatus == QProcess::NormalExit) { DEBUG << "HgRunner::finished: Command completed successfully" << endl; - //!!! NB this is all output not stdout as it should be - emit commandCompleted(completedAction, m_output); + emit commandCompleted(completedAction, m_stdout); } else { DEBUG << "HgRunner::finished: Command failed" << endl; - //!!! NB this is all output not stderr as it should be - emit commandFailed(completedAction, m_output); + emit commandFailed(completedAction, m_stderr); } checkQueue(); @@ -296,7 +301,8 @@ m_isRunning = true; setRange(0, 0); show(); - m_output.clear(); + m_stdout.clear(); + m_stderr.clear(); m_realm = ""; m_userName = ""; diff -r 1721c580c10e -r 0f039d3cc38e hgrunner.h --- a/hgrunner.h Fri Nov 26 12:48:29 2010 +0000 +++ b/hgrunner.h Fri Nov 26 14:50:10 2010 +0000 @@ -37,7 +37,7 @@ ~HgRunner(); void requestAction(HgAction action); -/* +/*!!! bool isCommandRunning(); void killCurrentCommand(); @@ -50,7 +50,8 @@ private slots: void started(); void finished(int procExitCode, QProcess::ExitStatus procExitStatus); - void dataReady(); + void dataReadyStdout(); + void dataReadyStderr(); private: void checkQueue(); @@ -72,7 +73,8 @@ bool m_isRunning; QProcess *m_proc; - QString m_output; + QString m_stdout; + QString m_stderr; QString m_userName; QString m_realm;