• 
      

    Ensure consistent ordering of filediffs for patch generation.

    Review Request #14375 — Created March 19, 2025 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.1.x

    Reviewers

    When generating diffs from FileDiffs or results for the FileDiff
    resource, we were using the database's default sort order. For MySQL and
    MariaDB, this is going to be the primary key, but that's not guaranteed
    for Postgres. For Postgres, we can get an entirely different order.

    This can pose a problem for diffs that are sensitive to file orders,
    namely Mercurial, which contains identifying information for the commit
    in the first file. We need these to be in the insert order, as that's
    the order in which we parse from the sourcediff.

    We now explicitly sort these by the primary key in these cases. We're
    not setting this as the default sort order at this time, in order to
    avoid any surprises elsewhere, and to be explicit about the order we
    know we need in these particular cases.

    Unit tests pass.

    Verified this fix with a customer who had previously encountered
    this issue.

    Commits

    Files