Package com.google.gerrit.server.update
Class ChainedReceiveCommands
- java.lang.Object
- 
- com.google.gerrit.server.update.ChainedReceiveCommands
 
- 
- All Implemented Interfaces:
- RefCache
 
 public class ChainedReceiveCommands extends Object implements RefCache Collection ofReceiveCommands that supports multiple updates per ref.The underlying behavior of BatchRefUpdateis undefined (an implementations vary) when more than one command per ref is added. This class works around that limitation by allowing multiple updates per ref, as long as the previous new SHA-1 matches the next old SHA-1.
- 
- 
Constructor SummaryConstructors Constructor Description ChainedReceiveCommands(RepoRefCache refCache)ChainedReceiveCommands(org.eclipse.jgit.lib.Repository repo)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(org.eclipse.jgit.transport.ReceiveCommand cmd)Add a command.voidaddTo(org.eclipse.jgit.lib.BatchRefUpdate bru)Add commands from this instance to a native JGit batch update.Optional<org.eclipse.jgit.lib.ObjectId>get(String refName)Get the latest value of a ref according to this sequence of commands.Map<String,org.eclipse.jgit.transport.ReceiveCommand>getCommands()RepoRefCachegetRepoRefCache()booleanisEmpty()
 
- 
- 
- 
Constructor Detail- 
ChainedReceiveCommandspublic ChainedReceiveCommands(org.eclipse.jgit.lib.Repository repo) 
 - 
ChainedReceiveCommandspublic ChainedReceiveCommands(RepoRefCache refCache) 
 
- 
 - 
Method Detail- 
getRepoRefCachepublic RepoRefCache getRepoRefCache() 
 - 
isEmptypublic boolean isEmpty() 
 - 
addpublic void add(org.eclipse.jgit.transport.ReceiveCommand cmd) Add a command.- Parameters:
- cmd- command to add. If a command has been previously added for the same ref, the new SHA-1 of the most recent previous command must match the old SHA-1 of this command.
 
 - 
getpublic Optional<org.eclipse.jgit.lib.ObjectId> get(String refName) throws IOException Get the latest value of a ref according to this sequence of commands.After the value for a ref is read from the repo once, it is cached as in RepoRefCache.- Specified by:
- getin interface- RefCache
- Parameters:
- refName- name of the ref.
- Returns:
- value of the ref; absent if the ref does not exist in the repo. Never null, and never
     present with a value of ObjectId.zeroId().
- Throws:
- IOException
- See Also:
- RefCache.get(String)
 
 - 
addTopublic void addTo(org.eclipse.jgit.lib.BatchRefUpdate bru) Add commands from this instance to a native JGit batch update.Exactly one command per ref will be added to the update. The old SHA-1 will be the old SHA-1 of the first command added to this instance for that ref; the new SHA-1 will be the new SHA-1 of the last command. - Parameters:
- bru- batch update
 
 
- 
 
-