本文整理汇总了Java中org.eclipse.jgit.patch.FileHeader.PatchType.UNIFIED属性的典型用法代码示例。如果您正苦于以下问题:Java PatchType.UNIFIED属性的具体用法?Java PatchType.UNIFIED怎么用?Java PatchType.UNIFIED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jgit.patch.FileHeader.PatchType
的用法示例。
在下文中一共展示了PatchType.UNIFIED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: format
@Override
public void format(FileHeader hdr, RawText a, RawText b)
throws IOException {
int start = hdr.getStartOffset();
int end = hdr.getEndOffset();
if (!hdr.getHunks().isEmpty()) {
end = hdr.getHunks().get(0).getStartOffset();
}
renderHeader(RawParseUtils.decode(hdr.getBuffer(), start, end));
if (hdr.getPatchType() == PatchType.UNIFIED) {
getOutputStream().write(DIFF_BEGIN);
format(hdr.toEditList(), a, b);
getOutputStream().write(DIFF_END);
}
}
示例2: 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, ImmutableSet.of(), size, sizeDelta);
}
示例3: newEntry
private static PatchListEntry newEntry(
RevTree aTree, FileHeader fileHeader, Set<Edit> editsDueToRebase, long size, long sizeDelta) {
if (aTree == null // want combined diff
|| fileHeader.getPatchType() != PatchType.UNIFIED
|| fileHeader.getHunks().isEmpty()) {
return new PatchListEntry(fileHeader, ImmutableList.of(), ImmutableSet.of(), size, sizeDelta);
}
List<Edit> edits = fileHeader.toEditList();
if (edits.isEmpty()) {
return new PatchListEntry(fileHeader, ImmutableList.of(), ImmutableSet.of(), size, sizeDelta);
}
return new PatchListEntry(fileHeader, edits, editsDueToRebase, size, sizeDelta);
}