I try to understand the code in reverter.corehacks.ChangesetDataSet.put().
If I got that right the comment
// Save only latest versions of primitives for reverter
should be changed to
// Save only earliest version of primitive for reverter
or maybe
// Save only lowest version of primitive for reverter
Did you really see changeset where the changes are not sorted by version? The code seems to handle the case that a cs contains data out of order like
...
modify node 123 to version 2
...
create node 123 (to version 1)
...