Split filediff creation into preparation and finalization methods

Review Request #10232 — Created Oct. 15, 2018 and discarded — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

filediff_creator.create_filediffs is now split into:

  • filediff_creator.prepare_filediffs, which does the work that
    create_filediffs used to do up to actual creation (with
    FileDiff.objects.bulk_create().
  • filediff_creator.finalize_fildiffs, which takes the result of
    prepare_filediffs and does the actual creation.

In the new DVCS web API workflow, we will need to validate that the
created FileDiffs from the cumulative diff match (a) the validation info
passed and (b) the set of terminal FileDiffs. If they do, we will
proceed with creation. This allows us to finalize in a single API call
instead of two (as before we would have to call create_filediffs()
with validate_only=True to validate and then again with
validate_only=False only when validation has succeeded. Since this
requires us to parse the entire diff file again, we would not
necessarily want to do it in the same API request.

Ran unit tests.

    Loading...