# # # patch "src/monotone/MonotoneThread.cpp" # from [505d2ba3cf0b500d399fe6db25ba3b2d64bbb77b] # to [cffdc42ec0d0a552d563a3d2781da2473f9ea4a7] # # patch "src/monotone/MonotoneThread.h" # from [d7d6864ee1f51c6d24d161afebfec7110badd985] # to [ec3593fad22238f647fa86f55e11142c75a240ca] # ============================================================ --- src/monotone/MonotoneThread.cpp 505d2ba3cf0b500d399fe6db25ba3b2d64bbb77b +++ src/monotone/MonotoneThread.cpp cffdc42ec0d0a552d563a3d2781da2473f9ea4a7 @@ -134,6 +134,17 @@ QString MonotoneTask::getDecodedOutput(c return codec->toUnicode(output); } +bool MonotoneTask::outOfBandMessagesMatch(MessageType type, const QRegExp & regex) +{ + foreach (MessagePair pair, oobMessages) + { + if (pair.first != type) + continue; + if (regex.indexIn(QString(pair.second)) >= 0) + return true; + } + return false; +} const int MonotoneThread::StdioBufferSize = 50 * 1024 * 1024; @@ -436,10 +447,12 @@ void MonotoneThread::run() buffer = parser.getLeftBytes(); output.append(parser.getPayload()); - typedef QPair MessagePair; + // store and log out-of-band messages + QList msgs = parser.getOutOfBandMessages(); - // for now simply log out of band messages - foreach (MessagePair pair, parser.getOutOfBandMessages()) + task->appendOutOfBandMessages(msgs); + + foreach (MessagePair pair, msgs) { QString msg = QString("monotone reports for thread %1, task %2: %3") ============================================================ --- src/monotone/MonotoneThread.h d7d6864ee1f51c6d24d161afebfec7110badd985 +++ src/monotone/MonotoneThread.h ec3593fad22238f647fa86f55e11142c75a240ca @@ -31,6 +31,8 @@ public: class MonotoneTask { public: + typedef enum {Warning = 'w', Info = 'p', Error = 'e' } MessageType; + MonotoneTask(); MonotoneTask(const MonotoneTask &); MonotoneTask(const QStringList &); @@ -56,6 +58,12 @@ public: //! set the output encoding void setOutputEncoding(const QString & e) { outputEncoding = e; } + //! appends more out-of-band messages for this task + void appendOutOfBandMessages(const QList & msgs) { oobMessages.append(msgs); } + + //! returns true if one or more out-of-band messages match the given regex + bool outOfBandMessagesMatch(MessageType, const QRegExp &); + //! returns the command input stdio-encoded QByteArray getEncodedInput() const; @@ -103,6 +111,7 @@ private: ByteArrayList options; QByteArray output; QString outputEncoding; + QList oobMessages; }; class MonotoneThread : public QThread