Package com.google.gerrit.server.update
Interface Context
- All Known Subinterfaces:
ChangeContext
,PostUpdateContext
,RepoContext
public interface Context
Context for performing a
BatchUpdate
.
A single update may span multiple changes, but they all belong to a single repo.
-
Method Summary
Modifier and TypeMethodDescriptiondefault AccountState
Get the account of the user performing the update.default Account.Id
Get the account ID of the user performing the update.default IdentifiedUser
Get the identified user performing the update.Get the notification settings configured by the caller.Get the project name this update operates on.Get a read-only view of the open repository for this project.org.eclipse.jgit.revwalk.RevWalk
Get a walk for this project.getUser()
Get the user performing the update.getWhen()
Get the timestamp at which this update takes place.Get the time zone ID in which this update takes place.default org.eclipse.jgit.lib.PersonIdent
Creates a committerPersonIdent
forgetIdentifiedUser()
.default org.eclipse.jgit.lib.PersonIdent
Creates a committerPersonIdent
for the given user.default org.eclipse.jgit.lib.PersonIdent
newCommitterIdent
(String email, IdentifiedUser user) Creates a committerPersonIdent
for the given user.default org.eclipse.jgit.lib.PersonIdent
newPersonIdent
(org.eclipse.jgit.lib.PersonIdent personIdent) Creates a newPersonIdent
withgetWhen()
as timestamp.
-
Method Details
-
getProject
Project.NameKey getProject()Get the project name this update operates on.- Returns:
- project.
-
getRepoView
Get a read-only view of the open repository for this project.Will be opened lazily if necessary.
- Returns:
- repository instance.
- Throws:
IOException
- if an error occurred opening the repo.
-
getRevWalk
Get a walk for this project.The repository will be opened lazily if necessary; callers should not close the walk.
- Returns:
- walk.
- Throws:
IOException
- if an error occurred opening the repo.
-
getWhen
Instant getWhen()Get the timestamp at which this update takes place.- Returns:
- timestamp.
-
getZoneId
ZoneId getZoneId()Get the time zone ID in which this update takes place.In the current implementation, this is always the time zone ID of the server.
- Returns:
- zone ID.
-
getUser
CurrentUser getUser()Get the user performing the update.In the current implementation, this is always an
IdentifiedUser
orInternalUser
.- Returns:
- user.
-
getNotify
Get the notification settings configured by the caller.If there are multiple changes in a batch, they may have different settings. For example, WIP changes may have reduced
NotifyHandling
levels, and may be in a batch with non-WIP changes.- Parameters:
changeId
- change ID- Returns:
- notification settings.
-
getIdentifiedUser
Get the identified user performing the update.Convenience method for
getUser().asIdentifiedUser()
.- Returns:
- user.
- See Also:
-
getAccount
Get the account of the user performing the update.Convenience method for
getIdentifiedUser().account()
.- Returns:
- account.
- See Also:
-
getAccountId
Get the account ID of the user performing the update.Convenience method for
getUser().getAccountId()
- Returns:
- account ID.
- See Also:
-
newPersonIdent
default org.eclipse.jgit.lib.PersonIdent newPersonIdent(org.eclipse.jgit.lib.PersonIdent personIdent) Creates a newPersonIdent
withgetWhen()
as timestamp.- Parameters:
personIdent
-PersonIdent
to be copied- Returns:
- copied
PersonIdent
withgetWhen()
as timestamp
-
newCommitterIdent
default org.eclipse.jgit.lib.PersonIdent newCommitterIdent()Creates a committerPersonIdent
forgetIdentifiedUser()
.- Returns:
- the created committer
PersonIdent
-
newCommitterIdent
Creates a committerPersonIdent
for the given user.- Parameters:
user
- user for which a committerPersonIdent
should be created- Returns:
- the created committer
PersonIdent
-
newCommitterIdent
Creates a committerPersonIdent
for the given user. The identity will be created with the given email if the user is allowed to use it, otherwise fallback to preferred email.- Parameters:
user
- user for which a committerPersonIdent
should be createdemail
- committer email of the source commit- Returns:
- the created committer
PersonIdent
-