Search in sources :

Example 1 with PatchAttribute

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

the class EventFactory method addPatchSetFileNames.

public void addPatchSetFileNames(PatchSetAttribute patchSetAttribute, Change change, PatchSet patchSet) {
    try {
        PatchList patchList = patchListCache.get(change, patchSet);
        for (PatchListEntry patch : patchList.getPatches()) {
            if (patchSetAttribute.files == null) {
                patchSetAttribute.files = new ArrayList<>();
            }
            PatchAttribute p = new PatchAttribute();
            p.file = patch.getNewName();
            p.fileOld = patch.getOldName();
            p.type = patch.getChangeType();
            p.deletions -= patch.getDeletions();
            p.insertions = patch.getInsertions();
            patchSetAttribute.files.add(p);
        }
    } catch (PatchListNotAvailableException e) {
        log.warn("Cannot get patch list", e);
    }
}
Also used : PatchAttribute(com.google.gerrit.server.data.PatchAttribute) PatchList(com.google.gerrit.server.patch.PatchList) PatchListNotAvailableException(com.google.gerrit.server.patch.PatchListNotAvailableException) PatchListEntry(com.google.gerrit.server.patch.PatchListEntry)

Aggregations

PatchAttribute (com.google.gerrit.server.data.PatchAttribute)1 PatchList (com.google.gerrit.server.patch.PatchList)1 PatchListEntry (com.google.gerrit.server.patch.PatchListEntry)1 PatchListNotAvailableException (com.google.gerrit.server.patch.PatchListNotAvailableException)1