Fix storing DiffX data when commits aren't used

Review Request #11769 — Created Aug. 3, 2021 and submitted

Information

Review Board
release-4.0.x

Reviewers

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.

Unit tests pass on Python 2 and 3.

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

Summary ID
Fix storing DiffX data when commits aren't used, and fix default revisions.
`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.
a926a9ecaf7a3c3cec7a7ab386c5460d49d44603
Description From Last Updated

F841 local variable 'diffset_extra_data' is assigned to but never used

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (3c90032)
Loading...