Search in sources :

Example 1 with ChangeType

use of com.google.gerrit.reviewdb.client.Patch.ChangeType in project gerrit by GerritCodeReview.

the class PatchListEntry method readFrom.

static PatchListEntry readFrom(InputStream in) throws IOException {
    ChangeType changeType = readEnum(in, ChangeType.values());
    PatchType patchType = readEnum(in, PatchType.values());
    String oldName = readString(in);
    String newName = readString(in);
    byte[] hdr = readBytes(in);
    int ins = readVarInt32(in);
    int del = readVarInt32(in);
    long size = readFixInt64(in);
    long sizeDelta = readFixInt64(in);
    int editCount = readVarInt32(in);
    Edit[] editArray = new Edit[editCount];
    for (int i = 0; i < editCount; i++) {
        int beginA = readVarInt32(in);
        int endA = readVarInt32(in);
        int beginB = readVarInt32(in);
        int endB = readVarInt32(in);
        editArray[i] = new Edit(beginA, endA, beginB, endB);
    }
    return new PatchListEntry(changeType, patchType, oldName, newName, hdr, toList(editArray), ins, del, size, sizeDelta);
}
Also used : ChangeType(com.google.gerrit.reviewdb.client.Patch.ChangeType) PatchType(com.google.gerrit.reviewdb.client.Patch.PatchType) Edit(org.eclipse.jgit.diff.Edit) BasicSerialization.writeString(com.google.gerrit.server.ioutil.BasicSerialization.writeString) BasicSerialization.readString(com.google.gerrit.server.ioutil.BasicSerialization.readString)

Aggregations

ChangeType (com.google.gerrit.reviewdb.client.Patch.ChangeType)1 PatchType (com.google.gerrit.reviewdb.client.Patch.PatchType)1 BasicSerialization.readString (com.google.gerrit.server.ioutil.BasicSerialization.readString)1 BasicSerialization.writeString (com.google.gerrit.server.ioutil.BasicSerialization.writeString)1 Edit (org.eclipse.jgit.diff.Edit)1