AU: when cutting a cycle, add proper dependencies.
The old behavior was:
Imagine a cycle: A->B->C->D->A. We cut A->B which creates the graph:
B->C->D->A->New. We depended on B to depend (indirectly) on New.
The problem is, say we cut two edges, A->B and C->D. Then the result
would be: D->A->New and B->C->New2. Now, B no longer depdends
(directly or indirectly) on New.
Now, When we cut a cycle, we have both the src/dst of the cut edge
depends on the New node. Following the example, this new behavior
gives us:
A->New<-B->C->New2<-D->A
It's both cycle free and doesn't lose the fact that B depends New.
BUG=chromium-os:5061
TEST=unittest, tested on generating delta that needed this fix
Review URL: http://codereview.chromium.org/3013030
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index ec07119..657bdf5 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -652,6 +652,10 @@
// delete the old edge
CHECK_EQ(1, (*graph)[it->first].out_edges.erase(it->second));
+
+ // Add an edge from dst to copy operation
+ (*graph)[it->second].out_edges.insert(make_pair(graph->size() - 1,
+ EdgeProperties()));
}
return true;
}