Enforce a sort order when collecting prefetched files for a diff.

Review Request #2239 — Created Sept. 23, 2021 and updated

Review Board

When collecting `FileDiff`s in `DiffSet.per_commit_files()` and
`DiffSet.cumulative_files()`, it was possible to get files that weren't
in an expected order. These could come from the database in index order
and not insertion order. While this generally wouldn't be a huge
problem for general lookups of files (and wasn't a problem for all
database setups), it could lead to out-of-order raw diffs, which could
easily break anything trying to access them.

This is an edge case for sure, and one where we don't have a good
reproduction case. It seems to be dependent on the database.

We now explicitly force an order based on the primary key. Currently,
we're only enforcing them in these properties, and not as the default
sort order for the model, in order to avoid any unintentional side

Testing Done:
Unit tests pass.

Tested in production with a customer who encountered this problem. We
verified the fix.
i am xiaoyang ,i am using test it...

Reviewed at https://reviews.reviewboard.org/r/11736/