#
# patch "ChangeLog"
# from [71121fbd00c6995192b9c8ec570b862da370607c]
# to [81a8889c14d048bc6523f2360c47294654e03424]
#
# patch "commands.cc"
# from [fd15957ce300a0e9a22bf16e1fc77a57ac711e46]
# to [5583a3051e3aa8374568512cf314bec72fec75c3]
#
========================================================================
--- ChangeLog 71121fbd00c6995192b9c8ec570b862da370607c
+++ ChangeLog 81a8889c14d048bc6523f2360c47294654e03424
@@ -1,3 +1,9 @@
+2005-08-27 Timothy Brownawell
+
+ * commands.cc: have the pcdv test driver limit to descendents of
+ the lcad. Processing time ranges from a few seconds to 4 minutes,
+ depending on lcad distance and file size.
+
2005-08-26 Timothy Brownawell
* change_set.cc, pcdv.cc, restrictions.cc: Try to make directory
========================================================================
--- commands.cc fd15957ce300a0e9a22bf16e1fc77a57ac711e46
+++ commands.cc 5583a3051e3aa8374568512cf314bec72fec75c3
@@ -3774,29 +3774,65 @@
typedef std::map > > cmap;
void
-get_fileids(revision_id const & start,
- file_path const & fp,
+get_fileids(revision_id const & left,
+ revision_id const & right,
+ file_path const & lfp,
+ file_path const & rfp,
std::map > & fileids,
pmap & parents,
cmap & children,
vector & roots,
app_state & app)
{
- if (!(fp == file_path()))
- {
- manifest_id mid;
- app.db.get_revision_manifest(start, mid);
- manifest_map m;
- app.db.get_manifest(mid, m);
- manifest_map::const_iterator i = m.find(fp);
- I(i != m.end());
- file_id ident = manifest_entry_id(i);
- fileids.insert(make_pair(start, make_pair(ident, fp)));
- }
+ std::set allowed_revs;
+ revision_id lcad;
+ {
+ find_common_ancestor_for_merge(left, right, lcad, app);
+ std::deque todo;
+ typedef std::multimap::iterator gi;
+ std::multimap graph;
+ app.db.get_revision_ancestry(graph);
+ todo.push_back(lcad);
+ while(todo.size())
+ {
+ revision_id c(todo.back());
+ todo.pop_back();
+ unsigned int s = allowed_revs.size();
+ allowed_revs.insert(c);
+ if (s == allowed_revs.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);
+ }
+ }
std::deque > todo;
- todo.push_back(make_pair(start, fp));
- ticker num("file_id count", "F", 1);
+
+ {// left
+ manifest_id mid;
+ app.db.get_revision_manifest(left, mid);
+ manifest_map m;
+ app.db.get_manifest(mid, m);
+ manifest_map::const_iterator i = m.find(lfp);
+ I(i != m.end());
+ file_id ident = manifest_entry_id(i);
+ fileids.insert(make_pair(left, make_pair(ident, lfp)));
+ todo.push_back(make_pair(left, lfp));
+ }
+ {// right
+ manifest_id mid;
+ app.db.get_revision_manifest(right, mid);
+ manifest_map m;
+ app.db.get_manifest(mid, m);
+ manifest_map::const_iterator i = m.find(rfp);
+ I(i != m.end());
+ file_id ident = manifest_entry_id(i);
+ fileids.insert(make_pair(right, make_pair(ident, rfp)));
+ todo.push_back(make_pair(right, rfp));
+ }
+
while (!todo.empty())
{
file_path const & p(todo.front().second);
@@ -3807,60 +3843,59 @@
i != rs.edges.end(); ++i)
{
revision_id oldrev(edge_old_revision(i));
- if (!(oldrev == revision_id()))
- ++child_count;
+ // revisions not descended from the lcad do not exist.
+ if (allowed_revs.find(oldrev) == allowed_revs.end())
+ oldrev = revision_id();
- {
- std::pair > p(1, vector());
- p.second.push_back(oldrev);
- std::pair
- pr(parents.insert(make_pair(todo.front().first, p)));
- if (!pr.second)
- {
- I(++pr.first->second.first <= 2);
- pr.first->second.second.push_back(oldrev);
- }
-
- std::pair > c(1, vector());
- c.second.push_back(todo.front().first);
- std::pair
- cr(children.insert(make_pair(oldrev, c)));
- if (!cr.second)
- {
- ++cr.first->second.first;
- cr.first->second.second.push_back(todo.front().first);
- }
- }
-
- // already processed it
- if (fileids.find(oldrev) != fileids.end())
- continue;
- // this is the beginning of time
-// if (edge_changes(i).rearrangement.has_added_file(p))
-// continue;
std::map const &
renames(edge_changes(i).rearrangement.renamed_files);
std::map::const_iterator j = renames.begin();
while (j != renames.end() && !(j->second == p))
++j;
- file_path const & mfp((j == renames.end())?fp:j->first);
- if (!(mfp == file_path()
- || edge_changes(i).rearrangement.has_added_file(p)))
- {
- manifest_map m;
- app.db.get_manifest(edge_old_manifest(i), m);
- manifest_map::const_iterator mi = m.find(mfp);
- I(mi != m.end());
- file_id ident = manifest_entry_id(mi);
- fileids.insert(make_pair(oldrev, make_pair(ident, mfp)));
- todo.push_back(make_pair(oldrev, mfp));
- }
- else if (!(oldrev == revision_id()))
- todo.push_back(make_pair(oldrev, file_path()));
+ file_path const & mfp((j == renames.end())?p:j->first);
+ bool parent_has_file =
+ !(mfp == file_path())
+ && !edge_changes(i).rearrangement.has_added_file(p)
+ && !(oldrev == revision_id());
+
+ if (!parent_has_file)
+ continue;
+ std::pair > p(1, vector());
+ p.second.push_back(oldrev);
+ std::pair
+ pr(parents.insert(make_pair(todo.front().first, p)));
+ if (!pr.second)
+ {
+ I(++pr.first->second.first <= 2);
+ pr.first->second.second.push_back(oldrev);
+ }
+
+ std::pair > c(1, vector());
+ c.second.push_back(todo.front().first);
+ std::pair
+ cr(children.insert(make_pair(oldrev, c)));
+ if (!cr.second)
+ {
+ ++cr.first->second.first;
+ cr.first->second.second.push_back(todo.front().first);
+ }
+
+ ++child_count;
+
+ // already processed it
+ if (fileids.find(oldrev) != fileids.end())
+ continue;
+
+ manifest_map m;
+ app.db.get_manifest(edge_old_manifest(i), m);
+ manifest_map::const_iterator mi = m.find(mfp);
+ I(mi != m.end());
+ file_id ident = manifest_entry_id(mi);
+ fileids.insert(make_pair(oldrev, make_pair(ident, mfp)));
+ todo.push_back(make_pair(oldrev, mfp));
}
if (!child_count)
roots.push_back(todo.front().first);
- ++num;
todo.pop_front();
}
}
@@ -3885,22 +3920,16 @@
pmap parents;
cmap children;
std::vector rootvect;
- get_fileids(left, fp, fileids, parents, children, rootvect, app);
- get_fileids(right, fp, fileids, parents, children, rootvect, app);
+ get_fileids(left, right, fp, fp, fileids, parents, children, rootvect, app);
+ P(F("Done locating ancestors."));
+ P(F("found %1% roots in %2% revisions") % rootvect.size() % fileids.size());
// now compute the merge history
std::deque roots;
for (vector::const_iterator i = rootvect.begin();
i != rootvect.end(); ++i)
- {
- roots.push_back(*i);
- P(F("Roots: %1%") % *i);
- }
+ roots.push_back(*i);
- ticker count("Revs in weave", "R", 1);
- ticker lines("Lines in weave", "L", 1);
- ticker unique("Unique lines", "U", 1);
-
map files;
file_state empty(file_state::new_file());
file_state p(empty);
@@ -3942,10 +3971,6 @@
string r(roots.front().inner()());
files.insert(std::make_pair(roots.front(),p.resolve(contents, r)));
- ++count;
- lines += (empty.weave->size() - lines.ticks);
- unique += (empty.itx->first.rev.size() - unique.ticks);
-
found_left = found_left
|| (left.inner()() == roots.front().inner()());
found_right = found_right