Prevent publishing of drafts with same commits

Review Request #7011 — Created March 5, 2015 and submitted — Latest diff uploaded

Information

Review Board
dvcs
5b8c863...

Reviewers

Before support for commit histories was added, it was sufficient to
check if a change description had any modified fields to determine if
an actual change was present. However, the DiffField is marked as
changed if there is a new diff available. In the case of a squashed
review request, this is sufficient because the API will not allow you
to upload an identical diff. However, with multiple commit review
requests, where each commit is uploaded individually, it becomes more
difficult because we do not know the number of commits before
publishing is attempted.

To address this issue, we now determine if only the DiffField has
been marked as changed and current DiffSet has diff commits. In this
case, we know that the DiffCommits haven't changed and therefore the
publish should not be allowed.

Added a unit test to capture this behaviour.

We now also use fewer database queries in the case where the history
was previously squashed and no longer is.

Ran units tests.

Created a review request with commit history. Upadated the review
request with the same set of commits and tried to publish the review
request draft, but was not able to.

The provided unit test fails without the patch and passes with it.

    Loading...