當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。