diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-26 14:41:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-26 14:41:59 +0200 |
commit | a8781515e5241b405139c904fb5875108344a5c0 (patch) | |
tree | 07b03c522c790d4d571841c747fe5ea770e6e36a | |
parent | 89120cf7addb304c1d1b029f1edae108e94ba023 (diff) |
Fix bug in diff'ing models of same version
-rw-r--r-- | odb/relational/changelog.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/odb/relational/changelog.cxx b/odb/relational/changelog.cxx index 585a2c4..af1dcea 100644 --- a/odb/relational/changelog.cxx +++ b/odb/relational/changelog.cxx @@ -412,12 +412,27 @@ namespace relational { changeset& r (l.new_node<changeset> (n.version ())); - // Set the alters edge for lookup. + // Set the alters edge for lookup. If we are diff'ing two models of + // the same version, then use the old model as a base. Otherwise use + // the tip of changelog (it should correspond to the old model). // - l.new_edge<alters> (r, - l.contains_changeset_empty () - ? static_cast<qscope&> (l.model ()) - : l.contains_changeset_back ().changeset ()); + if (o.version () == n.version ()) + l.new_edge<alters> (r, o); + else + { + if (l.contains_changeset_empty ()) + { + model& m (l.model ()); + assert (o.version () == m.version ()); + l.new_edge<alters> (r, m); + } + else + { + changeset& c (l.contains_changeset_back ().changeset ()); + assert (o.version () == c.version ()); + l.new_edge<alters> (r, c); + } + } { trav_rel::model model; |