implements BuildChooserContext.ContextCallable<AbstractBuild<?, ?>, String> {
@Override
public String invoke(AbstractBuild<?, ?> build, VirtualChannel channel) {
GerritCause cause = (GerritCause)build.getCause(GerritCause.class);
if (cause != null) {
GerritTriggeredEvent event = cause.getEvent();
if (event instanceof ChangeBasedEvent) {
return ((ChangeBasedEvent)event).getPatchSet().getRevision();
}
if (event instanceof RefUpdated) {
return ((RefUpdated)event).getRefUpdate().getNewRev();