RepoUpdater: Convert ConcurrentRefUpdateException into LockFailureException

Calling the RepoCommand may fail with a ConcurrentRefUpdateException
that represents a LOCK_FAILURE. Convert this exception into a
LockFailureException so that our auto-retrying logic for LOCK_FAILURES
can recognize the LOCK_FAILURE and retry the operation, instead of
failing immediately.

Example stacktrace:
update for foo/manifest:*:default.xml (Repo) => foo/superproject:* (ref refs/heads/main) failed: org.eclipse.jgit.api.errors.ConcurrentRefUpdateException: Cannot lock refs/heads/main. Ensure that no other process has an open file handle on the lock file refs/heads/main.lock, then you may delete the lock file and retry.. RefUpdate return code was: LOCK_FAILURE
	at org.eclipse.jgit.gitrepo.BareSuperprojectWriter.commitTreeOnCurrentTip(BareSuperprojectWriter.java:311)
	at org.eclipse.jgit.gitrepo.BareSuperprojectWriter.write(BareSuperprojectWriter.java:141)
	at org.eclipse.jgit.gitrepo.RepoCommand.call(RepoCommand.java:573)
	at com.googlesource.gerrit.plugins.supermanifest.RepoUpdater.update(RepoUpdater.java:74)
	at com.googlesource.gerrit.plugins.supermanifest.SuperManifestRefUpdatedListener.updateForConfig(SuperManifestRefUpdatedListener.java:424)
	at com.googlesource.gerrit.plugins.supermanifest.SuperManifestRefUpdatedListener.onGitReferenceUpdated(SuperManifestRefUpdatedListener.java:314)

Follow the example of change I2ff60b01a in gerrit core.

Change-Id: I46be2ee251bfef9dee4ea65c3f689415095501dd
Signed-off-by: Edwin Kempin <ekempin@google.com>
1 file changed
tree: 2795e381c6fc3275101f802204ca3944b0877d83
  1. java/
  2. javatests/
  3. BUILD
  4. external_plugin_deps.bzl
  5. LICENSE
  6. README.md
README.md

The plugin will update a superproject to contain the submodules defined in the manifest XML file whenever the manifest repo is changed.

For more information see the documentation or the build instructions