Package com.google.gerrit.server.update
Class RefUpdateUtil
- java.lang.Object
-
- com.google.gerrit.server.update.RefUpdateUtil
-
public class RefUpdateUtil extends Object
Static utilities for working with JGit's ref update APIs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
deleteChecked(org.eclipse.jgit.lib.Repository repo, String refName)
Delete a single ref, throwing a checked exception on failure.static void
executeChecked(org.eclipse.jgit.lib.BatchRefUpdate bru, org.eclipse.jgit.lib.Repository repo)
Execute a batch ref update, throwing a checked exception if not all updates succeeded.static void
executeChecked(org.eclipse.jgit.lib.BatchRefUpdate bru, org.eclipse.jgit.revwalk.RevWalk rw)
Execute a batch ref update, throwing a checked exception if not all updates succeeded.
-
-
-
Method Detail
-
executeChecked
public static void executeChecked(org.eclipse.jgit.lib.BatchRefUpdate bru, org.eclipse.jgit.lib.Repository repo) throws IOException
Execute a batch ref update, throwing a checked exception if not all updates succeeded.Creates a new
RevWalk
used only for this operation.- Parameters:
bru
- batch update; should already have been executed.repo
- repository that createdbru
.- Throws:
LockFailureException
- if the transaction was aborted due to lock failure; seecheckResults(BatchRefUpdate)
for details.IOException
- if any result was notOK
.
-
executeChecked
public static void executeChecked(org.eclipse.jgit.lib.BatchRefUpdate bru, org.eclipse.jgit.revwalk.RevWalk rw) throws IOException
Execute a batch ref update, throwing a checked exception if not all updates succeeded.- Parameters:
bru
- batch update; should already have been executed.rw
- walk for executing the update.- Throws:
LockFailureException
- if the transaction was aborted due to lock failure; seecheckResults(BatchRefUpdate)
for details.IOException
- if any result was notOK
.
-
deleteChecked
public static void deleteChecked(org.eclipse.jgit.lib.Repository repo, String refName) throws IOException
Delete a single ref, throwing a checked exception on failure.Does not require that the ref have any particular old value. Succeeds as a no-op if the ref did not exist.
- Parameters:
repo
- repository.refName
- ref name to delete.- Throws:
LockFailureException
- if a low-level lock failure (e.g. compare-and-swap failure) occurs.IOException
- if an error occurred.
-
-