findmissing: Fix database updates for duplicate fixes

Error logs such as the following are observed repeatedly on the patches robot.

INFO: SHA 61b7689caf4f fixed by 4ade8f31c25b: Already merged/queued/abandoned in linux_chrome [upstream sha 354842df3888] (initial status MERGED)
ERROR: Failed to insert an already merged/queued entry into chrome_fixes: error 1062 (Duplicate entry '61b7689caf4f-4ade8f31c25b' for key 'PRIMARY')

Database analysis shows the following related entries.

Table   Branch  SHA             Fixed by SHA    Status
chrome  5.4     61b7689caf4f    354842df3888    MERGED
chrome  5.4     61b7689caf4f    4ade8f31c25b    MERGED
chrome  5.4     68f1dcb1c39d    354842df3888    MERGED

Context:
61b7689caf4f UPSTREAM: drm/i915: Assume 100% brightness when not in DPCD control mode
68f1dcb1c39d UPSTREAM: drm/i915: Assume 100% brightness when not in DPCD control mode

354842df3888 drm/i915/dp: Tweak initial dpcd backlight.enabled value
4ade8f31c25b drm/i915/dp: Tweak initial dpcd backlight.enabled value

As it turns out, the database entry for <68f1dcb1c39d, 4ade8f31c25b> is
missing. This is the query returned from the database when trying to
identify missing commits. However, the code then tries to add and entry
for <61b7689caf4f, 4ade8f31c25b> instead of <68f1dcb1c39d, 4ade8f31c25b>
because it replaces 68f1dcb1c39d with 61b7689caf4f when searching for
duplicates (and 68f1dcb1c39d wasn't passed to the duplicate search
function to start with). Pass both SHAs to the duplicate search function
and add the correct duplicate entry to the database to fix the problem.

BUG=b:176996394
TEST=Run on robot

Change-Id: Iac749c093aa3e65f1c0bd90bdb4c90236eba41ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2617983
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Commit-Queue: Curtis Malainey <cujomalainey@chromium.org>
Auto-Submit: Guenter Roeck <groeck@chromium.org>
1 file changed