# # # patch "guitone/res/i18n/guitone_de.ts" # from [5929ed1a92db7f99aea94ecff0b1466f0fe56875] # to [b5823e3c8a31134b5d3e66183dc31cbca87667fc] # # patch "guitone/src/model/ContentDiff.cpp" # from [f74110c0210d6d398c7348944731019fc3347285] # to [ff90490d569d7e0ecdf52720a47172a39ee6310e] # # patch "guitone/src/model/GetFile.cpp" # from [c9ebb1036f63cf60870a2479d4aa968ce2e2db34] # to [cca2f1587219c6967e807541bf215cef57968b98] # # patch "guitone/src/model/MonotoneDelegate.cpp" # from [f564813b79704ada15184afc670d077161002e85] # to [7717d175700657e27fe81db82595a0bfb6469db7] # # patch "guitone/src/monotone/Monotone.cpp" # from [5385c818c891beae88caba3a4be7db005e543a0e] # to [7e7fa6a461dc8ed10888f2778d80b1566a0d3c53] # # patch "guitone/src/monotone/Monotone.h" # from [8af821da17fcc7994eff7545e685ba5ae73013dc] # to [44a8a36ea6ac22617789013e6fc7a71b9ed4db07] # # patch "guitone/src/util/StdioParser.cpp" # from [38a3832f54e41349f8cfabd7c7264941ca86eddb] # to [b894e44d45d149735e1d968010c04233b7d71f53] # # patch "guitone/src/util/StdioParser.h" # from [59d4575d22272d7beed48c8c92e02b269baa13aa] # to [574de09b168bb7d8c1530db5913b05354f667243] # # patch "guitone/src/view/dialogs/GenerateKeypair.cpp" # from [a13cb1a8d2d59c4d5c1482b463264829ce7dc3bc] # to [b01d54d34c43b82259dd4015fa7896cb57cbbb7c] # # patch "guitone/src/view/dialogs/RevisionManifest.cpp" # from [5a224c000a43c839dbd6294a438ba6afdec2b542] # to [0b56310b9fb25eac8930946f251eafbdb0264fde] # ============================================================ --- guitone/res/i18n/guitone_de.ts 5929ed1a92db7f99aea94ecff0b1466f0fe56875 +++ guitone/res/i18n/guitone_de.ts b5823e3c8a31134b5d3e66183dc31cbca87667fc @@ -949,7 +949,7 @@ monotone gab zurück: %2 - + The monotone process exited unexpectedly (return code %1). Please reconfigure the path to the monotone binary in the Preferences dialog or check if the version of the database you try to load matches the monotone version you are using. monotone returned: ============================================================ --- guitone/src/model/ContentDiff.cpp f74110c0210d6d398c7348944731019fc3347285 +++ guitone/src/model/ContentDiff.cpp ff90490d569d7e0ecdf52720a47172a39ee6310e @@ -72,7 +72,7 @@ bool ContentDiff::readDiff( return false; } - leftRevision = mtn->getDataAndReset(); + leftRevision = mtn->getDecodedDataAndReset(); leftRevision.chop(1); } ============================================================ --- guitone/src/model/GetFile.cpp c9ebb1036f63cf60870a2479d4aa968ce2e2db34 +++ guitone/src/model/GetFile.cpp cca2f1587219c6967e807541bf215cef57968b98 @@ -47,7 +47,7 @@ bool GetFile::readFileByName(QString fil return false; } - QString baseRevision = mtn->getDataAndReset(); + QString baseRevision = mtn->getDecodedDataAndReset(); baseRevision.chop(1); return readFileByName(fileName, baseRevision); ============================================================ --- guitone/src/model/MonotoneDelegate.cpp f564813b79704ada15184afc670d077161002e85 +++ guitone/src/model/MonotoneDelegate.cpp 7717d175700657e27fe81db82595a0bfb6469db7 @@ -35,7 +35,7 @@ bool MonotoneDelegate::triggerCommand(co bool MonotoneDelegate::triggerCommand(const QStringList & cmd, const QStringList & opts) { - Monotone *mtn = Monotone::singleton(); + Monotone * mtn = Monotone::singleton(); connect( mtn, SIGNAL(commandFinished(int)), @@ -49,14 +49,15 @@ void MonotoneDelegate::commandFinished(i void MonotoneDelegate::commandFinished(int retCode) { - Monotone *mtn = Monotone::singleton(); + Monotone * mtn = Monotone::singleton(); disconnect( mtn, SIGNAL(commandFinished(int)), this, SLOT(commandFinished(int)) ); - cmdModel->setAutomateData(mtn->getDataAndReset()); + // FIXME: does any of our models ever need the raw data? + cmdModel->setAutomateData(mtn->getDecodedDataAndReset()); if (retCode == 0) { @@ -66,7 +67,7 @@ void MonotoneDelegate::commandFinished(i { if (!cmdModel->handleError(retCode)) { - qDebug("MonotoneDelegate::commandFinished: couldn't handle error %d", retCode); + qCritical("MonotoneDelegate::commandFinished: couldn't handle error %d", retCode); } } ============================================================ --- guitone/src/monotone/Monotone.cpp 5385c818c891beae88caba3a4be7db005e543a0e +++ guitone/src/monotone/Monotone.cpp 7e7fa6a461dc8ed10888f2778d80b1566a0d3c53 @@ -73,7 +73,7 @@ // it at the right time. // // After parsing the output is made available to the calling process by -// getDataAndReset() - this function also resets the "processing" flag which +// get*DataAndReset() - this functions also reset the "processing" flag which // blocks further attempts to use the stdio communication.. // @@ -97,7 +97,7 @@ const QString Monotone::RequiredInterfac const QString Monotone::RequiredProgramVersion = "0.32"; const QString Monotone::RequiredInterfaceVersion = "4.0"; -const int Monotone::StdioBufferSize = 50 * 1024 * 1024; +const int Monotone::StdioBufferSize = 80; //50 * 1024 * 1024; const int Monotone::TimeoutWaitForOtherCommand = 5000; // milliseconds Monotone::Monotone(QObject * parent) : QObject(parent), process(0) @@ -488,43 +488,34 @@ bool Monotone::readAndParseStdout(int & input = input.mid(parser.getCharPos()); output.append(parser.getPayload()); - + qDebug("Current output: %s", output.data()); // check if this was the last output - if (parser->getChunkType() == 'l') + if (parser.getChunkType() == 'l') { Q_ASSERT(input.length() == 0); - retCode = parser.getErrorNumber(); - - // if the command did not return successfully, try to strip - // prefixes from the error output - if (retCode > 0) - { - - // FIXME: convert the code here - - - output = stripMtnPrefix(output); - } - + retCode = parser.getErrorCode(); // command successfully parsed return true; } - // if this was not the last output, but there are no bytes left, - // we need to wait for further data - if (input.size() == 0) - { - return false; - } + // if this was not the last output, we need to wait for more data + return false; } -QString Monotone::getDataAndReset() +QByteArray Monotone::getRawDataAndReset() { - QString data(output); + QByteArray data(output); reset(); return data; } +QString Monotone::getDecodedDataAndReset() +{ + QString data = QString::fromUtf8(output.data()); + reset(); + return data; +} + void Monotone::reset() { isProcessingData = false; ============================================================ --- guitone/src/monotone/Monotone.h 8af821da17fcc7994eff7545e685ba5ae73013dc +++ guitone/src/monotone/Monotone.h 44a8a36ea6ac22617789013e6fc7a71b9ed4db07 @@ -51,7 +51,8 @@ class Monotone : public QObject bool executeCommand(const QStringList &, int &); bool executeCommand(const QStringList &, const QStringList &, int &); - QString getDataAndReset(); + QString getDecodedDataAndReset(); + QByteArray getRawDataAndReset(); void reset(); private: ============================================================ --- guitone/src/util/StdioParser.cpp 38a3832f54e41349f8cfabd7c7264941ca86eddb +++ guitone/src/util/StdioParser.cpp b894e44d45d149735e1d968010c04233b7d71f53 @@ -44,13 +44,15 @@ bool StdioParser::parse() ); Q_ASSERT(getNext() == ':'); chunkSize = getNumber(); + Q_ASSERT(getNext() == ':'); - if (chunkSize > charsLeft()) + int charsLeft = size - charPos; + if (chunkSize > charsLeft) { return false; } - payload = in.mid(chunkSize); + payload = in.mid(charPos, chunkSize); advance(chunkSize); return true; @@ -96,8 +98,3 @@ char StdioParser::getNext() return ch; } -int StdioParser::charsLeft() -{ - return size-charPos; -} - ============================================================ --- guitone/src/util/StdioParser.h 59d4575d22272d7beed48c8c92e02b269baa13aa +++ guitone/src/util/StdioParser.h 574de09b168bb7d8c1530db5913b05354f667243 @@ -22,6 +22,7 @@ #define STDIO_PARSER_H #include +#include class StdioParser : public QObject { @@ -30,8 +31,8 @@ public: StdioParser(const QByteArray &); ~StdioParser(); bool parse(); - inline int getCommandNumber() { return commandNumner; } - inline int getErrorNumber() { return errorNumber; } + inline int getCommandNumber() { return commandNumber; } + inline int getErrorCode() { return errorCode; } inline char getChunkType() { return chunkType; } inline int getChunkSize() { return chunkSize; } inline QByteArray getPayload() { return payload; } @@ -41,11 +42,10 @@ private: char whatsNext(int count = 0); char getNext(); void advance(int count = 1); - int charsLeft(); int getNumber(); int commandNumber; - int errorNumber; + int errorCode; char chunkType; int chunkSize; QByteArray payload; ============================================================ --- guitone/src/view/dialogs/GenerateKeypair.cpp a13cb1a8d2d59c4d5c1482b463264829ce7dc3bc +++ guitone/src/view/dialogs/GenerateKeypair.cpp b01d54d34c43b82259dd4015fa7896cb57cbbb7c @@ -81,7 +81,7 @@ void GenerateKeypair::accept() QMessageBox::critical( this, tr("Error creating keypair"), - tr("There was an error creating the keypair:\n%1").arg(mtn->getDataAndReset()), + tr("There was an error creating the keypair:\n%1").arg(mtn->getDecodedDataAndReset()), QMessageBox::Ok, 0, 0 ); return; ============================================================ --- guitone/src/view/dialogs/RevisionManifest.cpp 5a224c000a43c839dbd6294a438ba6afdec2b542 +++ guitone/src/view/dialogs/RevisionManifest.cpp 0b56310b9fb25eac8930946f251eafbdb0264fde @@ -126,7 +126,7 @@ void RevisionManifest::openFile(const QM // FIXME: we must write the original QByteArray here instead of messing // around with strings, but for this the Monotone wrapper has - once again - // to be rewritten first... - file.write(mtn->getDataAndReset().toUtf8()); + file.write(mtn->getRawDataAndReset()); file.close(); if (!OpenFile::open(this, tempFile))