Fix storing DiffX data when commits aren't used

Review Request #2210 — Created Aug. 20, 2021 and updated

guest179
Review Board
3c90032...
guest179
`DiffXParser` stores parsed information on a DiffX file in `DiffSet`,
`DiffCommit`, and `FileDiff`, and then uses that information to
regenerate the DiffX file.

The problem is, if a diff is uploaded without commit history (due to API
usage or SCM limitation), there is no `DiffCommit`, so we were losing
out on all the change-related data and all associated files. This isn't
just an issue for DiffX, but any parser storing data in
`ParsedDiffChange.extra_data`.

`FileDiff` creation now checks for this situation and stores any
`ParsedDiffChange.extra_data` content in a special key in `DiffSet`
(`change_extra_data` for a main diff, `parent_change_extra_data` for a
parent diff). `DiffXParser` will look for this and use it if commits
aren't available.

Testing Done:
Unit tests pass on Python 2 and 3.

Verified that this fixed issues in production with non-commit-backed
diffs.

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


Description From Last Updated

test defect 777

guest3255guest3255

testin verify

guest3255guest3255
Loading...