Search in sources :

Example 6 with RefUpdateAttribute

use of com.google.gerrit.server.data.RefUpdateAttribute in project gerrit by GerritCodeReview.

the class EventFactory method asRefUpdateAttribute.

/**
 * Create a {@link RefUpdateAttribute} for the given old ObjectId, new ObjectId, and branch that
 * is suitable for serialization to JSON.
 */
public RefUpdateAttribute asRefUpdateAttribute(ObjectId oldId, ObjectId newId, BranchNameKey refName) {
    RefUpdateAttribute ru = new RefUpdateAttribute();
    ru.newRev = newId != null ? newId.getName() : ObjectId.zeroId().getName();
    ru.oldRev = oldId != null ? oldId.getName() : ObjectId.zeroId().getName();
    ru.project = refName.project().get();
    ru.refName = refName.branch();
    return ru;
}
Also used : RefUpdateAttribute(com.google.gerrit.server.data.RefUpdateAttribute)

Aggregations

RefUpdateAttribute (com.google.gerrit.server.data.RefUpdateAttribute)6 RefUpdatedEvent (com.google.gerrit.server.events.RefUpdatedEvent)2 Test (org.junit.Test)2 AccountAttribute (com.google.gerrit.server.data.AccountAttribute)1