To create an auto-merge commit AutoMerger uses RefUpdate#forceUpdate but
it didn't check the returned RefUpdate.Result and any failure to update
the ref (e.g. LOCK_FAILURE) stayed unnoticed and likely caused issues
later. E.g. if AutoMerger was invoked through QueryChanges -> ChangeJson
-> RevisionJson -> FileInfoJson -> PatchListCacheImpl -> PatchListLoader
-> AutoMerger then any failure to create the ref for the auto-merge
would result in a PatchListNotAvailableException, which would be caught
in ChangeJson#toChangeInfos which just drops the change from the result
after logging "Omitting corrupt change ... from results". In this case
the auto-retry of the request isn't triggered because the exception is
silently dropped in ChangeJson#toChangeInfos and hence doesn't reach the
REST API layer where auto-retrying is implemented. This is why this
change now uses RetryHelper in AutoMerger to retry the creation of the
auto-merge commit if it fails.
Admittedly a LOCK_FAILURE error is not very likely when we create the
auto-merge ref, though possible. At Google ref updates can fail for
other reasons (e.g. if the ref update is not successfully propogated to
a majority of hosts) and using the RetryHelper here allows us to do
retry in these cases now.
Add a new action type GIT_UPDATE for this case since non of the existing
action types is suitable.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ie7bb7ca0cc6acb0157bb29c34a27db4d138f99b7