本文整理汇总了Java中org.eclipse.jgit.patch.FileHeader.PatchType类的典型用法代码示例。如果您正苦于以下问题:Java PatchType类的具体用法?Java PatchType怎么用?Java PatchType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PatchType类属于org.eclipse.jgit.patch.FileHeader包,在下文中一共展示了PatchType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: format
import org.eclipse.jgit.patch.FileHeader.PatchType; //导入依赖的package包/类
@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
import org.eclipse.jgit.patch.FileHeader.PatchType; //导入依赖的package包/类
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
import org.eclipse.jgit.patch.FileHeader.PatchType; //导入依赖的package包/类
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);
}