The unified diff between revisions [2449c78b..] and [ebdccab0..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'revision.cc'
#
#
# patch "revision.cc"
# from [6640272c7839f8489f1fe23813d7c520afc87d02]
# to [ca74a6db1747f8c8cf213167ec226df0e30c0b84]
#
============================================================
--- revision.cc 6640272c7839f8489f1fe23813d7c520afc87d02
+++ revision.cc ca74a6db1747f8c8cf213167ec226df0e30c0b84
@@ -361,17 +361,15 @@ void
// passed in set. if anyone ever needs to toposort the whole graph, then,
// this function would be a good thing to generalize...
void
-toposort(std::set<revision_id> const & revisions,
- std::vector<revision_id> & sorted,
- app_state & app)
+toposort(std::vector<revision_id> & sorted, database & db)
{
sorted.clear();
typedef std::multimap<revision_id, revision_id>::iterator gi;
typedef std::map<revision_id, int>::iterator pi;
std::multimap<revision_id, revision_id> graph;
- app.db.get_revision_ancestry(graph);
+ db.get_revision_ancestry(graph);
std::set<revision_id> leaves;
- app.db.get_revision_ids(leaves);
+ db.get_revision_ids(leaves);
std::map<revision_id, int> pcount;
for (gi i = graph.begin(); i != graph.end(); ++i)
pcount.insert(std::make_pair(i->first, 0));
@@ -387,8 +385,7 @@ toposort(std::set<revision_id> const & r
// now stick them in our ordering (if wanted) and remove them from the
// graph, calculating the new roots as we go
L(FL("new root: %s\n") % (roots.front()));
- if (revisions.find(roots.front()) != revisions.end())
- sorted.push_back(roots.front());
+ sorted.push_back(roots.front());
for(gi i = graph.lower_bound(roots.front());
i != graph.upper_bound(roots.front()); i++)
if(--(pcount[i->second]) == 0)
@@ -402,6 +399,21 @@ toposort(std::set<revision_id> const & r
i != leaves.end(); ++i)
{
L(FL("new leaf: %s\n") % (*i));
+ sorted.push_back(*i);
+ }
+}
+
+void
+toposort(std::set<revision_id> const & revisions,
+ std::vector<revision_id> & sorted,
+ database & db)
+{
+ std::vector<revision_id> all;
+ toposort(all, db);
+ sorted.clear();
+ for (std::vector<revision_id>::const_iterator i = all.begin();
+ i != all.end(); i++)
+ {
if (revisions.find(*i) != revisions.end())
sorted.push_back(*i);
}