Search in sources :

Example 1 with EditList

use of org.eclipse.jgit.diff.EditList in project gerrit by GerritCodeReview.

the class PatchListLoader method createPatchListEntry.

private static PatchListEntry createPatchListEntry(RawTextComparator cmp, RevCommit aCommit, Text aText, Text bText, String fileName) {
    byte[] rawHdr = getRawHeader(aCommit != null, fileName);
    byte[] aContent = aText.getContent();
    byte[] bContent = bText.getContent();
    long size = bContent.length;
    long sizeDelta = bContent.length - aContent.length;
    RawText aRawText = new RawText(aContent);
    RawText bRawText = new RawText(bContent);
    EditList edits = new HistogramDiff().diff(cmp, aRawText, bRawText);
    FileHeader fh = new FileHeader(rawHdr, edits, PatchType.UNIFIED);
    return new PatchListEntry(fh, edits, size, sizeDelta);
}
Also used : HistogramDiff(org.eclipse.jgit.diff.HistogramDiff) EditList(org.eclipse.jgit.diff.EditList) RawText(org.eclipse.jgit.diff.RawText) FileHeader(org.eclipse.jgit.patch.FileHeader)

Aggregations

EditList (org.eclipse.jgit.diff.EditList)1 HistogramDiff (org.eclipse.jgit.diff.HistogramDiff)1 RawText (org.eclipse.jgit.diff.RawText)1 FileHeader (org.eclipse.jgit.patch.FileHeader)1