Mark ALREADY_MERGED changes as merged in the DB

If a change is marked ALREADY_MERGED, likely a result of a bug in the
merge code, it does not end up in the toSubmit list and so was never
being marked as merged, despite the branch head already having
advanced. Fix this so ALREADY_MERGED changes are updated to match the
branch state.

This does not fix any bugs in the merge code proper, but at least
allows recovery from a certain kind of bad state.

Works around (does not fix) bug 1985 and perhaps bug 600.

Change-Id: I44548cce039e303a86d579b0b0d76b12ad9bdcfb
1 file changed