Mark ALREADY_MERGED changes as merged in the DB and run hooks

If a change in the merge queue is marked ALREADY_MERGED, it is likely a
result of a bug in the merge code.  It means the change has been merged,
but neither properly marked as such in the DB nor propagated to hooks for
sending email notifications or being mentioned in stream-events.

Calling setMerged() instead of setMergedPatchSet() properly marks the
change as merged in the database and runs hooks for sending emails and
events.

This is an improved version of I44548cce039e303a86d579b0b0d76b12ad9bdcfb
and fix for issue 2044.

Bug: issue 2044
Change-Id: I4e95a74e58ff51a54ed54a02298c719e19f6fd0d
1 file changed