# # # patch "src/model/GetContentChanged.cpp" # from [d0db3a1357e29cb5dfd5a5320ba464331d2541bb] # to [ce555349e11ada4c5e5212099806c1a62741f2fc] # # patch "src/model/GetContentChanged.h" # from [3d41d6ca1786efb70146dc952719a3896651de90] # to [a9265c18e8ec3639c6aa5248da12bbd0350b844d] # ============================================================ --- src/model/GetContentChanged.cpp d0db3a1357e29cb5dfd5a5320ba464331d2541bb +++ src/model/GetContentChanged.cpp ce555349e11ada4c5e5212099806c1a62741f2fc @@ -30,11 +30,6 @@ GetContentChanged::~GetContentChanged() GetContentChanged::~GetContentChanged() { - if (commandStack.size() > 0) - { - W("Unfinished commands."); - } - revisions.clear(); pathInRevision.clear(); } @@ -79,45 +74,24 @@ void GetContentChanged::queryContentChan void GetContentChanged::queryContentChanged(const QString & rev, const QString & path) { - commandStack.enqueue(ContentChanged); - MonotoneTask task(QStringList() << "get_content_changed" << rev << path); AutomateCommand::enqueueDatabaseTask(databaseFile, task); } void GetContentChanged::queryParents(const QString & rev) { - commandStack.enqueue(Parents); - MonotoneTask task(QStringList() << "parents" << rev); AutomateCommand::enqueueDatabaseTask(databaseFile, task); } void GetContentChanged::queryCorrespondingPath(const QString & rev, const QString & path, const QString & par) { - commandStack.enqueue(CorrespondingPath); - MonotoneTask task(QStringList() << "get_corresponding_path" << rev << path << par); AutomateCommand::enqueueDatabaseTask(databaseFile, task); } void GetContentChanged::processTaskResult(const MonotoneTask & task) { - if (task.getReturnCode() == 2) - { - // FIXME: this is a big hack, since we assume that the only error 2 - // we can get here for this command basically reads like - // file "foo" doesn't exists in revision "bar" - // but yeah, localized string parsing is stupid as well - if (commandStack.head() == CorrespondingPath) - { - commandStack.dequeue(); - reset(); - emit endOfLineReached(); - return; - } - } - if (task.getReturnCode() != 0) { C(QString("Command returned with a non-zero return code (%1)") @@ -125,14 +99,10 @@ void GetContentChanged::processTaskResul return; } - // this method is called when we either called get_content_changed, - // parents or get_corresponding_path - // to decide what to do next, we need to know what was triggered - // lately in the queue - Command current = commandStack.dequeue(); + QString current = task.getArguments().at(0); QString output = task.getOutputUtf8(); - if (current == Parents) + if (current == "parents") { if (output.isEmpty()) @@ -160,7 +130,7 @@ void GetContentChanged::processTaskResul return; } - if (current == ContentChanged) + if (current == "get_content_changed") { // since we're looking for a file in a certain revision // _beforehand_ via get_corresponding_path, we should always @@ -199,11 +169,20 @@ void GetContentChanged::processTaskResul return; } - if (current == CorrespondingPath) + if (current == "get_corresponding_path") { I(revsForPathStack.size() > 0); QString rev = revsForPathStack.dequeue(); + // if there is no corresponding path for the file in this + // revision, we've reached the end of this development line + if (output.isEmpty()) + { + reset(); + emit endOfLineReached(); + return; + } + BasicIOParser parser(output); I(parser.parse()); StanzaList stanzas = parser.getStanzas(); ============================================================ --- src/model/GetContentChanged.h 3d41d6ca1786efb70146dc952719a3896651de90 +++ src/model/GetContentChanged.h a9265c18e8ec3639c6aa5248da12bbd0350b844d @@ -63,9 +63,6 @@ private: RevisionList revisions; - enum Command { ContentChanged, CorrespondingPath, Parents }; - - QQueue commandStack; QQueue revsForPathStack; QMap pathInRevision;