#
# patch "ChangeLog"
# from [5c4b6931290e9940e590faa572a66d644e4f356c]
# to [ebf5a9515d05ee42da6f3d3924ea60ce73890640]
#
# patch "annotate.cc"
# from [81e0c5f2c905b3e24fe760199aff1c9d30011051]
# to [9b3b77d0d5315565a7b98a80c4b27d194ce8a1f1]
#
# patch "commands.cc"
# from [00a866efd9308bccb954e5b7a00681575cd9ccce]
# to [6b0093bedfb3a8fece448924f81e73d9ca0a6b0c]
#
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,10 @@
+2005-04-2008 Emile Snyder
+
+ * annotate.cc: Fix broken build after propagate from .annotate
+ branch to mainline. The lcs stuff was changed to use
+ quick_allocator, so our use of it had to change as well.
+
+
2005-04-28 Emile Snyder
* commands.cc: New command "annotate"
--- annotate.cc
+++ annotate.cc
@@ -144,7 +144,7 @@
static interner in; // FIX, testing hack
- std::vector file_interned;
+ std::vector file_interned;
// same length as file_lines. if file_lines[i] came from line 4 in the UDOI, mapping[i] = 4
std::vector mapping;
@@ -355,7 +355,8 @@
{
boost::shared_ptr parent_lineage(new annotate_lineage_mapping(parent_data));
- std::vector lcs;
+ std::vector lcs;
+ std::back_insert_iterator< std::vector > bii(lcs);
longest_common_subsequence(file_interned.begin(),
file_interned.end(),
parent_lineage->file_interned.begin(),
--- commands.cc
+++ commands.cc
@@ -3104,7 +3104,48 @@
std::cout << "no common ancestor/dominator found" << std::endl;
}
+/*
+class ancestry_graph_formatter {
+public:
+ virtual void open_graph (std::ostream &os) = 0;
+ virtual void open_node (std::ostream &os) = 0;
+ virtual void node_content (std::ostream &os) = 0;
+ virtual void node_close (std::ostream &os) = 0;
+ virtual void edge (const std::pair &e) = 0;
+};
+class ancestry_graph_agraph_formatter
+ : public ancestry_graph_formatter
+{
+public:
+ virtual void open_graph (std::ostream &os) {
+ os << "graph: " << endl << "{" << endl;
+ }
+
+ virtual void open_node (std::ostream &os) {
+ os << "node: { title : \"" << rev << "\"\n"
+ << " label : \"\\fb" << rev;
+ }
+
+ virtual void node_content (std::ostream &os, const std::string &s) {
+ os << s << endl;
+ }
+
+ virtual void close_node (std::ostream &os) {
+ os << "\"}" << endl;
+ }
+
+ virtual void edge (std::ostream &os, revision_id src_rev, revision_id target_rev) {
+ os << "edge: { sourcename : \"" << src_rev << "\"" << endl
+ << " targetname : \"" << target_rev << "\" }" << endl;
+ }
+
+ virtual void close_graph (std::ostream &os) {
+ os << "{" << endl << endl;
+ }
+};
+*/
+
CMD(agraph, "debug", "", "dump ancestry graph to stdout in VCG format")
{
set nodes;
@@ -3166,6 +3207,77 @@
}
+CMD(agraphviz, "debug", "", "dump ancestry graph to stdout in DOT format")
+{
+ set nodes;
+ multimap branches;
+
+ std::multimap edges_mmap;
+ set > edges;
+
+ app.db.get_revision_ancestry(edges_mmap);
+
+ // convert from a weak lexicographic order to a strong one
+ for (std::multimap::const_iterator i = edges_mmap.begin();
+ i != edges_mmap.end(); ++i)
+ edges.insert(std::make_pair(i->first, i->second));
+
+ for (set >::const_iterator i = edges.begin();
+ i != edges.end(); ++i)
+ {
+ nodes.insert(i->first);
+ nodes.insert(i->second);
+ }
+
+ /*
+ vector< revision > certs;
+ app.db.get_revision_certs(branch_cert_name, certs);
+ for(vector< revision >::iterator i = certs.begin();
+ i != certs.end(); ++i)
+ {
+ cert_value tv;
+ decode_base64(i->inner().value, tv);
+ revision_id tmp(i->inner().ident);
+ nodes.insert(tmp); // in case no edges were connected
+ branches.insert(make_pair(tmp, tv()));
+ }
+ */
+
+ //cout << "graph: " << endl << "{" << endl; // open graph
+ cout << "digraph \"monotone graph\" {" << endl;
+
+ for (set::iterator i = nodes.begin(); i != nodes.end();
+ ++i)
+ {
+ //cout << "node: { title : \"" << *i << "\"\n"
+ // << " label : \"\\fb" << *i;
+ cout << "\"" << *i << "\" [ label = \"" << (*i).inner()().substr(0, 6);
+
+ /*
+ pair::const_iterator,
+ multimap::const_iterator> pair =
+ branches.equal_range(*i);
+ for (multimap::const_iterator j = pair.first;
+ j != pair.second; ++j)
+ {
+ cout << "\\n\\fn" << j->second;
+ }
+ */
+
+ //cout << "\"}" << endl;
+ cout << "\" ];" << endl;
+ }
+ for (set >::iterator i = edges.begin(); i != edges.end();
+ ++i)
+ {
+ //cout << "edge: { sourcename : \"" << i->first << "\"" << endl
+ // << " targetname : \"" << i->second << "\" }" << endl;
+ cout << "\"" << i->first << "\" -> \"" << i->second << "\";" << endl;
+ }
+ cout << "}" << endl << endl; // close graph
+}
+
+
static void
write_file_targets(change_set const & cs,
update_merge_provider & merger,