Search in sources :

Example 1 with PatchListKey

use of com.google.gerrit.server.patch.PatchListKey in project gerrit by GerritCodeReview.

the class ChangeData method getDiffSummary.

private Optional<DiffSummary> getDiffSummary() {
    if (diffSummary == null) {
        if (!lazyload()) {
            return Optional.empty();
        }
        Change c = change();
        PatchSet ps = currentPatchSet();
        if (c == null || ps == null || !loadCommitData()) {
            return Optional.empty();
        }
        PatchListKey pk = PatchListKey.againstBase(ps.commitId(), parentCount);
        DiffSummaryKey key = DiffSummaryKey.fromPatchListKey(pk);
        try {
            diffSummary = Optional.of(patchListCache.getDiffSummary(key, c.getProject()));
        } catch (PatchListNotAvailableException e) {
            diffSummary = Optional.empty();
        }
    }
    return diffSummary;
}
Also used : PatchListNotAvailableException(com.google.gerrit.server.patch.PatchListNotAvailableException) PatchSet(com.google.gerrit.entities.PatchSet) Change(com.google.gerrit.entities.Change) PatchListKey(com.google.gerrit.server.patch.PatchListKey) DiffSummaryKey(com.google.gerrit.server.patch.DiffSummaryKey)

Aggregations

Change (com.google.gerrit.entities.Change)1 PatchSet (com.google.gerrit.entities.PatchSet)1 DiffSummaryKey (com.google.gerrit.server.patch.DiffSummaryKey)1 PatchListKey (com.google.gerrit.server.patch.PatchListKey)1 PatchListNotAvailableException (com.google.gerrit.server.patch.PatchListNotAvailableException)1