Class RepoView
- java.lang.Object
- 
- com.google.gerrit.server.update.RepoView
 
- 
 public class RepoView extends Object Restricted view of aRepositoryfor use byBatchUpdateOpimplementations.This class serves two purposes in the context of BatchUpdate. First, the subset of normal Repository functionality is purely read-only, which prevents implementors from modifying the repository outside ofRepoOnlyOp.updateRepo(com.google.gerrit.server.update.RepoContext). Write operations can only be performed by calling methods onRepoContext.Second, the read methods take into account any pending operations on the repository that implementations have staged using the write methods on RepoContext. Callers do not have to worry about whether operations have been performed yet, and the implementation details may differ between ReviewDb and NoteDb, but callers just don't need to care.
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.jgit.lib.ConfiggetConfig()Get this repo's configuration.Optional<org.eclipse.jgit.lib.ObjectId>getRef(String name)Read a single ref from the repo.Map<String,org.eclipse.jgit.lib.ObjectId>getRefs(String prefix)Look up refs by prefix.org.eclipse.jgit.revwalk.RevWalkgetRevWalk()Get an open revwalk on the repo.
 
- 
- 
- 
Method Detail- 
getConfigpublic org.eclipse.jgit.lib.Config getConfig() Get this repo's configuration.This is the storage-level config you would get with Repository.getConfig(), not, for example, the Gerrit-level project config.- Returns:
- a defensive copy of the config; modifications have no effect on the underlying config.
 
 - 
getRevWalkpublic org.eclipse.jgit.revwalk.RevWalk getRevWalk() Get an open revwalk on the repo.Guaranteed to be able to read back any objects inserted in the repository via RepoContext.getInserter(), even if objects have not been flushed to the underlying repo. In particular this includes any object returned bygetRef(String), even taking into account not-yet-executed commands.- Returns:
- revwalk.
 
 - 
getRefpublic Optional<org.eclipse.jgit.lib.ObjectId> getRef(String name) throws IOException Read a single ref from the repo.Takes into account any ref update commands added during the course of the update using RepoContext.addRefUpdate(org.eclipse.jgit.transport.ReceiveCommand), even if they have not yet been executed on the underlying repo.The results of individual ref lookups are cached: calling this method multiple times with the same ref name will return the same result (unless a command was added in the meantime). The repo is not reread. - Parameters:
- name- exact ref name.
- Returns:
- the value of the ref, if present.
- Throws:
- IOException- if an error occurred.
 
 - 
getRefspublic Map<String,org.eclipse.jgit.lib.ObjectId> getRefs(String prefix) throws IOException Look up refs by prefix.Takes into account any ref update commands added during the course of the update using RepoContext.addRefUpdate(org.eclipse.jgit.transport.ReceiveCommand), even if they have not yet been executed on the underlying repo.For any ref that has previously been accessed with getRef(String), the value in the result map will be that same cached value. Any refs that have not been previously accessed are re-scanned from the repo on each call.- Parameters:
- prefix- ref prefix; must end in '/' or else be empty.
- Returns:
- a map of ref suffixes to SHA-1s. The refs are all under prefixand have the prefix stripped; this matches the behavior ofRefDatabase.getRefs(String).
- Throws:
- IOException- if an error occurred.
 
 
- 
 
-