PostReview: Don't allow timestamps before change's CreatedOn date

Since createdOn is defined in NoteDb as the oldest timestamp in the
change meta DAG, using a very old timestamp will cause createdOn to
jump back when a change is converted to NoteDb. Avoid this by
truncating such timestamps in ChangeRebuilder.

Also avoid putting ourselves in this situation in ReviewDb in the
first place, by silently truncating the timestamp during PostReview.
This means new changes will not have this problem, but we still need
to accept it in ChangeRebuilder for converting old changes.

Change-Id: Ife53b120676ee8228873ddd2b7c658d8f26697f5
This commit is contained in:
Dave Borowitz
2016-03-10 17:35:58 -05:00
parent 15dbdddb18
commit 27512a20d4
5 changed files with 61 additions and 22 deletions

View File

@@ -309,7 +309,7 @@ public class ChangeBundleTest {
ChangeBundle b2 = new ChangeBundle(c, messages(cm2, cm3), patchSets(),
approvals(), comments(), NOTE_DB);
assertDiffs(b1, b2,
"message differs for ChangeMessage on " + id + " at index 0:"
"message differs for ChangeMessage on " + id + " at index 1:"
+ " {message 1} != {message 2}");
}