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


Java RawParseUtils.endOfFooterLineKey方法代码示例

本文整理汇总了Java中org.eclipse.jgit.util.RawParseUtils.endOfFooterLineKey方法的典型用法代码示例。如果您正苦于以下问题:Java RawParseUtils.endOfFooterLineKey方法的具体用法?Java RawParseUtils.endOfFooterLineKey怎么用?Java RawParseUtils.endOfFooterLineKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.util.RawParseUtils的用法示例。


在下文中一共展示了RawParseUtils.endOfFooterLineKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseCommentLength

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static int parseCommentLength(byte[] note, MutableInteger curr, Change.Id changeId)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, LENGTH, changeId);
  int startOfLength = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
  MutableInteger i = new MutableInteger();
  i.value = startOfLength;
  int commentLength = RawParseUtils.parseBase10(note, startOfLength, i);
  if (i.value == startOfLength) {
    throw parseException(changeId, "could not parse %s", LENGTH);
  }
  int endOfLine = RawParseUtils.nextLF(note, curr.value);
  if (i.value != endOfLine - 1) {
    throw parseException(changeId, "could not parse %s", LENGTH);
  }
  curr.value = endOfLine;
  return checkResult(commentLength, "comment length", changeId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ChangeNoteUtil.java

示例2: getFooterLines

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
 * Parse the footer lines (e.g. "Signed-off-by") for machine processing.
 * <p>
 * This method splits all of the footer lines out of the last paragraph of
 * the commit message, providing each line as a key-value pair, ordered by
 * the order of the line's appearance in the commit message itself.
 * <p>
 * A footer line's key must match the pattern {@code ^[A-Za-z0-9-]+:}, while
 * the value is free-form, but must not contain an LF. Very common keys seen
 * in the wild are:
 * <ul>
 * <li>{@code Signed-off-by} (agrees to Developer Certificate of Origin)
 * <li>{@code Acked-by} (thinks change looks sane in context)
 * <li>{@code Reported-by} (originally found the issue this change fixes)
 * <li>{@code Tested-by} (validated change fixes the issue for them)
 * <li>{@code CC}, {@code Cc} (copy on all email related to this change)
 * <li>{@code Bug} (link to project's bug tracking system)
 * </ul>
 *
 * @return ordered list of footer lines; empty list if no footers found.
 */
public final List<FooterLine> getFooterLines() {
	final byte[] raw = buffer;
	int ptr = raw.length - 1;
	while (raw[ptr] == '\n') // trim any trailing LFs, not interesting
		ptr--;

	final int msgB = RawParseUtils.commitMessage(raw, 0);
	final ArrayList<FooterLine> r = new ArrayList<>(4);
	final Charset enc = guessEncoding();
	for (;;) {
		ptr = RawParseUtils.prevLF(raw, ptr);
		if (ptr <= msgB)
			break; // Don't parse commit headers as footer lines.

		final int keyStart = ptr + 2;
		if (raw[keyStart] == '\n')
			break; // Stop at first paragraph break, no footers above it.

		final int keyEnd = RawParseUtils.endOfFooterLineKey(raw, keyStart);
		if (keyEnd < 0)
			continue; // Not a well formed footer line, skip it.

		// Skip over the ': *' at the end of the key before the value.
		//
		int valStart = keyEnd + 1;
		while (valStart < raw.length && raw[valStart] == ' ')
			valStart++;

		// Value ends at the LF, and does not include it.
		//
		int valEnd = RawParseUtils.nextLF(raw, valStart);
		if (raw[valEnd - 1] == '\n')
			valEnd--;

		r.add(new FooterLine(raw, enc, keyStart, keyEnd, valStart, valEnd));
	}
	Collections.reverse(r);
	return r;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:61,代码来源:RevCommit.java

示例3: parseStringField

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static String parseStringField(
    byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
    throws ConfigInvalidException {
  int endOfLine = RawParseUtils.nextLF(note, curr.value);
  checkHeaderLineFormat(note, curr, fieldName, changeId);
  int startOfField = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
  curr.value = endOfLine;
  return RawParseUtils.decode(UTF_8, note, startOfField, endOfLine - 1);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:ChangeNoteUtil.java

示例4: parsePsId

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static PatchSet.Id parsePsId(
    byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, fieldName, changeId);
  int startOfPsId = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
  MutableInteger i = new MutableInteger();
  int patchSetId = RawParseUtils.parseBase10(note, startOfPsId, i);
  int endOfLine = RawParseUtils.nextLF(note, curr.value);
  if (i.value != endOfLine - 1) {
    throw parseException(changeId, "could not parse %s", fieldName);
  }
  checkResult(patchSetId, "patchset id", changeId);
  curr.value = endOfLine;
  return new PatchSet.Id(changeId, patchSetId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:ChangeNoteUtil.java

示例5: parseParentNumber

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static Integer parseParentNumber(byte[] note, MutableInteger curr, Change.Id changeId)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, PARENT_NUMBER, changeId);

  int start = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
  MutableInteger i = new MutableInteger();
  int parentNumber = RawParseUtils.parseBase10(note, start, i);
  int endOfLine = RawParseUtils.nextLF(note, curr.value);
  if (i.value != endOfLine - 1) {
    throw parseException(changeId, "could not parse %s", PARENT_NUMBER);
  }
  checkResult(parentNumber, "parent number", changeId);
  curr.value = endOfLine;
  return Integer.valueOf(parentNumber);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:ChangeNoteUtil.java

示例6: parseFilename

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static String parseFilename(byte[] note, MutableInteger curr, Change.Id changeId)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, FILE, changeId);
  int startOfFileName = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
  int endOfLine = RawParseUtils.nextLF(note, curr.value);
  curr.value = endOfLine;
  curr.value = RawParseUtils.nextLF(note, curr.value);
  return QuotedString.GIT_PATH.dequote(
      RawParseUtils.decode(UTF_8, note, startOfFileName, endOfLine - 1));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeNoteUtil.java

示例7: parseAuthor

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private Account.Id parseAuthor(
    byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, fieldName, changeId);
  int startOfAccountId = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
  PersonIdent ident = RawParseUtils.parsePersonIdent(note, startOfAccountId);
  Account.Id aId = parseIdent(ident, changeId);
  curr.value = RawParseUtils.nextLF(note, curr.value);
  return checkResult(aId, fieldName, changeId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeNoteUtil.java


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