# # patch "git_export.cc" # from [4627ca2e1db0d7bc3df46bd050d51dcf48d4a007] # to [053b30ec612a653112705dd9b26ee3f6ff662299] # ======================================================================== --- git_export.cc 4627ca2e1db0d7bc3df46bd050d51dcf48d4a007 +++ git_export.cc 053b30ec612a653112705dd9b26ee3f6ff662299 @@ -386,11 +386,15 @@ cert_name branch_name(branch_cert_name); +#if 0 + // See 88020b6892b125ad3ac5888cc90c2df4d33ab476 in Monotone's + // revision history. if (!has_cert(app, rid, branch_name, git.branch)) { L(F("Skipping, not on my branch.")); return false; } +#endif revision_set rev; app.db.get_revision(rid, rev); @@ -462,7 +466,41 @@ } +// Like database::get_revision_ancestry() but for just a single branch static void +get_branch_ancestry(string const &branch, app_state &app, + set &list) +{ + queue frontier; + + set heads; + get_branch_heads(git.branch, app, heads); + for (set::const_iterator i = heads.begin(); + i != heads.end(); ++i) + frontier.push(*i); + + while (!frontier.empty()) + { + revision_id rid = frontier.front(); frontier.pop(); + + if (list.find(rid) != list.end()) + continue; + list.insert(rid); + + revision_set rev; + app.db.get_revision(rid, rev); + + for (edge_map::const_iterator e = rev.edges.begin(); + e != rev.edges.end(); ++e) + { + if (!null_id(edge_old_revision(e))) + frontier.push(edge_old_revision(e)); + } + } +} + + +static void add_gitrevs_descendants(git_history &git, app_state &app, set &list, set gitrevs) { @@ -570,6 +608,11 @@ N(false, F("head %s is not subset of our tree; perhaps import first?") % headname); } } + else + { + get_branch_ancestry(git.branch, app, filter); + filtertype = topo_include; + } vector revlist; revlist.clear(); // fill revlist with all the revisions, toposorted