# # # patch "src/model/GetBranchLog.cpp" # from [c9066da970e01b5e0b89f9cb5a28968507e5d021] # to [b2c2d270c1214e885cdf42d627704abbccae1151] # # patch "src/model/GetBranchLog.h" # from [9347adfb396d817f88109a97a5b7b00a99035e09] # to [7a2e0071fff1701f3e91e8ad5f77320194536cf5] # ============================================================ --- src/model/GetBranchLog.cpp c9066da970e01b5e0b89f9cb5a28968507e5d021 +++ src/model/GetBranchLog.cpp b2c2d270c1214e885cdf42d627704abbccae1151 @@ -76,7 +76,7 @@ void GetBranchLog::readNext() return; } - QString next = nextRevs[currentBranch].pop(); + QString next = nextRevs[currentBranch].takeLast(); MonotoneTaskPtr task(new MonotoneTask(QStringList() << "parents" << next)); AutomateCommand::enqueueDatabaseTask(databaseFile, task); } @@ -98,6 +98,15 @@ void GetBranchLog::processTaskResult(con QString current = task->getArguments().at(0); QString output = task->getDecodedOutput(); + if (current == "toposort") + { + QStringList revs = output.split("\n", QString::SkipEmptyParts); + I(nextRevs[currentBranch].size() == revs.size()); + nextRevs[currentBranch] = revs; + + readNext(); + } + else if (current == "select" || current == "parents") { // ensure that we never start with a 'select h:' call and have @@ -111,18 +120,20 @@ void GetBranchLog::processTaskResult(con mergeRevs.insert(task->getArguments().at(1)); } + bool newRevsArrived = false; foreach (QString rev, revs) { // we found a parent which we already recorded if (revisionMap[currentBranch].contains(rev)) continue; + newRevsArrived = true; int newRow = revisionMap[currentBranch].size(); beginInsertRows(QModelIndex(), newRow, newRow); revisionMap[currentBranch].append(rev); revsRead++; - nextRevs[currentBranch].push(rev); + nextRevs[currentBranch].append(rev); if (!certMap.contains(rev)) { @@ -133,6 +144,17 @@ void GetBranchLog::processTaskResult(con endInsertRows(); } + if (newRevsArrived) + { + QStringList args; + args << "toposort"; + args += nextRevs[currentBranch]; + + MonotoneTaskPtr task(new MonotoneTask(args)); + AutomateCommand::enqueueDatabaseTask(databaseFile, task); + return; + } + readNext(); } else ============================================================ --- src/model/GetBranchLog.h 9347adfb396d817f88109a97a5b7b00a99035e09 +++ src/model/GetBranchLog.h 7a2e0071fff1701f3e91e8ad5f77320194536cf5 @@ -23,7 +23,6 @@ #include "Select.h" #include "Toposort.h" -#include #include class GetBranchLog : public QAbstractItemModel, public AutomateCommand @@ -56,7 +55,7 @@ private: DatabaseFile databaseFile; QMap revisionMap; QMap certMap; - QMap > nextRevs; + QMap > nextRevs; QSet mergeRevs; QString currentBranch;