Search in sources :

Example 1 with GitReferenceUpdatedListener

use of com.google.gerrit.extensions.events.GitReferenceUpdatedListener in project gerrit by GerritCodeReview.

the class GitReferenceUpdated method fire.

private void fire(Project.NameKey project, String ref, ObjectId oldObjectId, ObjectId newObjectId, ReceiveCommand.Type type, AccountInfo updater) {
    if (!listeners.iterator().hasNext()) {
        return;
    }
    ObjectId o = oldObjectId != null ? oldObjectId : ObjectId.zeroId();
    ObjectId n = newObjectId != null ? newObjectId : ObjectId.zeroId();
    Event event = new Event(project, ref, o.name(), n.name(), type, updater);
    for (GitReferenceUpdatedListener l : listeners) {
        try {
            l.onGitReferenceUpdated(event);
        } catch (Exception e) {
            util.logEventListenerError(this, l, e);
        }
    }
}
Also used : ObjectId(org.eclipse.jgit.lib.ObjectId) GitReferenceUpdatedListener(com.google.gerrit.extensions.events.GitReferenceUpdatedListener)

Aggregations

GitReferenceUpdatedListener (com.google.gerrit.extensions.events.GitReferenceUpdatedListener)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1