当前位置: 首页>>代码示例>>Java>>正文


Java PatchType类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:afrojer,项目名称:gitiles,代码行数:17,代码来源:HtmlDiffFormatter.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:PatchListLoader.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:15,代码来源:PatchListLoader.java


注:本文中的org.eclipse.jgit.patch.FileHeader.PatchType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。