public class ChangeHookRunner extends Object implements ChangeHooks, EventDispatcher, EventSource, com.google.gerrit.extensions.events.LifecycleListener, com.google.gerrit.extensions.events.NewProjectCreatedListener
Modifier and Type | Class and Description |
---|---|
static class |
ChangeHookRunner.HookResult
Container class used to hold the return code and output of script hook execution
|
static class |
ChangeHookRunner.Module |
Constructor and Description |
---|
ChangeHookRunner(WorkQueue queue,
GitRepositoryManager repoManager,
org.eclipse.jgit.lib.Config config,
String anonymousCowardName,
SitePaths sitePath,
ProjectCache projectCache,
AccountCache accountCache,
EventFactory eventFactory,
com.google.gerrit.extensions.registration.DynamicSet<EventListener> unrestrictedListeners)
Create a new ChangeHookRunner.
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(EventListener listener,
CurrentUser user) |
void |
doChangeAbandonedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
String reason,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Change Abandoned Hook.
|
void |
doChangeMergedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
com.google.gerrit.reviewdb.server.ReviewDb db,
String mergeResultRev)
Fire the Change Merged Hook.
|
void |
doChangeRestoredHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
String reason,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Change Restored Hook.
|
void |
doClaSignupHook(com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.common.data.ContributorAgreement cla) |
void |
doCommentAddedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
String comment,
Map<String,Short> approvals,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Comment Added Hook.
|
void |
doDraftPublishedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Draft Published Hook.
|
void |
doHashtagsChangedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
Set<String> added,
Set<String> removed,
Set<String> hashtags,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the hashtags changed Hook.
|
void |
doMergeFailedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
String reason,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Merge Failed Hook.
|
void |
doPatchsetCreatedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Patchset Created Hook.
|
void |
doProjectCreatedHook(com.google.gerrit.reviewdb.client.Project.NameKey project,
String headName)
Fire the project created hook
|
void |
doRefUpdatedHook(com.google.gerrit.reviewdb.client.Branch.NameKey refName,
org.eclipse.jgit.lib.ObjectId oldId,
org.eclipse.jgit.lib.ObjectId newId,
com.google.gerrit.reviewdb.client.Account account)
Fire the Ref Updated Hook
|
void |
doRefUpdatedHook(com.google.gerrit.reviewdb.client.Branch.NameKey refName,
org.eclipse.jgit.lib.RefUpdate refUpdate,
com.google.gerrit.reviewdb.client.Account account)
Fire the Ref Updated Hook
|
ChangeHookRunner.HookResult |
doRefUpdateHook(com.google.gerrit.reviewdb.client.Project project,
String refname,
com.google.gerrit.reviewdb.client.Account uploader,
org.eclipse.jgit.lib.ObjectId oldId,
org.eclipse.jgit.lib.ObjectId newId)
Fire the update hook
|
void |
doReviewerAddedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
com.google.gerrit.reviewdb.client.PatchSet patchSet,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Reviewer Added Hook
|
void |
doTopicChangedHook(com.google.gerrit.reviewdb.client.Change change,
com.google.gerrit.reviewdb.client.Account account,
String oldTopic,
com.google.gerrit.reviewdb.server.ReviewDb db)
Fire the Topic Changed Hook
|
void |
onNewProjectCreated(com.google.gerrit.extensions.events.NewProjectCreatedListener.Event event) |
void |
postEvent(com.google.gerrit.reviewdb.client.Branch.NameKey branchName,
Event event)
Post a stream event that is related to a branch
|
void |
postEvent(com.google.gerrit.reviewdb.client.Change change,
Event event,
com.google.gerrit.reviewdb.server.ReviewDb db)
Post a stream event that is related to a change
|
void |
removeEventListener(EventListener listener) |
void |
start() |
void |
stop() |
@Inject public ChangeHookRunner(WorkQueue queue, GitRepositoryManager repoManager, org.eclipse.jgit.lib.Config config, String anonymousCowardName, SitePaths sitePath, ProjectCache projectCache, AccountCache accountCache, EventFactory eventFactory, com.google.gerrit.extensions.registration.DynamicSet<EventListener> unrestrictedListeners)
queue
- Queue to use when processing hooks.repoManager
- The repository manager.config
- Config file to use.sitePath
- The sitepath of this gerrit install.projectCache
- the project cache instance for the server.public void addEventListener(EventListener listener, CurrentUser user)
addEventListener
in interface EventSource
public void removeEventListener(EventListener listener)
removeEventListener
in interface EventSource
public ChangeHookRunner.HookResult doRefUpdateHook(com.google.gerrit.reviewdb.client.Project project, String refname, com.google.gerrit.reviewdb.client.Account uploader, org.eclipse.jgit.lib.ObjectId oldId, org.eclipse.jgit.lib.ObjectId newId)
doRefUpdateHook
in interface ChangeHooks
project
- The target projectrefname
- The Branch.NameKey of the ref provided by clientuploader
- The gerrit user running the commandoldId
- The ref's old idnewId
- The ref's new idpublic void doProjectCreatedHook(com.google.gerrit.reviewdb.client.Project.NameKey project, String headName)
ChangeHooks
doProjectCreatedHook
in interface ChangeHooks
project
- The project that was createdheadName
- The head name of the created projectpublic void doPatchsetCreatedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.PatchSet patchSet, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
doPatchsetCreatedHook
in interface ChangeHooks
change
- The change itself.patchSet
- The Patchset that was created.com.google.gwtorm.server.OrmException
public void doDraftPublishedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.PatchSet patchSet, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doDraftPublishedHook
in interface ChangeHooks
change
- The change itself.patchSet
- The Patchset that was published.com.google.gwtorm.server.OrmException
public void doCommentAddedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, String comment, Map<String,Short> approvals, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doCommentAddedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who added the comment.patchSet
- The patchset this comment is related to.comment
- The comment given.approvals
- Map of label IDs to scorescom.google.gwtorm.server.OrmException
public void doChangeMergedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, com.google.gerrit.reviewdb.server.ReviewDb db, String mergeResultRev) throws com.google.gwtorm.server.OrmException
ChangeHooks
doChangeMergedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who submitted the change.patchSet
- The patchset that was merged.mergeResultRev
- The SHA-1 of the merge result revision.com.google.gwtorm.server.OrmException
public void doMergeFailedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, String reason, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doMergeFailedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who attempted to submit the change.patchSet
- The patchset that failed to merge.reason
- The reason that the change failed to merge.com.google.gwtorm.server.OrmException
public void doChangeAbandonedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, String reason, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doChangeAbandonedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who abandoned the change.reason
- Reason for abandoning the change.com.google.gwtorm.server.OrmException
public void doChangeRestoredHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, String reason, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doChangeRestoredHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who restored the change.reason
- Reason for restoring the change.com.google.gwtorm.server.OrmException
public void doRefUpdatedHook(com.google.gerrit.reviewdb.client.Branch.NameKey refName, org.eclipse.jgit.lib.RefUpdate refUpdate, com.google.gerrit.reviewdb.client.Account account)
ChangeHooks
doRefUpdatedHook
in interface ChangeHooks
refName
- The updated project and branch.refUpdate
- An actual RefUpdate objectaccount
- The gerrit user who moved the refpublic void doRefUpdatedHook(com.google.gerrit.reviewdb.client.Branch.NameKey refName, org.eclipse.jgit.lib.ObjectId oldId, org.eclipse.jgit.lib.ObjectId newId, com.google.gerrit.reviewdb.client.Account account)
ChangeHooks
doRefUpdatedHook
in interface ChangeHooks
refName
- The Branch.NameKey of the ref that was updatedoldId
- The ref's old idnewId
- The ref's new idaccount
- The gerrit user who moved the refpublic void doReviewerAddedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.reviewdb.client.PatchSet patchSet, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doReviewerAddedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who was added as reviewer.patchSet
- The patchset that the reviewer was added on.com.google.gwtorm.server.OrmException
public void doTopicChangedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, String oldTopic, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doTopicChangedHook
in interface ChangeHooks
change
- The change itself.account
- The gerrit user who changed the topic.oldTopic
- The old topic name.com.google.gwtorm.server.OrmException
public void doHashtagsChangedHook(com.google.gerrit.reviewdb.client.Change change, com.google.gerrit.reviewdb.client.Account account, Set<String> added, Set<String> removed, Set<String> hashtags, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
ChangeHooks
doHashtagsChangedHook
in interface ChangeHooks
change
- The changeaccount
- The gerrit user changing the hashtagsadded
- List of hashtags that were added to the changeremoved
- List of hashtags that were removed from the changehashtags
- List of hashtags on the change after adding or removingdb
- The databasecom.google.gwtorm.server.OrmException
public void doClaSignupHook(com.google.gerrit.reviewdb.client.Account account, com.google.gerrit.common.data.ContributorAgreement cla)
doClaSignupHook
in interface ChangeHooks
public void postEvent(com.google.gerrit.reviewdb.client.Change change, Event event, com.google.gerrit.reviewdb.server.ReviewDb db) throws com.google.gwtorm.server.OrmException
EventDispatcher
postEvent
in interface EventDispatcher
change
- The change that the event is related toevent
- The event to postdb
- The databasecom.google.gwtorm.server.OrmException
public void postEvent(com.google.gerrit.reviewdb.client.Branch.NameKey branchName, Event event)
EventDispatcher
postEvent
in interface EventDispatcher
branchName
- The branch that the event is related toevent
- The event to postpublic void start()
start
in interface com.google.gerrit.extensions.events.LifecycleListener
public void stop()
stop
in interface com.google.gerrit.extensions.events.LifecycleListener
public void onNewProjectCreated(com.google.gerrit.extensions.events.NewProjectCreatedListener.Event event)
onNewProjectCreated
in interface com.google.gerrit.extensions.events.NewProjectCreatedListener