# # patch "ChangeLog" # from [9641d149ddeca37d295871949c85b7e57c708bf0] # to [1dc7b6c7e44de2ac653f2767618f843f9ec84975] # # patch "change_set.cc" # from [85337f4c912245cda1d3688df7a95ee05dd43f29] # to [002e0964b7401655ae7ab7fe308cb82be578e89a] # ======================================================================== --- ChangeLog 9641d149ddeca37d295871949c85b7e57c708bf0 +++ ChangeLog 1dc7b6c7e44de2ac653f2767618f843f9ec84975 @@ -1,3 +1,8 @@ +2005-08-22 Timothy Brownawell + + * change_set.cc (process_filetree_history): Only go back to the lcad. + Prehistory isn't needed for merging, and slows things down a lot. + 2005-08-21 Timothy Brownawell * change_set.{cc,hh}: New function, transplant_change_set . Used ======================================================================== --- change_set.cc 85337f4c912245cda1d3688df7a95ee05dd43f29 +++ change_set.cc 002e0964b7401655ae7ab7fe308cb82be578e89a @@ -1940,13 +1940,38 @@ interner itx; // process history + std::multimap graph, rgraph; app.db.get_revision_ancestry(graph); - for (gi i = graph.begin(); i != graph.end(); ++i) - rgraph.insert(std::make_pair(i->second, i->first)); + std::deque todo, roots; +// for (gi i = graph.begin(); i != graph.end(); ++i) +// rgraph.insert(std::make_pair(i->second, i->first)); + // only process as far back as the lcad. This saves time, and older history + // has no effect on the merge. + revision_id lcad; + find_common_ancestor_for_merge(left, right, lcad, app); + todo.push_back(lcad); + std::set done; + while(todo.size()) + { + revision_id c(todo.back()); + todo.pop_back(); + unsigned int s = done.size(); + done.insert(c); + if (s == done.size()) + continue; + gi pb = graph.lower_bound(c); + gi pe = graph.upper_bound(c); + for (gi i = pb; i != pe; ++i) + { + todo.push_back(i->second); + rgraph.insert(std::make_pair(i->second, i->first)); + } + } + + // rev -> {# of parents remaining, children} std::map > > about; - std::deque todo, roots; todo.push_back(left); todo.push_back(right); todo.push_back(anc); @@ -1999,12 +2024,26 @@ { std::map::iterator j = trees.find(edge_old_revision(i)); - I(j != trees.end()); + // if it doesn't exist, then it's from a rev that's being ignored + // due to old age. + if (j == trees.end()) + continue; from = j->second; } treevec.push_back(from); chvec.push_back(edge_changes(i)); } + if (treevec.empty()) + { + // this can happen since we ignore prehistoric ancestors. + // but we still need a change_set + manifest_map man; + app.db.get_manifest(rs.new_manifest, man); + change_set cs; + build_pure_addition_change_set(man, cs); + treevec.push_back(emptytree); + chvec.push_back(cs); + } trees.insert(make_pair(roots.front(), merge_trees(treevec, chvec, itx, roots.front().inner()())));