# # # patch "src/model/GetContentChanged.cpp" # from [ea013a6d430552f30584884170c6fb4af03119e4] # to [2439f22b9d789044215089681d24f11f0fb13564] # ============================================================ --- src/model/GetContentChanged.cpp ea013a6d430552f30584884170c6fb4af03119e4 +++ src/model/GetContentChanged.cpp 2439f22b9d789044215089681d24f11f0fb13564 @@ -31,8 +31,10 @@ GetContentChanged::~GetContentChanged() GetContentChanged::~GetContentChanged() { - Q_ASSERT(commandStack.size() == 0); - Q_ASSERT(revsForPathStack.size() == 0); + if (commandStack.size() > 0) + { + W("Unfinished commands."); + } revisions.clear(); pathInRevision.clear(); @@ -131,6 +133,12 @@ void GetContentChanged::parseOutput() foreach (QString par, parents) { + // if we checked this revision already, skip it + if (pathInRevision.contains(par)) + { + continue; + } + revsForPathStack.enqueue(par); Q_ASSERT(queryCorrespondingPath(startRev, startPath, par)); } @@ -151,11 +159,16 @@ void GetContentChanged::parseOutput() QString rev = st.at(0).hash; Q_ASSERT(!rev.isNull()); - if (!revisions.contains(rev)) + // if we have this particular revision already recorded, + // skip it + if (revisions.contains(rev)) continue; + + // append the revision to the ordered list + revisions.append(rev); + + // check if we already know the path in that revision + if (!pathInRevision.contains(rev)) { - // append the revision to the ordered list - revisions.append(rev); - // add the revision to the stack of revs which need // to get a valid path queried revsForPathStack.enqueue(rev); @@ -163,6 +176,9 @@ void GetContentChanged::parseOutput() // query for the corresponding path Q_ASSERT(queryCorrespondingPath(startRev, startPath, rev)); } + + // query for the parents of this revision for the + // next round Q_ASSERT(queryParents(rev)); } return; @@ -172,7 +188,7 @@ void GetContentChanged::parseOutput() { Q_ASSERT(revsForPathStack.size() > 0); QString rev = revsForPathStack.dequeue(); - D(AutomateCommand::data); + if (AutomateCommand::data.isEmpty()) { // check if this is a marked node, if so, @@ -200,6 +216,9 @@ void GetContentChanged::parseOutput() Q_ASSERT(en.sym == "file" && en.vals.size() == 1); QString path = en.vals.at(0); + // we're also inserting a lot of uninteresting (revision, path) + // tuples here, i.e. for every parent revision of a marked node, + // however the only list that counts is revisions pathInRevision.insert(rev, path); // try to get the next marked node @@ -287,7 +306,7 @@ QVariant GetContentChanged::headerData(i switch (section) { case 0: return QVariant(tr("Revision ID")); - case 1: return QVariant(tr("Path")); + case 1: return QVariant(tr("Path in this revision")); } } return QVariant();